git: 19f7e2c2fb44 - main - linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake().

Dmitry Chagin dchagin at FreeBSD.org
Tue Jul 20 11:40:57 UTC 2021


The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=19f7e2c2fb443c1964dcfbd19ca01e2ba37a8c50

commit 19f7e2c2fb443c1964dcfbd19ca01e2ba37a8c50
Author:     Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-07-20 11:38:05 +0000
Commit:     Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-07-20 11:38:05 +0000

    linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake().
    
    MFC after:              2 weeks
---
 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)
 {


More information about the dev-commits-src-all mailing list