diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2008-05-13 20:01:27 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2008-05-13 20:01:27 +0000 |
commit | 13cbd9c97efdd801d6a355ae093c858dbcae9ea4 (patch) | |
tree | f230e0408b5364ef56a7bda21630cb827fe45bc8 /sys/compat/linux/linux_emul.c | |
parent | 8f4fa78ec6a09ea5742e967e8b84878ce0f685f3 (diff) | |
download | FreeBSD-src-13cbd9c97efdd801d6a355ae093c858dbcae9ea4.zip FreeBSD-src-13cbd9c97efdd801d6a355ae093c858dbcae9ea4.tar.gz |
Implement robust futexes. Most of the code is modelled after
what Linux does. This is because robust futexes are mostly
userspace thing which we cannot alter. Two syscalls maintain
pointer to userspace list and when process exits a routine
walks this list waking up processes sleeping on futexes
from that list.
Reviewed by: kib (mentor)
MFC after: 1 month
Diffstat (limited to 'sys/compat/linux/linux_emul.c')
-rw-r--r-- | sys/compat/linux/linux_emul.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index 1a0d5a3..16e6033 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -44,9 +44,6 @@ __FBSDID("$FreeBSD$"); #include <sys/sysproto.h> #include <sys/unistd.h> -#include <compat/linux/linux_emul.h> -#include <compat/linux/linux_futex.h> - #ifdef COMPAT_LINUX32 #include <machine/../linux32/linux.h> #include <machine/../linux32/linux32_proto.h> @@ -55,6 +52,9 @@ __FBSDID("$FreeBSD$"); #include <machine/../linux/linux_proto.h> #endif +#include <compat/linux/linux_emul.h> +#include <compat/linux/linux_futex.h> + struct sx emul_shared_lock; struct mtx emul_lock; @@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t child, int flags) em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); em->pid = child; em->pdeath_signal = 0; + em->robust_futexes = NULL; if (flags & LINUX_CLONE_THREAD) { /* handled later in the code */ } else { @@ -161,6 +162,8 @@ linux_proc_exit(void *arg __unused, struct proc *p) if (__predict_true(p->p_sysent != &elf_linux_sysvec)) return; + release_futexes(p); + /* find the emuldata */ em = em_find(p, EMUL_DOLOCK); |