summaryrefslogtreecommitdiff
path: root/inotail.h
blob: 4c57867aaa93e2972923ccf4540bc97d5e91cfd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright (C) 2005-2006, Tobias Klauser <tklauser@distanz.ch>
 *
 * Licensed under the terms of the GNU General Public License; version 2 or later.
 */

#ifndef _INOTAIL_H
#define _INOTAIL_H

/* Number of items to tail. */
#define DEFAULT_N_LINES 10

/* tail modes */
enum { M_LINES, M_BYTES };

/* Every tailed file is represented as a file_struct */
struct file_struct {
	char *name;		/* Name of file (or '-' for stdin) */
	int fd;			/* File descriptor (or -1 if file is not open */
	off_t st_size;		/* File size */
	unsigned ignore;	/* Whether to ignore the file in further processing */
	int i_watch;		/* Inotify watch associated with file_struct */
};

#define IS_PIPELIKE(mode) \
	(S_ISFIFO(mode) || S_ISSOCK(mode))

/* inotail works on these file types */
#define IS_TAILABLE(mode) \
	(S_ISREG(mode) || IS_PIPELIKE(mode) || S_ISCHR(mode))

#ifdef DEBUG
# define dprintf(fmt, args...) fprintf(stderr, fmt, ##args)
#else
# define dprintf(fmt, args...)
#endif /* DEBUG */

#ifdef __GNUC__
# define unlikely(x) __builtin_expect(!!(x), 0)
#else
# define unlikely(x) (x)
#endif /* __GNUC__ */

#endif /* _INOTAIL_H */
/+24 2015-05-12gpio: sysfs: remove FLAG_SYSFS_DIRJohan Hovold1-8/+7 2015-05-12gpio: sysfs: rename active-low helperJohan Hovold1-2/+2 2015-05-12gpio: sysfs: fix race between gpiod export and unexportJohan Hovold1-25/+26 2015-05-12gpio: sysfs: use per-gpio lockingJohan Hovold1-18/+34 2015-05-12gpio: sysfs: clean up gpiod_export_link lockingJohan Hovold1-20/+8 2015-05-12gpio: sysfs: clean up edge_storeJohan Hovold1-5/+7 2015-05-12gpio: sysfs: split irq allocation and deallocationJohan Hovold1-37/+37 2015-05-12gpio: sysfs: only call irq helper if neededJohan Hovold1-5/+14 2015-05-12gpio: sysfs: clean up interrupt-interface implementationJohan Hovold1-36/+18 2015-05-12gpio: sysfs: remove redundant gpio-descriptor parametersJohan Hovold1-13/+11 2015-05-12gpio: sysfs: add gpiod class-device dataJohan Hovold1-16/+46 2015-05-12gpio: sysfs: remove redundant export testsJohan Hovold1-51/+23 2015-05-12gpio: sysfs: release irq after class-device deregistrationJohan Hovold1-1/+5 2015-05-12gpio: sysfs: use DEVICE_ATTR macrosJohan Hovold1-25/+18 2015-05-12gpio: remove gpiod_sysfs_set_active_lowJohan Hovold1-46/+2 2015-05-12gpio: sysfs: rename gpiochip registration functionsJohan Hovold1-7/+9 2015-05-12gpio: sysfs: clean up chip class-device handlingJohan Hovold1-26/+13 2015-05-12gpio: sysfs: reduce gpiochip-export locking scopeJohan Hovold1-3/+4 2015-05-12gpio: sysfs: preparatory clean upsJohan Hovold1-4/+4 2015-05-12gpio: sysfs: fix redundant lock-as-irq handlingJohan Hovold1-7/+15 2015-04-29gpio: sysfs: fix memory leaks and device hotplugJohan Hovold1-0/+19 2015-01-30gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_lowJohan Hovold1-1/+1 2015-01-30gpio: sysfs: fix memory leak in gpiod_export_linkJohan Hovold1-0/+1 2015-01-15gpio: sysfs: fix gpio attribute-creation raceJohan Hovold1-22/+39 2015-01-15gpio: sysfs: fix gpio device-attribute leakJohan Hovold1-15/+13 2015-01-15gpio: sysfs: fix gpio-chip device-attribute leakJohan Hovold1-11/+8 2014-11-28gpio: remove const modifier from gpiod_get_direction()Alexandre Courbot1-1/+1 2014-10-28gpio: rename gpio_lock_as_irq to gpiochip_lock_as_irqAlexandre Courbot1-2/+2 2014-07-24gpio: remove useless check in gpiolib_sysfs_init()Alexandre Courbot1-1/+1 2014-07-23gpio: remove gpiod_lock/unlock_as_irq()Alexandre Courbot1-2/+2 2014-07-23gpio: simplify gpiochip_export()Alexandre Courbot1-11/+9 2014-07-09gpio: move sysfs support to its own fileAlexandre Courbot1-0/+829