Add futex(2) syscall based on a sane subset of its Linux equivalent.
authormpi <mpi@openbsd.org>
Fri, 28 Apr 2017 13:50:54 +0000 (13:50 +0000)
committermpi <mpi@openbsd.org>
Fri, 28 Apr 2017 13:50:54 +0000 (13:50 +0000)
commit004d4497806b353140df0424d766c0d83fcf31de
treec435a3ed71014f062a8c28efd485fb376d799910
parent851b0b64fe36ca9d52fdca25fc450b1e98904389
Add futex(2) syscall based on a sane subset of its Linux equivalent.

The syscall is marked NOLOCK and only FUTEX_WAIT grabs the KERNEL_LOCK()
because of PCATCH and the signal nightmare.

Serialization of threads is currently done with a global & exclusive
rwlock.

Note that the current implementation still use copyin(9) which is not
guaranteed to be atomic.  Committing now such that remaining issues can
be addressed in-tree.

With inputs from guenther@, kettenis@ and visa@.

ok deraadt@, visa@
sys/conf/files
sys/kern/init_main.c
sys/kern/kern_pledge.c
sys/kern/sys_futex.c [new file with mode: 0644]
sys/kern/syscalls.master
sys/sys/futex.h [new file with mode: 0644]
sys/sys/proc.h