]> www.infradead.org Git - users/jedix/linux-maple.git/commit
wait: add waitfd(), and a testcase for it
authorNick Alcock <nick.alcock@oracle.com>
Tue, 4 Jun 2013 15:52:46 +0000 (16:52 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jun 2015 21:41:45 +0000 (22:41 +0100)
commit95293bb2e56cba1a49fcfa02554e9669661fd60a
tree9ba91de92d60848f461862015c81a4bd3f27dcd0
parent01bf9f76c48cfa75d1c436c8a1b1acca8869d7e2
wait: add waitfd(), and a testcase for it

This syscall, of prototype

    int waitfd(int which, pid_t upid, int options, int flags);

yields a pollable file descriptor which yields a 'struct siginfo_t' whenever
waitid() or waitpid() would return (when child processes die or ptrace()d
tracees undergo an appropriate state change).

The which, upid and options arguments are as to waitid(); the flags argument is
fd flags as to open() or fcntl(F_SETFL), to which O_RDWR is automatically added.
WNOHANG in the options is automatically translated into O_NONBLOCK in the flags,
and vice versa.

No compat wrappers are in place for this syscall: 32-bit calls with a 64-bit
kernel will return a 64-bit version of 'struct siginfo'.

Current bugs:
  - select/poll/epoll is not waking up the process yet, even when it should.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
arch/x86/syscalls/syscall_32.tbl
arch/x86/syscalls/syscall_64.tbl
fs/Makefile
fs/waitfd.c [new file with mode: 0644]
init/Kconfig
kernel/dtrace/Kconfig
kernel/exit.c
kernel/sys_ni.c
tools/testing/selftests/waitfd/Makefile [new file with mode: 0644]
tools/testing/selftests/waitfd/waitfd.c [new file with mode: 0644]