summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <seb@dbzteam.org>2011-02-02 11:06:13 +0100
committerSebastien Martini <seb@dbzteam.org>2011-02-02 11:06:13 +0100
commit7afc73252ea1de3c5bb61eb3803126def0048dd0 (patch)
treef8a981737c3797be98dd0c0c74abfd47ad571306
parent206b35ef39c7b7af4fee42dd25dc5703c9b114ea (diff)
downloadpyinotify-7afc73252ea1de3c5bb61eb3803126def0048dd0.tar.gz
By default use system calls numbers defined in <sys/syscall.h>.
-rw-r--r--common/inotify_syscalls.c164
1 files changed, 85 insertions, 79 deletions
diff --git a/common/inotify_syscalls.c b/common/inotify_syscalls.c
index a4c45f8..1d5c859 100644
--- a/common/inotify_syscalls.c
+++ b/common/inotify_syscalls.c
@@ -20,90 +20,96 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-#include <Python.h>
#include <sys/syscall.h>
+#include <Python.h>
-#if defined(__i386__)
+#if (defined(__NR_inotify_init) && defined(__NR_inotify_add_watch) && \
+ defined(__NR_inotify_rm_watch))
+/* System calls numbers obtained from included sys/syscall.h. */
+#else
+/* Otherwise rely on known values. */
+# if defined(__i386__)
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
-#elif defined(__x86_64__)
-# define __NR_inotify_init 253
-# define __NR_inotify_add_watch 254
-# define __NR_inotify_rm_watch 255
-#elif (defined(__powerpc__) || defined(__powerpc64__))
-# define __NR_inotify_init 275
-# define __NR_inotify_add_watch 276
-# define __NR_inotify_rm_watch 277
-#elif defined (__ia64__)
-# define __NR_inotify_init 1277
-# define __NR_inotify_add_watch 1278
-# define __NR_inotify_rm_watch 1279
-#elif defined (__s390__)
-# define __NR_inotify_init 284
-# define __NR_inotify_add_watch 285
-# define __NR_inotify_rm_watch 286
-#elif defined (__alpha__)
-# define __NR_inotify_init 444
-# define __NR_inotify_add_watch 445
-# define __NR_inotify_rm_watch 446
-#elif defined (__sparc__) || defined (__sparc64__)
-# define __NR_inotify_init 151
-# define __NR_inotify_add_watch 152
-# define __NR_inotify_rm_watch 156
-#elif defined (__arm__)
-# define __NR_inotify_init 316
-# define __NR_inotify_add_watch 317
-# define __NR_inotify_rm_watch 318
-#elif defined (__sh__)
-# define __NR_inotify_init 290
-# define __NR_inotify_add_watch 291
-# define __NR_inotify_rm_watch 292
-#elif defined (__sh64__)
-# define __NR_inotify_init 318
-# define __NR_inotify_add_watch 319
-# define __NR_inotify_rm_watch 320
-#elif defined (__hppa__)
-# define __NR_inotify_init 269
-# define __NR_inotify_add_watch 270
-# define __NR_inotify_rm_watch 271
-#elif defined (__mips__)
-# define _MIPS_SIM_ABI32 1
-# define _MIPS_SIM_NABI32 2
-# define _MIPS_SIM_ABI64 3
-# if _MIPS_SIM == _MIPS_SIM_ABI32
-# define __NR_Linux 4000
-# define __NR_inotify_init (__NR_Linux + 284)
-# define __NR_inotify_add_watch (__NR_Linux + 285)
-# define __NR_inotify_rm_watch (__NR_Linux + 286)
-# endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
-# if _MIPS_SIM == _MIPS_SIM_ABI64
-# define __NR_Linux 5000
-# define __NR_inotify_init (__NR_Linux + 243)
-# define __NR_inotify_add_watch (__NR_Linux + 244)
-# define __NR_inotify_rm_watch (__NR_Linux + 245)
-# endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
-# if _MIPS_SIM == _MIPS_SIM_NABI32
-# define __NR_Linux 6000
-# define __NR_inotify_init (__NR_Linux + 247)
-# define __NR_inotify_add_watch (__NR_Linux + 248)
-# define __NR_inotify_rm_watch (__NR_Linux + 249)
-# endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
-#elif defined (__frv__)
-# define __NR_inotify_init 291
-# define __NR_inotify_add_watch 292
-# define __NR_inotify_rm_watch 293
-#elif defined (__parisc__)
-# define __NR_Linux 0
-# define __NR_inotify_init (__NR_Linux + 269)
-# define __NR_inotify_add_watch (__NR_Linux + 270)
-# define __NR_inotify_rm_watch (__NR_Linux + 271)
-#elif defined (__mc68000__)
-# define __NR_inotify_init 284
-# define __NR_inotify_add_watch 285
-# define __NR_inotify_rm_watch 286
-#else
-# error "Unsupported architecture!"
+# elif defined(__x86_64__)
+# define __NR_inotify_init 253
+# define __NR_inotify_add_watch 254
+# define __NR_inotify_rm_watch 255
+# elif (defined(__powerpc__) || defined(__powerpc64__))
+# define __NR_inotify_init 275
+# define __NR_inotify_add_watch 276
+# define __NR_inotify_rm_watch 277
+# elif defined (__ia64__)
+# define __NR_inotify_init 1277
+# define __NR_inotify_add_watch 1278
+# define __NR_inotify_rm_watch 1279
+# elif defined (__s390__)
+# define __NR_inotify_init 284
+# define __NR_inotify_add_watch 285
+# define __NR_inotify_rm_watch 286
+# elif defined (__alpha__)
+# define __NR_inotify_init 444
+# define __NR_inotify_add_watch 445
+# define __NR_inotify_rm_watch 446
+# elif defined (__sparc__) || defined (__sparc64__)
+# define __NR_inotify_init 151
+# define __NR_inotify_add_watch 152
+# define __NR_inotify_rm_watch 156
+# elif defined (__arm__)
+# define __NR_inotify_init 316
+# define __NR_inotify_add_watch 317
+# define __NR_inotify_rm_watch 318
+# elif defined (__sh__)
+# define __NR_inotify_init 290
+# define __NR_inotify_add_watch 291
+# define __NR_inotify_rm_watch 292
+# elif defined (__sh64__)
+# define __NR_inotify_init 318
+# define __NR_inotify_add_watch 319
+# define __NR_inotify_rm_watch 320
+# elif defined (__hppa__)
+# define __NR_inotify_init 269
+# define __NR_inotify_add_watch 270
+# define __NR_inotify_rm_watch 271
+# elif defined (__mips__)
+# define _MIPS_SIM_ABI32 1
+# define _MIPS_SIM_NABI32 2
+# define _MIPS_SIM_ABI64 3
+# if _MIPS_SIM == _MIPS_SIM_ABI32
+# define __NR_Linux 4000
+# define __NR_inotify_init (__NR_Linux + 284)
+# define __NR_inotify_add_watch (__NR_Linux + 285)
+# define __NR_inotify_rm_watch (__NR_Linux + 286)
+# endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
+# if _MIPS_SIM == _MIPS_SIM_ABI64
+# define __NR_Linux 5000
+# define __NR_inotify_init (__NR_Linux + 243)
+# define __NR_inotify_add_watch (__NR_Linux + 244)
+# define __NR_inotify_rm_watch (__NR_Linux + 245)
+# endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+# if _MIPS_SIM == _MIPS_SIM_NABI32
+# define __NR_Linux 6000
+# define __NR_inotify_init (__NR_Linux + 247)
+# define __NR_inotify_add_watch (__NR_Linux + 248)
+# define __NR_inotify_rm_watch (__NR_Linux + 249)
+# endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
+# elif defined (__frv__)
+# define __NR_inotify_init 291
+# define __NR_inotify_add_watch 292
+# define __NR_inotify_rm_watch 293
+# elif defined (__parisc__)
+# define __NR_Linux 0
+# define __NR_inotify_init (__NR_Linux + 269)
+# define __NR_inotify_add_watch (__NR_Linux + 270)
+# define __NR_inotify_rm_watch (__NR_Linux + 271)
+# elif defined (__mc68000__)
+# define __NR_inotify_init 284
+# define __NR_inotify_add_watch 285
+# define __NR_inotify_rm_watch 286
+# else
+# error "Unsupported architecture!"
+# endif
#endif