git: 3780c6b81909 - stable/13 - linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Jun 2022 19:37:06 UTC
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3780c6b81909f1e6a98b9652df0c9c2c20d82fd6 commit 3780c6b81909f1e6a98b9652df0c9c2c20d82fd6 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-07-20 11:38:05 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:33:11 +0000 linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake(). MFC after: 2 weeks (cherry picked from commit 19f7e2c2fb443c1964dcfbd19ca01e2ba37a8c50) --- sys/compat/linux/linux_futex.c | 34 ++++++++++++++++++++++------------ 1 file 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, @@ -933,6 +923,26 @@ retry2: return (error); } +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) {