aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2008-03-20 17:03:55 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2008-03-20 17:03:55 +0000
commit6af821237d01a1bf10d76961ea1877f897527a87 (patch)
tree5c5eb58afff7ee8d16ebe98859711284a23301f2
parent43b1161d4d865e4cab9848ac3617bc84da4194d8 (diff)
downloadsrc-6af821237d01a1bf10d76961ea1877f897527a87.tar.gz
src-6af821237d01a1bf10d76961ea1877f897527a87.zip
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
Notes
Notes: svn path=/head/; revision=177460
-rw-r--r--sys/compat/linux/linux_futex.c26
-rw-r--r--sys/compat/linux/linux_futex.h5
2 files changed, 29 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index be052069f1d6..f4423b4546ff 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);
diff --git a/sys/compat/linux/linux_futex.h b/sys/compat/linux/linux_futex.h
index 1ba1ce2d5169..3ca6f3bfff99 100644
--- a/sys/compat/linux/linux_futex.h
+++ b/sys/compat/linux/linux_futex.h
@@ -42,6 +42,11 @@
#define LINUX_FUTEX_REQUEUE 3
#define LINUX_FUTEX_CMP_REQUEUE 4
#define LINUX_FUTEX_WAKE_OP 5
+#define LINUX_FUTEX_LOCK_PI 6
+#define LINUX_FUTEX_UNLOCK_PI 7
+#define LINUX_FUTEX_TRYLOCK_PI 8
+
+#define LINUX_FUTEX_PRIVATE_FLAG 128
#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */