diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2008-03-20 17:03:55 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2008-03-20 17:03:55 +0000 |
commit | 4a8a8b1c08a86abdb5b449ae37987c1a26d9365f (patch) | |
tree | 5c5eb58afff7ee8d16ebe98859711284a23301f2 /sys/compat/linux/linux_futex.c | |
parent | 1906c8de600574d9fb77a2d5760a9f09bd2fe6d5 (diff) | |
download | FreeBSD-src-4a8a8b1c08a86abdb5b449ae37987c1a26d9365f.zip FreeBSD-src-4a8a8b1c08a86abdb5b449ae37987c1a26d9365f.tar.gz |
o Add stub support for some new futex operations,
so the annoying message is not printed.
o Don't warn about FUTEX_FD not being implemented
and return ENOSYS instead of 0 (eg. success).
o Clear FUTEX_PRIVATE_FLAG as we actually implement
only private futexes so there is no reason to
return ENOSYS when app asks for a private futex.
We don't reject shared futexes because they worked
just fine with our implementation so far.
Approved by: kib (mentor)
Tested by: bsam
MFC after: 1 week
Diffstat (limited to 'sys/compat/linux/linux_futex.c')
-rw-r--r-- | sys/compat/linux/linux_futex.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index be05206..f4423b4 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -118,6 +118,15 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) args->val, args->uaddr2, args->val3); #endif + /* + * Our implementation provides only privates futexes. Most of the apps + * should use private futexes but don't claim so. Therefore we treat + * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works + * in most cases (ie. when futexes are not shared on file descriptor + * or between different processes.). + */ + args->op = (args->op & ~LINUX_FUTEX_PRIVATE_FLAG); + switch (args->op) { case LINUX_FUTEX_WAIT: FUTEX_SYSTEM_LOCK; @@ -264,10 +273,11 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) break; case LINUX_FUTEX_FD: - /* XXX: Linux plans to remove this operation */ +#ifdef DEBUG printf("linux_sys_futex: unimplemented op %d\n", args->op); - break; +#endif + return (ENOSYS); case LINUX_FUTEX_WAKE_OP: FUTEX_SYSTEM_LOCK; @@ -324,6 +334,18 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) FUTEX_SYSTEM_UNLOCK; break; + case LINUX_FUTEX_LOCK_PI: + /* not yet implemented */ + return (ENOSYS); + + case LINUX_FUTEX_UNLOCK_PI: + /* not yet implemented */ + return (ENOSYS); + + case LINUX_FUTEX_TRYLOCK_PI: + /* not yet implemented */ + return (ENOSYS); + default: printf("linux_sys_futex: unknown op %d\n", args->op); |