X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Flinux%2Fsignalfd.c;h=4bf43326fe5a7ee55858e728cf5bcff07bb64667;hb=eb2e298cdc814493a6ced8c05cf0d0f5cccc8b63;hp=94de36278bea1f6385325a2812ea657fc3a158d9;hpb=ccc7b4c3a17ade90de71e1e0f44deebbffd646e6;p=musl diff --git a/src/linux/signalfd.c b/src/linux/signalfd.c index 94de3627..4bf43326 100644 --- a/src/linux/signalfd.c +++ b/src/linux/signalfd.c @@ -1,8 +1,21 @@ #include #include +#include +#include #include "syscall.h" int signalfd(int fd, const sigset_t *sigs, int flags) { - return syscall(SYS_signalfd, fd, sigs, _NSIG/8); + int ret = __syscall(SYS_signalfd4, fd, sigs, _NSIG/8, flags); +#ifdef SYS_signalfd + if (ret != -ENOSYS) return __syscall_ret(ret); + ret = __syscall(SYS_signalfd, fd, sigs, _NSIG/8); + if (ret >= 0) { + if (flags & SFD_CLOEXEC) + __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC); + if (flags & SFD_NONBLOCK) + __syscall(SYS_fcntl, ret, F_SETFL, O_NONBLOCK); + } +#endif + return __syscall_ret(ret); }