From aa7492d20e5a2cef54dab7b41f534048b3eca479 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 26 Jul 2009 12:55:03 -0700 Subject: Compatibility of signalfd/eventfd with older kernels. --- sysdeps/unix/sysv/linux/signalfd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sysdeps/unix/sysv/linux/signalfd.c') diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c index 9898f29231..c2d974a45d 100644 --- a/sysdeps/unix/sysv/linux/signalfd.c +++ b/sysdeps/unix/sysv/linux/signalfd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,14 +20,21 @@ #include #include #include +#include int signalfd (int fd, const sigset_t *mask, int flags) { #ifdef __NR_signalfd4 - return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags); -#else + int res = INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags); +# ifndef __ASSUME_SIGNALFD4 + if (res != -1 || errno != ENOSYS) +# endif + return res; +#endif + +#ifndef __ASSUME_SIGNALFD4 /* The old system call has no flag parameter which is bad. So we have to wait until we have to support to pass additional values to the kernel (sys_indirect) before implementing setting flags like @@ -44,5 +51,7 @@ signalfd (int fd, const sigset_t *mask, int flags) __set_errno (ENOSYS); return -1; # endif +#elif !defined __NR_signalfd4 +# error "__ASSUME_SIGNALFD4 defined but not __NR_signalfd4" #endif } -- cgit 1.4.1