Commit 8ca61733 by Michael K. Johnson Committed by Daniel Lezcano

define signalfd patch

If sys/signalfd.h does not exist, assume that it does not exist in glibc, rather than that it exists without a corresponding header file. Note that this version of the signalfd() wrapper function (unlike the version in glibc) falls back dynamically to the old signalfd system call if the signalfd4 system call is not implemented in the currently-running kernel; the version in glibc chooses the version of the signalfd system call to make via static build-time configuration. Signed-off-by: 's avatarMichael K Johnson <johnsonm@rpath.com> Signed-off-by: 's avatarDaniel Lezcnao <dlezcano@fr.ibm.com>
parent 216061bf
...@@ -43,9 +43,35 @@ ...@@ -43,9 +43,35 @@
#include <sys/poll.h> #include <sys/poll.h>
#ifdef HAVE_SYS_SIGNALFD_H #ifdef HAVE_SYS_SIGNALFD_H
#include <sys/signalfd.h> # include <sys/signalfd.h>
#else #else
extern int signalfd (int fd, const sigset_t *mask, int flags); # ifndef __NR_signalfd4
/* assume kernel headers are too old */
# if __i386__
# define __NR_signalfd4 327
# elif __x86_64__
# define __NR_signalfd4 289
# endif
#endif
# ifndef __NR_signalfd
/* assume kernel headers are too old */
# if __i386__
# define __NR_signalfd 321
# elif __x86_64__
# define __NR_signalfd 282
# endif
#endif
int signalfd(int fd, const sigset_t *mask, int flags)
{
int retval;
retval = syscall (__NR_signalfd4, fd, mask, _NSIG / 8, flags);
if (errno == ENOSYS && flags == 0)
retval = syscall (__NR_signalfd, fd, mask, _NSIG / 8);
return retval;
}
#endif #endif
#if !HAVE_DECL_PR_CAPBSET_DROP #if !HAVE_DECL_PR_CAPBSET_DROP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment