[Midnightbsd-cvs] src: linux_futex.c: o Add stub support for some new futex operations,
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 1 14:21:38 EST 2009
Log Message:
-----------
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.
Obtained from freebsd, rdivacky
Modified Files:
--------------
src/sys/compat/linux:
linux_futex.c (r1.3 -> r1.4)
-------------- next part --------------
Index: linux_futex.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_futex.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/compat/linux/linux_futex.c -L sys/compat/linux/linux_futex.c -u -r1.3 -r1.4
--- sys/compat/linux/linux_futex.c
+++ sys/compat/linux/linux_futex.c
@@ -119,6 +119,15 @@
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;
@@ -265,10 +274,11 @@
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;
@@ -325,6 +335,18 @@
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);
More information about the Midnightbsd-cvs
mailing list