git: 75cb2382b84d - main - linux(4): Factor out the futex_wait() op into linux_futex_wait().
Dmitry Chagin
dchagin at FreeBSD.org
Tue Jul 20 11:41:04 UTC 2021
The branch main has been updated by dchagin:
URL: https://cgit.FreeBSD.org/src/commit/?id=75cb2382b84d2a7c385e98a18da209236701494e
commit 75cb2382b84d2a7c385e98a18da209236701494e
Author: Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-07-20 11:40:24 +0000
Commit: Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-07-20 11:40:24 +0000
linux(4): Factor out the futex_wait() op into linux_futex_wait().
MFC after: 2 weeks
---
sys/compat/linux/linux_futex.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index a32542b16a8a..1858c573a576 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -215,8 +215,6 @@ static int futex_get(uint32_t *, struct waiting_proc **, struct futex **,
static int futex_sleep(struct futex *, struct waiting_proc *, struct timespec *);
static int futex_wake(struct futex *, int, uint32_t);
static int futex_requeue(struct futex *, int, struct futex *, int);
-static int futex_wait(struct futex *, struct waiting_proc *, struct timespec *,
- uint32_t);
static void futex_lock(struct futex *);
static void futex_unlock(struct futex *);
static int futex_atomic_op(struct thread *, int, uint32_t *);
@@ -554,27 +552,6 @@ futex_requeue(struct futex *f, int nrwake, struct futex *f2,
return (count);
}
-static int
-futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts,
- uint32_t bitset)
-{
- int error;
-
- if (bitset == 0) {
- futex_put(f, wp);
- return (EINVAL);
- }
-
- f->f_bitset = bitset;
- error = futex_sleep(f, wp, ts);
- if (error)
- LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error);
- if (error == EWOULDBLOCK)
- error = ETIMEDOUT;
-
- return (error);
-}
-
static int
futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
{
@@ -1015,7 +992,18 @@ retry:
return (EWOULDBLOCK);
}
- return (futex_wait(f, wp, args->ts, args->val3));
+ if (args->val3 == 0) {
+ futex_put(f, wp);
+ return (EINVAL);
+ }
+
+ f->f_bitset = args->val3;
+ error = futex_sleep(f, wp, args->ts);
+ if (error != 0)
+ LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error);
+ if (error == EWOULDBLOCK)
+ error = ETIMEDOUT;
+ return (error);
}
int
More information about the dev-commits-src-all
mailing list