1#ifndef _LINUX_INOTIFY_SYSCALLS_H
2#define _LINUX_INOTIFY_SYSCALLS_H
3
4#include <sys/syscall.h>
5
6#if defined(__i386__)
7# define __NR_inotify_init	291
8# define __NR_inotify_add_watch	292
9# define __NR_inotify_rm_watch	293
10#elif defined(__x86_64__)
11# define __NR_inotify_init	253
12# define __NR_inotify_add_watch	254
13# define __NR_inotify_rm_watch	255
14#elif defined(__powerpc__) || defined(__powerpc64__)
15# define __NR_inotify_init	275
16# define __NR_inotify_add_watch	276
17# define __NR_inotify_rm_watch	277
18#elif defined (__mips__)
19# if _MIPS_SIM == _MIPS_SIM_ABI32
20#  define __NR_inotify_init (__NR_Linux + 284)
21#  define __NR_inotify_add_watch (__NR_Linux + 285)
22#  define __NR_inotify_rm_watch (__NR_Linux + 286)
23# endif
24# if _MIPS_SIM == _MIPS_SIM_ABI64
25#  define __NR_inotify_init (__NR_Linux + 243)
26#  define __NR_inotify_add_watch (__NR_Linux + 243)
27#  define __NR_inotify_rm_watch (__NR_Linux + 243)
28# endif
29# if _MIPS_SIM == _MIPS_SIM_NABI32
30#  define __NR_inotify_init (__NR_Linux + 247)
31#  define __NR_inotify_add_watch (__NR_Linux + 248)
32#  define __NR_inotify_rm_watch (__NR_Linux + 249)
33# endif
34#elif defined (__ia64__)
35# define __NR_inotify_init	1277
36# define __NR_inotify_add_watch	1278
37# define __NR_inotify_rm_watch	1279
38#elif defined (__s390__)
39# define __NR_inotify_init	284
40# define __NR_inotify_add_watch	285
41# define __NR_inotify_rm_watch	286
42#elif defined (__alpha__)
43# define __NR_inotify_init	444
44# define __NR_inotify_add_watch	445
45# define __NR_inotify_rm_watch	446
46#elif defined (__sparc__) || defined (__sparc64__)
47# define __NR_inotify_init	151
48# define __NR_inotify_add_watch	152
49# define __NR_inotify_rm_watch	156
50#elif defined (__arm__)
51# define __NR_inotify_init (__NR_SYSCALL_BASE+316)
52# define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
53# define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
54#elif defined (__sh__)
55# define __NR_inotify_init	290
56# define __NR_inotify_add_watch	291
57# define __NR_inotify_rm_watch	292
58#else
59# error "Unsupported architecture!"
60#endif
61
62static inline int inotify_init (void)
63{
64	return syscall (__NR_inotify_init);
65}
66
67static inline int inotify_add_watch (int fd, const char *name, __u32 mask)
68{
69	return syscall (__NR_inotify_add_watch, fd, name, mask);
70}
71
72static inline int inotify_rm_watch (int fd, __u32 wd)
73{
74	return syscall (__NR_inotify_rm_watch, fd, wd);
75}
76
77#endif /* _LINUX_INOTIFY_SYSCALLS_H */
78