aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2021-07-20 11:38:05 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2021-07-20 11:38:05 +0000
commit19f7e2c2fb443c1964dcfbd19ca01e2ba37a8c50 (patch)
tree9e5420eb1b9bbc9baa1075c49a022fabe775b817 /sys
parentf6b0d275eb9eb89b9719ca835b34116257f6a236 (diff)
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_futex.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index 15357e75c8af..04f767b8aed0 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -239,6 +239,7 @@ struct linux_futex_args {
static int linux_futex(struct thread *, struct linux_futex_args *);
static int linux_futex_wait(struct thread *, struct linux_futex_args *);
+static int linux_futex_wake(struct thread *, struct linux_futex_args *);
static void
futex_put(struct futex *f, struct waiting_proc *wp)
@@ -697,18 +698,7 @@ linux_futex(struct thread *td, struct linux_futex_args *args)
LINUX_CTR3(sys_futex, "WAKE uaddr %p nrwake 0x%x bitset 0x%x",
args->uaddr, args->val, args->val3);
- error = futex_get(args->uaddr, NULL, &f,
- args->flags | FUTEX_DONTCREATE);
- if (error)
- return (error);
-
- if (f == NULL) {
- td->td_retval[0] = 0;
- return (error);
- }
- td->td_retval[0] = futex_wake(f, args->val, args->val3);
- futex_put(f, NULL);
- break;
+ return (linux_futex_wake(td, args));
case LINUX_FUTEX_CMP_REQUEUE:
LIN_SDT_PROBE5(futex, linux_futex, debug_cmp_requeue,
@@ -934,6 +924,26 @@ retry2:
}
static int
+linux_futex_wake(struct thread *td, struct linux_futex_args *args)
+{
+ struct futex *f;
+ int error;
+
+ f = NULL;
+ error = futex_get(args->uaddr, NULL, &f, args->flags | FUTEX_DONTCREATE);
+ if (error != 0)
+ return (error);
+
+ if (f == NULL) {
+ td->td_retval[0] = 0;
+ return (error);
+ }
+ td->td_retval[0] = futex_wake(f, args->val, args->val3);
+ futex_put(f, NULL);
+ return (0);
+}
+
+static int
linux_futex_wait(struct thread *td, struct linux_futex_args *args)
{
struct waiting_proc *wp;