2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2015, Joyent, Inc.
16 #include <sys/signalfd.h>
23 signalfd(int fd
, const sigset_t
*mask
, int flags
)
28 int oflags
= O_RDONLY
;
30 if (flags
& ~(SFD_NONBLOCK
| SFD_CLOEXEC
)) {
35 if (flags
& SFD_NONBLOCK
)
38 if (flags
& SFD_CLOEXEC
)
41 if ((fd
= open("/dev/signalfd", oflags
)) < 0)
45 if (ioctl(fd
, SIGNALFDIOC_MASK
, mask
) != 0) {
52 * Trying to modify an existing sigfd so if this failed
53 * it's because it's not a valid fd or not a sigfd. ioctl
54 * returns the correct errno for these cases.