-
Notifications
You must be signed in to change notification settings - Fork 417
/
Copy pathio_uring_enter.2
2071 lines (1948 loc) · 55.3 KB
/
io_uring_enter.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" Copyright (C) 2019 Jens Axboe <[email protected]>
.\" Copyright (C) 2019 Red Hat, Inc.
.\"
.\" SPDX-License-Identifier: LGPL-2.0-or-later
.\"
.TH io_uring_enter 2 2019-01-22 "Linux" "Linux Programmer's Manual"
.SH NAME
io_uring_enter \- initiate and/or complete asynchronous I/O
.SH SYNOPSIS
.nf
.BR "#include <liburing.h>"
.PP
.BI "int io_uring_enter(unsigned int " fd ", unsigned int " to_submit ,
.BI " unsigned int " min_complete ", unsigned int " flags ,
.BI " sigset_t *" sig );
.PP
.BI "int io_uring_enter2(unsigned int " fd ", unsigned int " to_submit ,
.BI " unsigned int " min_complete ", unsigned int " flags ,
.BI " sigset_t *" sig ", size_t " sz );
.fi
.PP
.SH DESCRIPTION
.PP
.BR io_uring_enter (2)
is used to initiate and complete I/O using the shared submission and
completion queues setup by a call to
.BR io_uring_setup (2).
A single call can both submit new I/O and wait for completions of I/O
initiated by this call or previous calls to
.BR io_uring_enter (2).
.I fd
is the file descriptor returned by
.BR io_uring_setup (2).
.I to_submit
specifies the number of I/Os to submit from the submission queue.
.I flags
is a bitmask of the following values:
.TP
.B IORING_ENTER_GETEVENTS
If this flag is set, then the system call will wait for the specified
number of events in
.I min_complete
before returning. This flag can be set along with
.I to_submit
to both submit and complete events in a single system call.
If this flag is set either the flag
.B IORING_SETUP_DEFER_TASKRUN
must not be set or the thread issuing the syscall must be the thread that
created the io_uring associated with
.I fd,
or be the thread that enabled the ring originally created with
.B IORING_SETUP_R_DISABLED
via
.BR io_uring_register (2)
or
.BR io_uring_enable_rings (3).
.TP
.B IORING_ENTER_SQ_WAKEUP
If the ring has been created with
.B IORING_SETUP_SQPOLL,
then this flag asks the kernel to wakeup the SQ kernel thread to submit IO.
.TP
.B IORING_ENTER_SQ_WAIT
If the ring has been created with
.B IORING_SETUP_SQPOLL,
then the application has no real insight into when the SQ kernel thread has
consumed entries from the SQ ring. This can lead to a situation where the
application can no longer get a free SQE entry to submit, without knowing
when one will become available as the SQ kernel thread consumes them. If
the system call is used with this flag set, then it will wait until at least
one entry is free in the SQ ring.
.TP
.B IORING_ENTER_EXT_ARG
Since kernel 5.11, the system calls arguments have been modified to look like
the following:
.nf
.BI "int io_uring_enter2(unsigned int " fd ", unsigned int " to_submit ,
.BI " unsigned int " min_complete ", unsigned int " flags ,
.BI " const void *" arg ", size_t " argsz );
.fi
which behaves just like the original definition by default. However, if
.B IORING_ENTER_EXT_ARG
is set, then instead of a
.I sigset_t
being passed in, a pointer to a
.I struct io_uring_getevents_arg
is used instead and
.I argsz
must be set to the size of this structure. The definition is as follows:
.nf
.BI "struct io_uring_getevents_arg {
.BI " __u64 sigmask;
.BI " __u32 sigmask_sz;
.BI " __u32 pad;
.BI " __u64 ts;
.BI "};
.fi
which allows passing in both a signal mask as well as pointer to a
.I struct __kernel_timespec
timeout value. If
.I ts
is set to a valid pointer, then this time value indicates the timeout for
waiting on events. If an application is waiting on events and wishes to
stop waiting after a specified amount of time, then this can be accomplished
directly in version 5.11 and newer by using this feature.
.TP
.B IORING_ENTER_REGISTERED_RING
If the ring file descriptor has been registered through use of
.BR IORING_REGISTER_RING_FDS ,
then setting this flag will tell the kernel that the
.I ring_fd
passed in is the registered ring offset rather than a normal file descriptor.
.TP
.B IORING_ENTER_ABS_TIMER
When this flag is set, the timeout argument passed in
.I struct io_uring_getevents_arg
will be interpreted as an absolute
time of the registered clock (see
.BR IORING_REGISTER_CLOCK)
until which the waiting should end.
Available since 6.12
.TP
.B IORING_ENTER_EXT_ARG_REG
When this flag is set,
.IR arg
is not a pointer to a
.IR struct io_uring_getevents_arg ,
but merely an offset into an area of wait regions previously registered with
.BR io_uring_register (2)
using the
.B IORING_REGISTER_CQWAIT_REG
operation. Available since 6.12
.PP
.PP
If the io_uring instance was configured for polling, by specifying
.B IORING_SETUP_IOPOLL
in the call to
.BR io_uring_setup (2),
then min_complete has a slightly different meaning. Passing a value
of 0 instructs the kernel to return any events which are already complete,
without blocking. If
.I min_complete
is a non-zero value, the kernel will still return immediately if any
completion events are available. If no event completions are
available, then the call will poll either until one or more
completions become available, or until the process has exceeded its
scheduler time slice.
Note that, for interrupt driven I/O (where
.B IORING_SETUP_IOPOLL
was not specified in the call to
.BR io_uring_setup (2)),
an application may check the completion queue for event completions
without entering the kernel at all.
.PP
When the system call returns that a certain amount of SQEs have been
consumed and submitted, it's safe to reuse SQE entries in the ring. This is
true even if the actual IO submission had to be punted to async context,
which means that the SQE may in fact not have been submitted yet. If the
kernel requires later use of a particular SQE entry, it will have made a
private copy of it.
.I sig
is a pointer to a signal mask (see
.BR sigprocmask (2));
if
.I sig
is not NULL,
.BR io_uring_enter (2)
first replaces the current signal mask by the one pointed to by
.IR sig ,
then waits for events to become available in the completion queue, and
then restores the original signal mask. The following
.BR io_uring_enter (2)
call:
.PP
.in +4n
.EX
ret = io_uring_enter(fd, 0, 1, IORING_ENTER_GETEVENTS, &sig);
.EE
.in
.PP
is equivalent to
.I atomically
executing the following calls:
.PP
.in +4n
.EX
pthread_sigmask(SIG_SETMASK, &sig, &orig);
ret = io_uring_enter(fd, 0, 1, IORING_ENTER_GETEVENTS, NULL);
pthread_sigmask(SIG_SETMASK, &orig, NULL);
.EE
.in
.PP
See the description of
.BR pselect (2)
for an explanation of why the
.I sig
parameter is necessary.
Submission queue entries are represented using the following data
structure:
.PP
.in +4n
.EX
/*
* IO submission data structure (Submission Queue Entry)
*/
struct io_uring_sqe {
__u8 opcode; /* type of operation for this sqe */
__u8 flags; /* IOSQE_ flags */
__u16 ioprio; /* ioprio for the request */
__s32 fd; /* file descriptor to do IO on */
union {
__u64 off; /* offset into file */
__u64 addr2;
struct {
__u32 cmd_op;
__u32 __pad1;
};
};
union {
__u64 addr; /* pointer to buffer or iovecs */
__u64 splice_off_in;
struct {
__u32 level;
__u32 optname;
};
};
__u32 len; /* buffer size or number of iovecs */
union {
__kernel_rwf_t rw_flags;
__u32 fsync_flags;
__u16 poll_events; /* compatibility */
__u32 poll32_events; /* word-reversed for BE */
__u32 sync_range_flags;
__u32 msg_flags;
__u32 timeout_flags;
__u32 accept_flags;
__u32 cancel_flags;
__u32 open_flags;
__u32 statx_flags;
__u32 fadvise_advice;
__u32 splice_flags;
__u32 rename_flags;
__u32 unlink_flags;
__u32 hardlink_flags;
__u32 xattr_flags;
__u32 msg_ring_flags;
__u32 uring_cmd_flags;
__u32 waitid_flags;
__u32 futex_flags;
__u32 install_fd_flags;
__u32 nop_flags;
};
__u64 user_data; /* data to be passed back at completion time */
/* pack this to avoid bogus arm OABI complaints */
union {
/* index into fixed buffers, if used */
__u16 buf_index;
/* for grouped buffer selection */
__u16 buf_group;
} __attribute__((packed));
/* personality to use, if used */
__u16 personality;
union {
__s32 splice_fd_in;
__u32 file_index;
__u32 optlen;
struct {
__u16 addr_len;
__u16 __pad3[1];
};
};
union {
struct {
__u64 addr3;
__u64 __pad2[1];
};
__u64 optval;
/*
* If the ring is initialized with IORING_SETUP_SQE128, then
* this field is used for 80 bytes of arbitrary command data
*/
__u8 cmd[0];
};
};
.EE
.in
.PP
The
.I opcode
describes the operation to be performed. It can be one of:
.TP
.B IORING_OP_NOP
Do not perform any I/O. This is useful for testing the performance of
the io_uring implementation itself.
.TP
.B IORING_OP_READV
.TP
.B IORING_OP_WRITEV
Vectored read and write operations, similar to
.BR preadv2 (2)
and
.BR pwritev2 (2).
If the file is not seekable,
.I off
must be set to zero or -1.
.TP
.B IORING_OP_READ_FIXED
.TP
.B IORING_OP_WRITE_FIXED
Read from or write to pre-mapped buffers. See
.BR io_uring_register (2)
for details on how to setup a context for fixed reads and writes.
.TP
.B IORING_OP_FSYNC
File sync. See also
.BR fsync (2).
Optionally
.I off
and
.I len
can be used to specify a range within the file to be synced rather than
syncing the entire file, which is the default behavior.
Note that, while I/O is initiated in the order in which it appears in
the submission queue, completions are unordered. For example, an
application which places a write I/O followed by an fsync in the
submission queue cannot expect the fsync to apply to the write. The
two operations execute in parallel, so the fsync may complete before
the write is issued to the storage. The same is also true for
previously issued writes that have not completed prior to the fsync.
To enforce ordering one may utilize linked SQEs,
.B IOSQE_IO_DRAIN
or wait for the arrival of CQEs of requests which have to be ordered
before a given request before submitting its SQE.
.TP
.B IORING_OP_POLL_ADD
Poll the
.I fd
specified in the submission queue entry for the events
specified in the
.I poll_events
field. Unlike poll or epoll without
.BR EPOLLONESHOT ,
by default this interface always works in one shot mode. That is, once the poll
operation is completed, it will have to be resubmitted.
If
.B IORING_POLL_ADD_MULTI
is set in the SQE
.I len
field, then the poll will work in multi shot mode instead. That means it'll
repatedly trigger when the requested event becomes true, and hence multiple
CQEs can be generated from this single SQE. The CQE
.I flags
field will have
.B IORING_CQE_F_MORE
set on completion if the application should expect further CQE entries from
the original request. If this flag isn't set on completion, then the poll
request has been terminated and no further events will be generated. This mode
is available since 5.13.
This command works like
an async
.BR poll(2)
and the completion event result is the returned mask of events.
Without
.B IORING_POLL_ADD_MULTI
and the initial poll operation with
.B IORING_POLL_ADD_MULTI
the operation is level triggered, i.e. if there is data ready or events
pending etc. at the time of submission a corresponding CQE will be posted.
Potential further completions beyond the first caused by a
.B IORING_POLL_ADD_MULTI
are edge triggered.
.TP
.B IORING_OP_POLL_REMOVE
Remove or update an existing poll request. If found, the
.I res
field of the
.I "struct io_uring_cqe"
will contain 0. If not found,
.I res
will contain
.B -ENOENT,
or
.B -EALREADY
if the poll request was in the process of completing already.
If
.B IORING_POLL_UPDATE_EVENTS
is set in the SQE
.I len
field, then the request will update an existing poll request with the mask of
events passed in with this request. The lookup is based on the
.I user_data
field of the original SQE submitted, and this values is passed in the
.I addr
field of the SQE.
If
.B IORING_POLL_UPDATE_USER_DATA
is set in the SQE
.I len
field, then the request will update the
.I user_data
of an existing poll request based on the value passed in the
.I off
field. Updating an existing poll is available since 5.13.
.TP
.B IORING_OP_EPOLL_CTL
Add, remove or modify entries in the interest list of
.BR epoll (7).
See
.BR epoll_ctl (2)
for details of the system call.
.I fd
holds the file descriptor that represents the epoll instance,
.I off
holds the file descriptor to add, remove or modify,
.I len
holds the operation (
.BR EPOLL_CTL_ADD ,
.BR EPOLL_CTL_DEL ,
.BR EPOLL_CTL_MOD )
to perform and,
.I addr
holds a pointer to the
.I epoll_event
structure. Available since 5.6.
.TP
.B IORING_OP_SYNC_FILE_RANGE
Issue the equivalent of a \fBsync_file_range\fR (2) on the file descriptor. The
.I fd
field is the file descriptor to sync, the
.I off
field holds the offset in bytes, the
.I len
field holds the length in bytes, and the
.I sync_range_flags
field holds the flags for the command. See also
.BR sync_file_range (2)
for the general description of the related system call. Available since 5.2.
.TP
.B IORING_OP_SENDMSG
Issue the equivalent of a
.BR sendmsg(2)
system call.
.I fd
must be set to the socket file descriptor,
.I addr
must contain a pointer to the msghdr structure, and
.I msg_flags
holds the flags associated with the system call. See also
.BR sendmsg (2)
for the general description of the related system call. Available since 5.3.
This command also supports the following modifiers in
.I ioprio:
.PP
.in +12
.B IORING_RECVSEND_POLL_FIRST
If set, io_uring will assume the socket is currently full and attempting to
send data will be unsuccessful. For this case, io_uring will arm internal
poll and trigger a send of the data when there is enough space available.
This initial send attempt can be wasteful for the case where the socket
is expected to be full, setting this flag will bypass the initial send
attempt and go straight to arming poll. If poll does indicate that data can
be sent, the operation will proceed.
.EE
.in
.PP
.TP
.B IORING_OP_RECVMSG
Works just like IORING_OP_SENDMSG, except for
.BR recvmsg(2)
instead. See the description of IORING_OP_SENDMSG. Available since 5.3.
This command also supports the following modifiers in
.I ioprio:
.PP
.in +12
.B IORING_RECVSEND_POLL_FIRST
If set, io_uring will assume the socket is currently empty and attempting to
receive data will be unsuccessful. For this case, io_uring will arm internal
poll and trigger a receive of the data when the socket has data to be read.
This initial receive attempt can be wasteful for the case where the socket
is expected to be empty, setting this flag will bypass the initial receive
attempt and go straight to arming poll. If poll does indicate that data is
ready to be received, the operation will proceed.
.EE
.in
.PP
.TP
.B IORING_OP_SEND
Issue the equivalent of a
.BR send(2)
system call.
.I fd
must be set to the socket file descriptor,
.I addr
must contain a pointer to the buffer,
.I len
denotes the length of the buffer to send, and
.I msg_flags
holds the flags associated with the system call. See also
.BR send(2)
for the general description of the related system call. Available since 5.6.
This command also supports the following modifiers in
.I ioprio:
.PP
.in +12
.B IORING_RECVSEND_POLL_FIRST
If set, io_uring will assume the socket is currently full and attempting to
send data will be unsuccessful. For this case, io_uring will arm internal
poll and trigger a send of the data when there is enough space available.
This initial send attempt can be wasteful for the case where the socket
is expected to be full, setting this flag will bypass the initial send
attempt and go straight to arming poll. If poll does indicate that data can
be sent, the operation will proceed.
.EE
.in
.PP
.TP
.B IORING_OP_RECV
Works just like IORING_OP_SEND, except for
.BR recv(2)
instead. See the description of IORING_OP_SEND. Available since 5.6.
This command also supports the following modifiers in
.I ioprio:
.PP
.in +12
.B IORING_RECVSEND_POLL_FIRST
If set, io_uring will assume the socket is currently empty and attempting to
receive data will be unsuccessful. For this case, io_uring will arm internal
poll and trigger a receive of the data when the socket has data to be read.
This initial receive attempt can be wasteful for the case where the socket
is expected to be empty, setting this flag will bypass the initial receive
attempt and go straight to arming poll. If poll does indicate that data is
ready to be received, the operation will proceed.
.EE
.in
.PP
.TP
.B IORING_OP_TIMEOUT
This command will register a timeout operation. The
.I addr
field must contain a pointer to a struct __kernel_timespec structure,
.I len
must contain 1 to signify one __kernel_timespec structure,
.I timeout_flags
may contain
.B IORING_TIMEOUT_ABS
for an absolute timeout value, or 0 for a relative timeout.
.I off
may contain a completion event count. A timeout
will trigger a wakeup event on the completion ring for anyone waiting for
events. A timeout condition is met when either the specified timeout expires,
or the specified number of events have completed. Either condition will
trigger the event. If set to 0, completed events are not counted, which
effectively acts like a timer. io_uring timeouts use the
.B CLOCK_MONOTONIC
as the default clock source. The request will complete with
.B -ETIME
if the timeout got completed through expiration of the timer, or
.I 0
if the timeout got completed through requests completing on their own. If
the timeout was canceled before it expired, the request will complete with
.B -ECANCELED.
Available since 5.4.
Since 5.15, this command also supports the following modifiers in
.I timeout_flags:
.PP
.in +12
.B IORING_TIMEOUT_BOOTTIME
If set, then the clocksource used is
.B CLOCK_BOOTTIME
instead of
.BR CLOCK_MONOTONIC .
This clocksource differs in that it includes time elapsed if the system was
suspend while having a timeout request in-flight.
.B IORING_TIMEOUT_REALTIME
If set, then the clocksource used is
.B CLOCK_REALTIME
instead of
.BR CLOCK_MONOTONIC .
.EE
.in
.PP
.PP
.in +7
Since 5.16,
.B IORING_TIMEOUT_ETIME_SUCCESS
can be set in
.IR timeout_flags ,
which will result in the expiration of the timer and subsequent completion
with
.B -ETIME
not being interpreted as an error. This is mostly relevant for linked SQEs, as
subsequent requests in the chain would not get canceled by the timeout, if
this flag is set. See
.B IOSQE_IO_LINK
for more details on linked SQEs.
.in
.PP
.PP
.in +7
Since 6.4,
.B IORING_TIMEOUT_MULTISHOT
can be set in
.IR timeout_flags ,
which will result in the timer producing multiple consecutive completions
like other multi shot operations e.g.
.B IORING_OP_READ_MULTISHOT
or
.BR IORING_POLL_ADD_MULTI .
.I off
must be set to the amount of desired completions.
.B IORING_TIMEOUT_MULTISHOT
must not be used with
.BR IORING_TIMEOUT_ABS .
.in
.PP
.TP
.B IORING_OP_TIMEOUT_REMOVE
If
.I timeout_flags
are zero, then it attempts to remove an existing timeout operation.
.I addr
must contain the
.I user_data
field of the previously issued timeout operation. If the specified timeout
request is found and canceled successfully, this request will terminate
with a result value of
.I 0
If the timeout request was found but expiration was already in progress,
this request will terminate with a result value of
.B -EBUSY
If the timeout request wasn't found, the request will terminate with a result
value of
.B -ENOENT
Available since 5.5.
If
.I timeout_flags
contain
.BR IORING_TIMEOUT_UPDATE ,
instead of removing an existing operation, it updates it.
.I addr
and return values are same as before.
.I addr2
field must contain a pointer to a struct __kernel_timespec structure.
.I timeout_flags
may also contain IORING_TIMEOUT_ABS, in which case the value given is an
absolute one, not a relative one.
Available since 5.11.
.TP
.B IORING_OP_ACCEPT
Issue the equivalent of an
.BR accept4 (2)
system call.
.I fd
must be set to the socket file descriptor,
.I addr
must contain the pointer to the sockaddr structure, and
.I addr2
must contain a pointer to the socklen_t addrlen field. Flags can be passed using
the
.I accept_flags
field. See also
.BR accept4 (2)
for the general description of the related system call. Available since 5.5.
If the
.I file_index
field is set to a positive number, the file won't be installed into the
normal file table as usual but will be placed into the fixed file table at index
.I file_index
- 1.
In this case, instead of returning a file descriptor, the result will contain
either 0 on success or an error. If the index points to a valid empty slot, the
installation is guaranteed to not fail. If there is already a file in the slot,
it will be replaced, similar to
.B IORING_OP_FILES_UPDATE.
Please note that only io_uring has access to such files and no other syscall
can use them. See
.B IOSQE_FIXED_FILE
and
.BR IORING_REGISTER_FILES .
Available since 5.5.
.TP
.B IORING_OP_ASYNC_CANCEL
Attempt to cancel an already issued request.
.I addr
must contain the
.I user_data
field of the request that should be canceled. The cancelation request will
complete with one of the following results codes. If found, the
.I res
field of the cqe will contain 0. If not found,
.I res
will contain
.BR -ENOENT .
If found and attempted canceled, the
.I res
field will contain
.BR -EALREADY .
In this case, the request may or may not
terminate. In general, requests that are interruptible (like socket IO) will
get canceled, while disk IO requests cannot be canceled if already started.
Available since 5.5.
.TP
.B IORING_OP_LINK_TIMEOUT
This request must be linked with another request through
.B IOSQE_IO_LINK
which is described below. Unlike
.BR IORING_OP_TIMEOUT ,
.B IORING_OP_LINK_TIMEOUT
acts on the linked request, not the completion queue. The format of the command
is otherwise like
.BR IORING_OP_TIMEOUT ,
except there's no completion event count as it's tied to a specific request.
If used, the timeout specified in the command will cancel the linked command,
unless the linked command completes before the timeout. The timeout will
complete with
.B -ETIME
if the timer expired and the linked request was attempted canceled, or
.B -ECANCELED
if the timer got canceled because of completion of the linked request. Like
.B IORING_OP_TIMEOUT
the clock source used is
.B CLOCK_MONOTONIC
Available since 5.5.
.TP
.B IORING_OP_CONNECT
Issue the equivalent of a
.BR connect (2)
system call.
.I fd
must be set to the socket file descriptor,
.I addr
must contain the const pointer to the sockaddr structure, and
.I off
must contain the socklen_t addrlen field. See also
.BR connect (2)
for the general description of the related system call. Available since 5.5.
.TP
.B IORING_OP_FALLOCATE
Issue the equivalent of a
.BR fallocate (2)
system call.
.I fd
must be set to the file descriptor,
.I len
must contain the mode associated with the operation,
.I off
must contain the offset on which to operate, and
.I addr
must contain the length. See also
.BR fallocate (2)
for the general description of the related system call. Available since 5.6.
.TP
.B IORING_OP_FADVISE
Issue the equivalent of a
.BR posix_fadvise (2)
system call.
.I fd
must be set to the file descriptor,
.I off
must contain the offset on which to operate,
.I len
must contain the length, and
.I fadvise_advice
must contain the advice associated with the operation. See also
.BR posix_fadvise (2)
for the general description of the related system call. Available since 5.6.
.TP
.B IORING_OP_MADVISE
Issue the equivalent of a
.BR madvise (2)
system call.
.I addr
must contain the address to operate on,
.I len
must contain the length on which to operate,
and
.I fadvise_advice
must contain the advice associated with the operation. See also
.BR madvise (2)
for the general description of the related system call. Available since 5.6.
.TP
.B IORING_OP_OPENAT
Issue the equivalent of a
.BR openat (2)
system call.
.I fd
is the
.I dirfd
argument,
.I addr
must contain a pointer to the
.I *pathname
argument,
.I open_flags
should contain any flags passed in, and
.I len
is access mode of the file. See also
.BR openat (2)
for the general description of the related system call. Available since 5.6.
If the
.I file_index
field is set to a positive number, the file won't be installed into the
normal file table as usual but will be placed into the fixed file table at index
.I file_index - 1.
In this case, instead of returning a file descriptor, the result will contain
either 0 on success or an error. If the index points to a valid empty slot, the
installation is guaranteed to not fail. If there is already a file in the slot,
it will be replaced, similar to
.B IORING_OP_FILES_UPDATE.
Please note that only io_uring has access to such files and no other syscall
can use them. See
.B IOSQE_FIXED_FILE
and
.BR IORING_REGISTER_FILES .
Available since 5.15.
.TP
.B IORING_OP_OPENAT2
Issue the equivalent of a
.BR openat2 (2)
system call.
.I fd
is the
.I dirfd
argument,
.I addr
must contain a pointer to the
.I *pathname
argument,
.I len
should contain the size of the open_how structure, and
.I off
should be set to the address of the open_how structure. See also
.BR openat2 (2)
for the general description of the related system call. Available since 5.6.
If the
.I file_index
field is set to a positive number, the file won't be installed into the
normal file table as usual but will be placed into the fixed file table at index
.I file_index - 1.
In this case, instead of returning a file descriptor, the result will contain
either 0 on success or an error. If the index points to a valid empty slot, the
installation is guaranteed to not fail. If there is already a file in the slot,
it will be replaced, similar to
.BR IORING_OP_FILES_UPDATE .
Please note that only io_uring has access to such files and no other syscall
can use them. See
.B IOSQE_FIXED_FILE
and
.BR IORING_REGISTER_FILES .
Available since 5.15.
.TP
.B IORING_OP_CLOSE
Issue the equivalent of a
.BR close (2)
system call.
.I fd
is the file descriptor to be closed. See also
.BR close (2)
for the general description of the related system call. Available since 5.6.
If the
.I file_index
field is set to a positive number, this command can be used to close files
that were direct opened through
.BR IORING_OP_OPENAT ,
.BR IORING_OP_OPENAT2 ,
or
.B IORING_OP_ACCEPT
using the io_uring specific direct descriptors. Note that only one of the
descriptor fields may be set. The direct close feature is available since
the 5.15 kernel, where direct descriptors were introduced.
.TP
.B IORING_OP_STATX
Issue the equivalent of a
.BR statx (2)
system call.
.I fd
is the
.I dirfd
argument,
.I addr
must contain a pointer to the
.I *pathname
string,
.I statx_flags
is the
.I flags
argument,
.I len
should be the
.I mask
argument, and
.I off
must contain a pointer to the
.I statxbuf
to be filled in. See also
.BR statx (2)
for the general description of the related system call. Available since 5.6.
.TP
.B IORING_OP_READ
.TP
.B IORING_OP_WRITE
Issue the equivalent of a
.BR pread (2)
or
.BR pwrite (2)
system call.
.I fd
is the file descriptor to be operated on,
.I addr
contains the buffer in question,
.I len
contains the length of the IO operation, and
.I offs
contains the read or write offset. If
.I fd
does not refer to a seekable file,
.I off
must be set to zero or -1. If
.I offs
is set to
.B -1
, the offset will use (and advance) the file position, like the
.BR read (2)
and
.BR write (2)
system calls. These are non-vectored versions of the
.B IORING_OP_READV
and
.B IORING_OP_WRITEV
opcodes. See also
.BR read (2)
and
.BR write (2)
for the general description of the related system call. Available since 5.6.
.TP
.B IORING_OP_SPLICE