Date: Fri, 17 Jun 2022 19:37:13 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e6a169af5c09 - stable/13 - linux(4): Factor out the futex_wait() op into linux_futex_wait(). Message-ID: <202206171937.25HJbDWT013057@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=e6a169af5c09ebb1671adc99017d5c0f8e3dbe43 commit e6a169af5c09ebb1671adc99017d5c0f8e3dbe43 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-07-20 11:40:24 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:33:13 +0000 linux(4): Factor out the futex_wait() op into linux_futex_wait(). MFC after: 2 weeks (cherry picked from commit 75cb2382b84d2a7c385e98a18da209236701494e) --- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171937.25HJbDWT013057>