1io_uring_prep_cancel(3)         liburing Manual        io_uring_prep_cancel(3)
2
3
4

NAME

6       io_uring_prep_cancel - prepare a cancelation request
7

SYNOPSIS

9       #include <liburing.h>
10
11       void io_uring_prep_cancel64(struct io_uring_sqe *sqe,
12                                   __u64 user_data,
13                                   int flags);
14
15       void io_uring_prep_cancel(struct io_uring_sqe *sqe,
16                                 void *user_data,
17                                 int flags);
18
19       void io_uring_prep_cancel_fd(struct io_uring_sqe *sqe,
20                                 int fd,
21                                 int flags);
22

DESCRIPTION

24       The  io_uring_prep_cancel(3)  function  prepares a cancelation request.
25       The submission queue entry sqe is prepared to cancel  an  existing  re‐
26       quest identified by user_data.  For the flags argument, see below.
27
28       io_uring_prep_cancel64(3)  is identical to io_uring_prep_cancel(3), ex‐
29       cept it takes a 64-bit integer rather than a pointer type.
30
31       The cancelation request will attempt to find the previously issued  re‐
32       quest identified by user_data and cancel it. The identifier is what the
33       previously issued request has in their user_data field in the SQE.
34
35       The io_uring_prep_cancel_fd(3) function prepares a cancelation request.
36       The  submission  queue  entry sqe is prepared to cancel an existing re‐
37       quest that used the file descriptor fd.  For the  flags  argument,  see
38       below.
39
40       The  cancelation request will attempt to find the previously issued re‐
41       quest that used fd as the file descriptor and cancel it.
42
43       By default, the first request matching the criteria given will be  can‐
44       celed.  This can be modified with any of the following flags passed in:
45
46       IORING_ASYNC_CANCEL_ALL
47              Cancel  all  requests that match the given criteria, rather than
48              just canceling the first one found. Available since 5.19.
49
50       IORING_ASYNC_CANCEL_FD
51              Match based on the file descriptor used in the original  request
52              rather  than  the  user_data.  This  is  what io_uring_prep_can‐
53              cel_fd(3) sets up. Available since 5.19.
54
55       IORING_ASYNC_CANCEL_FD_FIXED
56              Set in conjunction with IORING_ASYNC_CANCEL_FD , indicating that
57              the  file  descriptor given is a direct descriptor rather than a
58              normal file descriptor. Available since 6.0.
59
60       IORING_ASYNC_CANCEL_ANY
61              Match any request in the ring, regardless of user_data  or  file
62              descriptor.   Can  be  used to cancel any pending request in the
63              ring. Available since 5.19.
64

RETURN VALUE

66       None
67

ERRORS

69       These are the errors that are reported in the  CQE  res  field.  If  no
70       flags  are  used to cancel multiple requests, 0 is returned on success.
71       If flags are used to match multiple requests, then a positive value  is
72       returned indicating how many requests were found and canceled.
73
74       -ENOENT
75              The  request  identified by user_data could not be located. This
76              could be because it completed before the cancelation request was
77              issued, or if an invalid identifier is used.
78
79       -EINVAL
80              One of the fields set in the SQE was invalid.
81
82       -EALREADY
83              The  execution  state  of  the request has progressed far enough
84              that cancelation is no longer  possible.  This  should  normally
85              mean  that it will complete shortly, either successfully, or in‐
86              terrupted due to the cancelation.
87

NOTES

89       Although the cancelation request uses async request syntax, the  kernel
90       side  of  the cancelation is always run synchronously. It is guaranteed
91       that a CQE is always generated by the time the cancel request has  been
92       submitted. If the cancelation is successful, the completion for the re‐
93       quest targeted for cancelation will have been posted by the  time  sub‐
94       mission  returns. For -EALREADY it may take a bit of time to do so. For
95       this case, the caller must wait for the canceled request  to  post  its
96       completion event.
97

SEE ALSO

99       io_uring_prep_poll_remove(3), io_uring_get_sqe(3), io_uring_submit(3)
100
101
102
103liburing-2.2                    March 12, 2022         io_uring_prep_cancel(3)
Impressum