aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-09-29 06:04:03 -0600
committerJens Axboe <axboe@kernel.dk>2023-10-18 08:53:31 -0600
commitceb4ff6f3d670cea6b665b0347d6a10544ccb73f (patch)
tree6c91ed5e34a1d7bb91d6a4a0142686e853c7a342
parentea4e46022a409587b8f5f671aab3cbd823c5bd10 (diff)
downloadliburing-waitid.tar.gz
waitid: add io_uring flags parameterwaitid
Let's future proof this a bit and have the flags exposed, so that this prep helper will remain constant if we do decide to add some flags at a later time. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--man/io_uring_prep_waitid.37
-rw-r--r--src/include/liburing.h3
-rw-r--r--test/waitid.c12
3 files changed, 14 insertions, 8 deletions
diff --git a/man/io_uring_prep_waitid.3 b/man/io_uring_prep_waitid.3
index 011f2c9f..34e5abdd 100644
--- a/man/io_uring_prep_waitid.3
+++ b/man/io_uring_prep_waitid.3
@@ -14,7 +14,8 @@ io_uring_prep_waitid \- prepare a waitid request
.BI " idtype_t " idtype ","
.BI " id_t " id ","
.BI " siginfo_t *" infop ","
-.BI " int " options ");"
+.BI " int " options ","
+.BI " unsigned int " flags ");"
.fi
.SH DESCRIPTION
.PP
@@ -32,6 +33,10 @@ to specify the child state changes to wait for. Upon successful
return, it fills
.I infop
with information of the child process, if any.
+.I flags
+is io_uring specific modifier flags. They are currently unused, and hence
+.B 0
+should be passed.
This function prepares an async
.BR waitid (2)
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 2d136885..f5c2d463 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1166,9 +1166,10 @@ IOURINGINLINE void io_uring_prep_waitid(struct io_uring_sqe *sqe,
idtype_t idtype,
id_t id,
siginfo_t *infop,
- int options)
+ int options, unsigned int flags)
{
io_uring_prep_rw(IORING_OP_WAITID, sqe, id, NULL, (unsigned) idtype, 0);
+ sqe->waitid_flags = flags;
sqe->file_index = options;
sqe->addr2 = (unsigned long) infop;
}
diff --git a/test/waitid.c b/test/waitid.c
index d2222e64..6666170c 100644
--- a/test/waitid.c
+++ b/test/waitid.c
@@ -38,7 +38,7 @@ static int test_noexit(struct io_uring *ring)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED);
+ io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED, 0);
sqe->flags |= IOSQE_IO_LINK;
sqe->user_data = 1;
@@ -96,7 +96,7 @@ static int test_double(struct io_uring *ring)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_PID, p2, &si, WEXITED);
+ io_uring_prep_waitid(sqe, P_PID, p2, &si, WEXITED, 0);
io_uring_submit(ring);
@@ -137,7 +137,7 @@ static int test_ready(struct io_uring *ring)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED);
+ io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED, 0);
io_uring_submit(ring);
@@ -177,7 +177,7 @@ static int test_cancel(struct io_uring *ring)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_PID, pid, NULL, WEXITED);
+ io_uring_prep_waitid(sqe, P_PID, pid, NULL, WEXITED, 0);
sqe->user_data = 1;
io_uring_submit(ring);
@@ -228,7 +228,7 @@ static int test_cancel_race(struct io_uring *ring, int async)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_ALL, -1, NULL, WEXITED);
+ io_uring_prep_waitid(sqe, P_ALL, -1, NULL, WEXITED, 0);
if (async)
sqe->flags |= IOSQE_ASYNC;
sqe->user_data = 1;
@@ -284,7 +284,7 @@ static int test(struct io_uring *ring)
}
sqe = io_uring_get_sqe(ring);
- io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED);
+ io_uring_prep_waitid(sqe, P_PID, pid, &si, WEXITED, 0);
io_uring_submit(ring);