aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2009-04-19 13:48:42 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2009-04-19 13:48:42 +0000
commitb1121623d27b2f0011259f3a391bc900ffb70765 (patch)
tree5498ad96bf52e436830d5b5c228df2151231f121 /sys/compat
parentbb1c7df80f24ca50cc78e206277dbca35b69d5cb (diff)
Notes
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_emul.c1
-rw-r--r--sys/compat/linux/linux_emul.h1
-rw-r--r--sys/compat/linux/linux_futex.c31
3 files changed, 20 insertions, 13 deletions
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c
index 1ca48a3649e1..dc81553c60a9 100644
--- a/sys/compat/linux/linux_emul.c
+++ b/sys/compat/linux/linux_emul.c
@@ -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->used_requeue = 0;
em->robust_futexes = NULL;
if (flags & LINUX_CLONE_THREAD) {
/* handled later in the code */
diff --git a/sys/compat/linux/linux_emul.h b/sys/compat/linux/linux_emul.h
index 2c1b3cac2e3c..8ce27d79136c 100644
--- a/sys/compat/linux/linux_emul.h
+++ b/sys/compat/linux/linux_emul.h
@@ -51,6 +51,7 @@ struct linux_emuldata {
struct linux_emuldata_shared *shared;
int pdeath_signal; /* parent death signal */
+ int used_requeue; /* uses deprecated futex op */
struct linux_robust_list_head *robust_futexes;
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index e1d214f4a4a5..84ec36a564a0 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -114,6 +114,7 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
struct timeval tv = {0, 0};
struct futex *f2;
int op_ret;
+ struct linux_emuldata *em;
#ifdef DEBUG
if (ldebug(sys_futex))
@@ -262,19 +263,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
FUTEX_SYSTEM_UNLOCK;
break;
- case LINUX_FUTEX_REQUEUE:
- FUTEX_SYSTEM_LOCK;
-
- f = futex_get(args->uaddr, FUTEX_UNLOCKED);
- newf = futex_get(args->uaddr2, FUTEX_UNLOCKED);
- td->td_retval[0] = futex_wake(f, args->val, newf,
- (int)(unsigned long)args->timeout);
- futex_put(f);
- futex_put(newf);
-
- FUTEX_SYSTEM_UNLOCK;
- break;
-
case LINUX_FUTEX_WAKE_OP:
FUTEX_SYSTEM_LOCK;
#ifdef DEBUG
@@ -342,6 +330,23 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
/* not yet implemented */
return (ENOSYS);
+ case LINUX_FUTEX_REQUEUE:
+
+ /*
+ * Glibc does not use this operation since Jun 2004 (2.3.3),
+ * as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
+ * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
+ * FUTEX_REQUEUE returned EINVAL.
+ */
+ em = em_find(td->td_proc, EMUL_DONTLOCK);
+ if (em->used_requeue == 0) {
+ printf("linux(%s (%d)) sys_futex: "
+ "unsupported futex_requeue op\n",
+ td->td_proc->p_comm, td->td_proc->p_pid);
+ em->used_requeue = 1;
+ }
+ return (EINVAL);
+
default:
printf("linux_sys_futex: unknown op %d\n",
args->op);