@@ -156,6 +156,9 @@ extern void __futex_unqueue(struct futex_q *q);
extern void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb);
extern int futex_unqueue(struct futex_q *q);
+extern int futex_queue_wait(struct futex_q *q, u32 __user *uaddr,
+ unsigned int flags, u32 val);
+
/**
* futex_queue() - Enqueue the futex_q on the futex_hash_bucket
* @q: The futex_q to enqueue
@@ -706,3 +706,20 @@ static long futex_wait_restart(struct restart_block *restart)
restart->futex.val, tp, restart->futex.bitset);
}
+int futex_queue_wait(struct futex_q *q, u32 __user *uaddr, unsigned int flags,
+ u32 val)
+{
+ struct futex_hash_bucket *hb;
+ int ret;
+
+ if (!q->bitset)
+ return -EINVAL;
+
+ ret = futex_wait_setup(uaddr, val, flags, q, &hb);
+ if (ret)
+ return ret;
+
+ __futex_queue(q, hb);
+ spin_unlock(&hb->lock);
+ return 0;
+}
For async trigger of the wait, we need to be able to pass in a futex_q that is already setup. Add that helper. Signed-off-by: Jens Axboe <axboe@kernel.dk> --- kernel/futex/futex.h | 3 +++ kernel/futex/waitwake.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+)