zig/lib/libc/musl/src/linux/signalfd.c
Andrew Kelley 49d1a4c562 move lib dirs to lib subdir
also start prefering NtDll API. so far:
 * NtQueryInformationFile
 * NtClose

adds a performance workaround for windows unicode conversion. but that
should probably be removed before merging
2019-07-15 17:54:50 -04:00

21 lines
558 B
C
Vendored

#include <sys/signalfd.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include "syscall.h"
int signalfd(int fd, const sigset_t *sigs, int flags)
{
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);
}