@@ -56,7 +56,7 @@ pub unsafe fn io_uring_register<Fd: AsFd>(
56
56
opcode : IoringRegisterOp ,
57
57
arg : * const c_void ,
58
58
nr_args : u32 ,
59
- ) -> io:: Result < ( ) > {
59
+ ) -> io:: Result < u32 > {
60
60
backend:: io_uring:: syscalls:: io_uring_register ( fd. as_fd ( ) , opcode, arg, nr_args)
61
61
}
62
62
@@ -467,6 +467,12 @@ bitflags::bitflags! {
467
467
468
468
/// `IORING_CQE_F_MORE`
469
469
const MORE = sys:: IORING_CQE_F_MORE as _;
470
+
471
+ /// `IORING_CQE_F_SOCK_NONEMPTY`
472
+ const SOCK_NONEMPTY = sys:: IORING_CQE_F_SOCK_NONEMPTY as _;
473
+
474
+ /// `IORING_CQE_F_NOTIF`
475
+ const NOTIF = sys:: IORING_CQE_F_NOTIF as _;
470
476
}
471
477
}
472
478
@@ -558,6 +564,9 @@ bitflags::bitflags! {
558
564
559
565
/// `IORING_FEAT_SUBMIT_STABLE`
560
566
const SUBMIT_STABLE = sys:: IORING_FEAT_SUBMIT_STABLE ;
567
+
568
+ /// `IORING_FEAT_LINKED_FILE`
569
+ const LINKED_FILE = sys:: IORING_FEAT_LINKED_FILE ;
561
570
}
562
571
}
563
572
@@ -588,6 +597,9 @@ bitflags::bitflags! {
588
597
589
598
/// `IORING_SQ_CQ_OVERFLOW`
590
599
const CQ_OVERFLOW = sys:: IORING_SQ_CQ_OVERFLOW ;
600
+
601
+ /// `IORING_SQ_TASKRUN`
602
+ const TASKRUN = sys:: IORING_SQ_TASKRUN ;
591
603
}
592
604
}
593
605
@@ -612,11 +624,61 @@ bitflags::bitflags! {
612
624
613
625
/// `IORING_POLL_UPDATE_USER_DATA`
614
626
const UPDATE_USER_DATA = sys:: IORING_POLL_UPDATE_USER_DATA ;
627
+
628
+ /// `IORING_POLL_ADD_LEVEL`
629
+ const ADD_LEVEL = sys:: IORING_POLL_ADD_LEVEL ;
630
+ }
631
+ }
632
+
633
+ bitflags:: bitflags! {
634
+ /// send/sendmsg & recv/recvmsg flags (`sqe.ioprio`)
635
+ #[ derive( Default ) ]
636
+ pub struct IoringRecvSendFlags : u16 {
637
+ /// `IORING_RECVSEND_POLL_FIRST`
638
+ const POLL_FIRST = sys:: IORING_RECVSEND_POLL_FIRST as _;
639
+
640
+ /// `IORING_RECV_MULTISHOT`
641
+ const MULTISHOT = sys:: IORING_RECV_MULTISHOT as _;
642
+
643
+ /// `IORING_RECVSEND_FIXED_BUF`
644
+ const FIXED_BUF = sys:: IORING_RECVSEND_FIXED_BUF as _;
645
+ }
646
+ }
647
+
648
+ bitflags:: bitflags! {
649
+ /// accept flags (`sqe.ioprio`)
650
+ #[ derive( Default ) ]
651
+ pub struct IoringAcceptFlags : u16 {
652
+ /// `IORING_ACCEPT_MULTISHOT`
653
+ const MULTISHOT = sys:: IORING_ACCEPT_MULTISHOT as _;
654
+ }
655
+ }
656
+
657
+ bitflags:: bitflags! {
658
+ /// recvmsg out flags
659
+ #[ derive( Default ) ]
660
+ pub struct RecvmsgOutFlags : u32 {
661
+ /// `MSG_EOR`
662
+ const EOR = sys:: MSG_EOR ;
663
+
664
+ /// `MSG_TRUNC`
665
+ const TRUNC = sys:: MSG_TRUNC ;
666
+
667
+ /// `MSG_CTRUNC`
668
+ const CTRUNC = sys:: MSG_CTRUNC ;
669
+
670
+ /// `MSG_OOB`
671
+ const OOB = sys:: MSG_OOB ;
672
+
673
+ /// `MSG_ERRQUEUE`
674
+ const ERRQUEUE = sys:: MSG_ERRQUEUE ;
615
675
}
616
676
}
617
677
618
678
#[ allow( missing_docs) ]
619
679
pub const IORING_CQE_BUFFER_SHIFT : u32 = sys:: IORING_CQE_BUFFER_SHIFT as _ ;
680
+ #[ allow( missing_docs) ]
681
+ pub const IORING_FILE_INDEX_ALLOC : i32 = sys:: IORING_FILE_INDEX_ALLOC as _ ;
620
682
621
683
// Re-export these as `u64`, which is the `offset` type in `rustix::io::mmap`.
622
684
#[ allow( missing_docs) ]
@@ -757,7 +819,7 @@ impl core::fmt::Debug for io_uring_user_data {
757
819
pub struct io_uring_sqe {
758
820
pub opcode : IoringOp ,
759
821
pub flags : IoringSqeFlags ,
760
- pub ioprio : u16 ,
822
+ pub ioprio_or_flags : ioprio_or_flags_union ,
761
823
pub fd : RawFd ,
762
824
pub off_or_addr2 : off_or_addr2_union ,
763
825
pub addr_or_splice_off_in : addr_or_splice_off_in_union ,
@@ -770,6 +832,15 @@ pub struct io_uring_sqe {
770
832
pub addr3_or_cmd : addr3_or_cmd_union ,
771
833
}
772
834
835
+ #[ allow( missing_docs) ]
836
+ #[ repr( C ) ]
837
+ #[ derive( Copy , Clone ) ]
838
+ pub union ioprio_or_flags_union {
839
+ pub recvsend : IoringRecvSendFlags ,
840
+ pub accept : IoringAcceptFlags ,
841
+ pub ioprio : u16 ,
842
+ }
843
+
773
844
#[ allow( missing_docs) ]
774
845
#[ repr( C ) ]
775
846
#[ derive( Copy , Clone ) ]
@@ -1001,6 +1072,16 @@ pub struct io_uring_getevents_arg {
1001
1072
pub ts : u64 ,
1002
1073
}
1003
1074
1075
+ #[ allow( missing_docs) ]
1076
+ #[ repr( C ) ]
1077
+ #[ derive( Debug , Default , Copy , Clone ) ]
1078
+ pub struct io_uring_recvmsg_out {
1079
+ pub namelen : u32 ,
1080
+ pub controllen : u32 ,
1081
+ pub payloadlen : u32 ,
1082
+ pub flags : RecvmsgOutFlags ,
1083
+ }
1084
+
1004
1085
#[ allow( missing_docs) ]
1005
1086
#[ repr( C ) ]
1006
1087
#[ derive( Debug , Copy , Clone ) ]
@@ -1047,87 +1128,67 @@ pub struct io_uring_buf {
1047
1128
pub resv : u16 ,
1048
1129
}
1049
1130
1131
+ impl Default for ioprio_or_flags_union {
1132
+ #[ inline]
1133
+ fn default ( ) -> Self {
1134
+ // Safety: All of Linux's io_uring structs may be zero-initialized.
1135
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1136
+ }
1137
+ }
1138
+
1050
1139
impl Default for off_or_addr2_union {
1051
1140
#[ inline]
1052
1141
fn default ( ) -> Self {
1053
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1054
1142
// Safety: All of Linux's io_uring structs may be zero-initialized.
1055
- unsafe {
1056
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1057
- s. assume_init ( )
1058
- }
1143
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1059
1144
}
1060
1145
}
1061
1146
1062
1147
impl Default for addr_or_splice_off_in_union {
1063
1148
#[ inline]
1064
1149
fn default ( ) -> Self {
1065
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1066
1150
// Safety: All of Linux's io_uring structs may be zero-initialized.
1067
- unsafe {
1068
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1069
- s. assume_init ( )
1070
- }
1151
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1071
1152
}
1072
1153
}
1073
1154
1074
1155
impl Default for addr3_or_cmd_union {
1075
1156
#[ inline]
1076
1157
fn default ( ) -> Self {
1077
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1078
1158
// Safety: All of Linux's io_uring structs may be zero-initialized.
1079
- unsafe {
1080
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1081
- s. assume_init ( )
1082
- }
1159
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1083
1160
}
1084
1161
}
1085
1162
1086
1163
impl Default for op_flags_union {
1087
1164
#[ inline]
1088
1165
fn default ( ) -> Self {
1089
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1090
1166
// Safety: All of Linux's io_uring structs may be zero-initialized.
1091
- unsafe {
1092
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1093
- s. assume_init ( )
1094
- }
1167
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1095
1168
}
1096
1169
}
1097
1170
1098
1171
impl Default for buf_union {
1099
1172
#[ inline]
1100
1173
fn default ( ) -> Self {
1101
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1102
1174
// Safety: All of Linux's io_uring structs may be zero-initialized.
1103
- unsafe {
1104
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1105
- s. assume_init ( )
1106
- }
1175
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1107
1176
}
1108
1177
}
1109
1178
1110
1179
impl Default for splice_fd_in_or_file_index_union {
1111
1180
#[ inline]
1112
1181
fn default ( ) -> Self {
1113
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1114
1182
// Safety: All of Linux's io_uring structs may be zero-initialized.
1115
- unsafe {
1116
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1117
- s. assume_init ( )
1118
- }
1183
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1119
1184
}
1120
1185
}
1121
1186
1122
1187
impl Default for register_or_sqe_op_or_sqe_flags_union {
1123
1188
#[ inline]
1124
1189
fn default ( ) -> Self {
1125
- let mut s = :: core:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
1126
1190
// Safety: All of Linux's io_uring structs may be zero-initialized.
1127
- unsafe {
1128
- :: core:: ptr:: write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1129
- s. assume_init ( )
1130
- }
1191
+ unsafe { :: core:: mem:: zeroed :: < Self > ( ) }
1131
1192
}
1132
1193
}
1133
1194
@@ -1214,7 +1275,7 @@ fn io_uring_layouts() {
1214
1275
check_type ! ( io_uring_sqe) ;
1215
1276
check_struct_field ! ( io_uring_sqe, opcode) ;
1216
1277
check_struct_field ! ( io_uring_sqe, flags) ;
1217
- check_struct_field ! ( io_uring_sqe, ioprio) ;
1278
+ check_struct_renamed_field ! ( io_uring_sqe, ioprio_or_flags , ioprio) ;
1218
1279
check_struct_field ! ( io_uring_sqe, fd) ;
1219
1280
check_struct_renamed_field ! ( io_uring_sqe, off_or_addr2, __bindgen_anon_1) ;
1220
1281
check_struct_renamed_field ! ( io_uring_sqe, addr_or_splice_off_in, __bindgen_anon_2) ;
@@ -1274,6 +1335,7 @@ fn io_uring_layouts() {
1274
1335
resv1,
1275
1336
resv2
1276
1337
) ;
1338
+ check_struct ! ( io_uring_recvmsg_out, namelen, controllen, payloadlen, flags) ;
1277
1339
check_struct ! ( io_uring_probe, last_op, ops_len, resv, resv2, ops) ;
1278
1340
check_struct ! ( io_uring_probe_op, op, resv, flags, resv2) ;
1279
1341
check_struct ! ( io_uring_files_update, offset, resv, fds) ;
0 commit comments