]>
Commit | Line | Data |
---|---|---|
356b432c AM |
1 | diff -urNp -x '*.orig' cronie-1.5.6.org/configure.ac cronie-1.5.6/configure.ac |
2 | --- cronie-1.5.6.org/configure.ac 2021-03-17 16:34:06.000000000 +0100 | |
3 | +++ cronie-1.5.6/configure.ac 2021-03-20 23:36:43.706964317 +0100 | |
4 | @@ -30,7 +30,6 @@ AC_CHECK_HEADERS( \ | |
f440f0d0 ER |
5 | stddef.h \ |
6 | stdint.h \ | |
7 | sys/audit.h \ | |
8 | - sys/inotify.h \ | |
9 | sys/stat.h \ | |
10 | sys/stream.h \ | |
11 | sys/stropts.h \ | |
356b432c | 12 | @@ -119,9 +118,16 @@ AC_SUBST(DAEMON_GROUPNAME) |
f440f0d0 ER |
13 | AC_ARG_WITH(inotify, |
14 | [AS_HELP_STRING([--with-inotify], [ Enable inotify support])], | |
15 | [ if test "x$withval" != "xno" ; then | |
16 | + AC_MSG_CHECKING([whether sys/inotify.h actually works]) | |
17 | + AC_RUN_IFELSE( | |
18 | + AC_LANG_PROGRAM([[#include <sys/inotify.h>]], | |
19 | + [[return (-1 == inotify_init());]] | |
20 | + ), | |
21 | + [AC_MSG_RESULT([yup]); AC_DEFINE([SYS_INOTIFY_H_EXISTS_AND_WORKS],[1],[sys/inotify.h exists and works correctly])], | |
22 | + [AC_MSG_RESULT([nope, using own inotify headers])] | |
23 | + ) | |
24 | + | |
25 | AC_DEFINE(WITH_INOTIFY,1,[Define if you want inotify support.]) | |
26 | - AC_CHECK_HEADER([sys/inotify.h], , AC_MSG_ERROR(Inotify support requires sys/inotify.h header)) | |
27 | - AC_CHECK_FUNCS(inotify_init inotify_add_watch) | |
28 | fi | |
29 | ] | |
30 | ) | |
356b432c AM |
31 | diff -urNp -x '*.orig' cronie-1.5.6.org/src/cron.c cronie-1.5.6/src/cron.c |
32 | --- cronie-1.5.6.org/src/cron.c 2021-01-22 12:29:39.000000000 +0100 | |
33 | +++ cronie-1.5.6/src/cron.c 2021-03-20 23:36:43.706964317 +0100 | |
34 | @@ -43,7 +43,11 @@ | |
35 | #include <fcntl.h> | |
36 | ||
37 | #ifdef WITH_INOTIFY | |
38 | +#ifdef SYS_INOTIFY_H_EXISTS_AND_WORKS | |
39 | # include <sys/inotify.h> | |
40 | +#else | |
41 | +#include "inotify-nosys.h" | |
42 | +#endif | |
43 | #endif | |
44 | ||
45 | #include "cronie_common.h" | |
46 | diff -urNp -x '*.orig' cronie-1.5.6.org/src/inotify-nosys.h cronie-1.5.6/src/inotify-nosys.h | |
47 | --- cronie-1.5.6.org/src/inotify-nosys.h 1970-01-01 01:00:00.000000000 +0100 | |
48 | +++ cronie-1.5.6/src/inotify-nosys.h 2021-03-20 23:36:43.706964317 +0100 | |
f440f0d0 ER |
49 | @@ -0,0 +1,167 @@ |
50 | +/* | |
51 | + * This header is used if <sys/inotify.h> cannot be found. | |
52 | + * | |
53 | + * Inode based directory notification for Linux | |
54 | + * | |
55 | + * Copyright (C) 2005 John McCutchan | |
56 | + */ | |
57 | + | |
58 | +#ifndef _LINUX_INOTIFY_H | |
59 | +#define _LINUX_INOTIFY_H | |
60 | + | |
61 | +#include <stdint.h> | |
62 | +#include <sys/syscall.h> | |
63 | +#include <unistd.h> | |
64 | + | |
65 | +/* | |
66 | + * struct inotify_event - structure read from the inotify device for each event | |
67 | + * | |
68 | + * When you are watching a directory, you will receive the filename for events | |
69 | + * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. | |
70 | + */ | |
71 | +struct inotify_event { | |
72 | + int wd; /* watch descriptor */ | |
73 | + uint32_t mask; /* watch mask */ | |
74 | + uint32_t cookie; /* cookie to synchronize two events */ | |
75 | + uint32_t len; /* length (including nulls) of name */ | |
76 | + char name __flexarr; /* stub for possible name */ | |
77 | +}; | |
78 | + | |
79 | +/* the following are legal, implemented events that user-space can watch for */ | |
80 | +#define IN_ACCESS 0x00000001 /* File was accessed */ | |
81 | +#define IN_MODIFY 0x00000002 /* File was modified */ | |
82 | +#define IN_ATTRIB 0x00000004 /* Metadata changed */ | |
83 | +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ | |
84 | +#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ | |
85 | +#define IN_OPEN 0x00000020 /* File was opened */ | |
86 | +#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ | |
87 | +#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ | |
88 | +#define IN_CREATE 0x00000100 /* Subfile was created */ | |
89 | +#define IN_DELETE 0x00000200 /* Subfile was deleted */ | |
90 | +#define IN_DELETE_SELF 0x00000400 /* Self was deleted */ | |
91 | +#define IN_MOVE_SELF 0x00000800 /* Self was moved */ | |
92 | + | |
93 | +/* the following are legal events. they are sent as needed to any watch */ | |
94 | +#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ | |
95 | +#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ | |
96 | +#define IN_IGNORED 0x00008000 /* File was ignored */ | |
97 | + | |
98 | +/* helper events */ | |
99 | +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ | |
100 | +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ | |
101 | + | |
102 | +/* special flags */ | |
103 | +#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ | |
104 | +#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ | |
105 | +#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ | |
106 | +#define IN_ISDIR 0x40000000 /* event occurred against dir */ | |
107 | +#define IN_ONESHOT 0x80000000 /* only send event once */ | |
108 | + | |
109 | +/* | |
110 | + * All of the events - we build the list by hand so that we can add flags in | |
111 | + * the future and not break backward compatibility. Apps will get only the | |
112 | + * events that they originally wanted. Be sure to add new events here! | |
113 | + */ | |
114 | +#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ | |
115 | + IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ | |
116 | + IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ | |
117 | + IN_MOVE_SELF) | |
118 | + | |
119 | +#if defined (__alpha__) | |
120 | +# define __NR_inotify_init 444 | |
121 | +# define __NR_inotify_add_watch 445 | |
122 | +# define __NR_inotify_rm_watch 446 | |
123 | + | |
124 | +#elif defined (__arm__) | |
125 | +# define __NR_inotify_init (__NR_SYSCALL_BASE+316) | |
126 | +# define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) | |
127 | +# define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) | |
128 | + | |
129 | +#elif defined (__frv__) | |
130 | +# define __NR_inotify_init 291 | |
131 | +# define __NR_inotify_add_watch 292 | |
132 | +# define __NR_inotify_rm_watch 293 | |
133 | + | |
134 | +#elif defined(__i386__) | |
135 | +# define __NR_inotify_init 291 | |
136 | +# define __NR_inotify_add_watch 292 | |
137 | +# define __NR_inotify_rm_watch 293 | |
138 | + | |
139 | +#elif defined (__ia64__) | |
140 | +# define __NR_inotify_init 1277 | |
141 | +# define __NR_inotify_add_watch 1278 | |
142 | +# define __NR_inotify_rm_watch 1279 | |
143 | + | |
144 | +#elif defined (__mips__) | |
145 | +# if _MIPS_SIM == _MIPS_SIM_ABI32 | |
146 | +# define __NR_inotify_init (__NR_Linux + 284) | |
147 | +# define __NR_inotify_add_watch (__NR_Linux + 285) | |
148 | +# define __NR_inotify_rm_watch (__NR_Linux + 286) | |
149 | +# endif | |
150 | +# if _MIPS_SIM == _MIPS_SIM_ABI64 | |
151 | +# define __NR_inotify_init (__NR_Linux + 243) | |
152 | +# define __NR_inotify_add_watch (__NR_Linux + 243) | |
153 | +# define __NR_inotify_rm_watch (__NR_Linux + 243) | |
154 | +# endif | |
155 | +# if _MIPS_SIM == _MIPS_SIM_NABI32 | |
156 | +# define __NR_inotify_init (__NR_Linux + 247) | |
157 | +# define __NR_inotify_add_watch (__NR_Linux + 248) | |
158 | +# define __NR_inotify_rm_watch (__NR_Linux + 249) | |
159 | +# endif | |
160 | + | |
161 | +#elif defined(__parisc__) | |
162 | +# define __NR_inotify_init (__NR_Linux + 269) | |
163 | +# define __NR_inotify_add_watch (__NR_Linux + 270) | |
164 | +# define __NR_inotify_rm_watch (__NR_Linux + 271) | |
165 | + | |
166 | +#elif defined(__powerpc__) || defined(__powerpc64__) | |
167 | +# define __NR_inotify_init 275 | |
168 | +# define __NR_inotify_add_watch 276 | |
169 | +# define __NR_inotify_rm_watch 277 | |
170 | + | |
171 | +#elif defined (__s390__) | |
172 | +# define __NR_inotify_init 284 | |
173 | +# define __NR_inotify_add_watch 285 | |
174 | +# define __NR_inotify_rm_watch 286 | |
175 | + | |
176 | +#elif defined (__sh__) | |
177 | +# define __NR_inotify_init 290 | |
178 | +# define __NR_inotify_add_watch 291 | |
179 | +# define __NR_inotify_rm_watch 292 | |
180 | + | |
181 | +#elif defined (__sh64__) | |
182 | +# define __NR_inotify_init 318 | |
183 | +# define __NR_inotify_add_watch 319 | |
184 | +# define __NR_inotify_rm_watch 320 | |
185 | + | |
186 | +#elif defined (__sparc__) || defined (__sparc64__) | |
187 | +# define __NR_inotify_init 151 | |
188 | +# define __NR_inotify_add_watch 152 | |
189 | +# define __NR_inotify_rm_watch 156 | |
190 | + | |
191 | +#elif defined(__x86_64__) | |
192 | +# define __NR_inotify_init 253 | |
193 | +# define __NR_inotify_add_watch 254 | |
194 | +# define __NR_inotify_rm_watch 255 | |
195 | + | |
196 | +#else | |
197 | +# error "Unsupported architecture!" | |
198 | +#endif | |
199 | + | |
200 | +static inline int inotify_init (void) | |
201 | +{ | |
202 | + return syscall (__NR_inotify_init); | |
203 | +} | |
204 | + | |
205 | +static inline int inotify_add_watch (int fd, const char *name, uint32_t mask) | |
206 | +{ | |
207 | + return syscall (__NR_inotify_add_watch, fd, name, mask); | |
208 | +} | |
209 | + | |
210 | +static inline int inotify_rm_watch (int fd, uint32_t wd) | |
211 | +{ | |
212 | + return syscall (__NR_inotify_rm_watch, fd, wd); | |
213 | +} | |
214 | + | |
215 | + | |
216 | +#endif /* _LINUX_INOTIFY_H */ |