summaryrefslogtreecommitdiff
path: root/inotail.h
blob: c733943c2979ff76125bb1aca4d87781be9ea52e (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
45
46
47
48
49
50
51
52
/*
 * Copyright (C) 2005-2009, 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

#include <sys/types.h>
#include <sys/inotify.h>

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

/* inotify event buffer length for one file */
#define INOTIFY_BUFLEN (4 * sizeof(struct inotify_event))

/* tail modes */
enum tail_mode { 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 size;		/* File size */
	blksize_t blksize;	/* Blocksize for filesystem I/O */
	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))

#define is_digit(c) ((c) >= '0' && (c) <= '9')

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

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

#endif /* _INOTAIL_H */
span>/+1 2015-08-03locking/static_keys: Add selftestPeter Zijlstra1-1/+38 2015-08-03locking/static_keys: Add a new static_key interfacePeter Zijlstra1-7/+30 2015-08-03locking/static_keys: Rework update logicPeter Zijlstra1-50/+38 2015-08-03jump_label: Add jump_entry_key() helperPeter Zijlstra1-4/+9 2015-08-03jump_label, locking/static_keys: Rename JUMP_LABEL_TYPE_* and related helpers...Peter Zijlstra1-9/+16 2015-08-03jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE to JUMP_LABEL_{JMP,NOP}Peter Zijlstra1-9/+9 2015-05-27module, jump_label: Fix module lockingPeter Zijlstra1-4/+6 2013-10-19static_key: WARN on usage before jump_label_init was calledHannes Frederic Sowa1-0/+5 2013-08-09jump_label: Split jumplabel ratelimitAndrew Jones1-0/+1 2012-08-06jump_label: Export jump_label_rate_limit()Gleb Natapov1-0/+1 2012-02-28static keys: Inline the static_key_enabled() functionJason Baron1-6/+0 2012-02-24static keys: Introduce 'struct static_key', static_key_true()/false() and sta...Ingo Molnar1-54/+74 2012-02-22jump label: Fix compiler warningJason Baron1-1/+1 2012-02-22jump label: Add a WARN() if jump label key count goes negativeJason Baron1-1/+4 2011-12-27Merge remote-tracking branch 'tip/perf/core' into kvm-updates/3.3Avi Kivity1-7/+42 2011-12-27jump-label: export jump_label_inc/jump_label_decXiao Guangrong1-0/+2 2011-12-06jump_label: Provide jump_label_key initializersPeter Zijlstra1-4/+8 2011-12-06jump_label, x86: Fix section mismatchPeter Zijlstra1-1/+1 2011-12-06perf, core: Rate limit perf_sched_events jump_label patchingGleb Natapov1-2/+33 2011-12-05jump_label: jump_label_inc may return before the code is patchedGleb Natapov1-1/+2 2011-11-11Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git...Ingo Molnar1-1/+2 2011-11-07jump_label: jump_label_inc may return before the code is patchedGleb Natapov1-1/+2 2011-10-25jump-label: initialize jump-label subsystem much earlierJeremy Fitzhardinge1-4/+1 2011-10-25jump_label: add arch_jump_label_transform_static() to optimise non-live code ...Jeremy Fitzhardinge1-3/+15 2011-10-25jump_label: if a key has already been initialized, don't nop it outJeremy Fitzhardinge1-12/+8 2011-06-29jump_label: Fix jump_label update for modulesXiao Guangrong1-5/+9 2011-05-25jump_label: Check entries limit in __jump_label_updateJiri Olsa1-5/+13 2011-04-04jump label: Introduce static_branch() interfaceJason Baron1-321/+218 2010-10-29jump label: Make arch_jump_label_text_poke_early() optionalSteven Rostedt1-0/+7 2010-10-28jump label: Fix deadlock b/w jump_label_mutex vs. text_mutexJason Baron1-12/+21 2010-10-28jump label: Fix module __init section raceJason Baron1-1/+40 2010-09-22jump label: Add jump_label_text_reserved() to reserve jump pointsJason Baron1-0/+83 2010-09-22jump label: Base patch for jump labelJason Baron1-0/+346