Skip to content

Commit a391cc2

Browse files
committed
Define IoringSocketOp for SetSockOpt
1 parent e6f891d commit a391cc2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/io_uring/mod.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,29 @@ impl Default for IoringRestrictionOp {
697697
}
698698
}
699699

700+
/// `SOCKET_URING_OP_*` constants which represent commands for use with
701+
/// [`IoringOp::SetSockOpt`].
702+
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
703+
#[repr(u32)]
704+
#[non_exhaustive]
705+
pub enum IoringSocketOp {
706+
/// `SOCKET_URING_OP_SIOCINQ`
707+
Siocinq = sys::io_uring_socket_op::SOCKET_URING_OP_SIOCINQ as _,
708+
/// `SOCKET_URING_OP_SIOCOUTQ`
709+
Siocoutq = sys::io_uring_socket_op::SOCKET_URING_OP_SIOCOUTQ as _,
710+
/// `SOCKET_URING_OP_GETSOCKOPT`
711+
Getsockopt = sys::io_uring_socket_op::SOCKET_URING_OP_GETSOCKOPT as _,
712+
/// `SOCKET_URING_OP_SETSOCKOPT`
713+
Setsockopt = sys::io_uring_socket_op::SOCKET_URING_OP_SETSOCKOPT as _,
714+
}
715+
716+
impl Default for IoringSocketOp {
717+
#[inline]
718+
fn default() -> Self {
719+
Self::Siocinq
720+
}
721+
}
722+
700723
/// `IORING_MSG_*` constants which represent commands for use with
701724
/// [`IoringOp::MsgRing`], (`seq.addr`)
702725
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -1469,6 +1492,8 @@ pub union len_union {
14691492
#[derive(Copy, Clone)]
14701493
pub union addr3_or_cmd_union {
14711494
pub addr3: addr3_struct,
1495+
pub optval: io_uring_ptr,
1496+
pub path: io_uring_ptr,
14721497
pub cmd: [u8; 0],
14731498
}
14741499

@@ -1509,9 +1534,19 @@ pub union addr_or_splice_off_in_union {
15091534
pub addr: io_uring_ptr,
15101535
pub splice_off_in: u64,
15111536
pub msgring_cmd: IoringMsgringCmds,
1537+
pub sockopt_level_optname: sockopt_level_optname_struct,
15121538
pub user_data: io_uring_user_data,
15131539
}
15141540

1541+
#[allow(missing_docs)]
1542+
#[repr(C)]
1543+
#[derive(Copy, Clone)]
1544+
#[non_exhaustive]
1545+
pub struct sockopt_level_optname_struct {
1546+
pub level: u32,
1547+
pub optname: u32,
1548+
}
1549+
15151550
#[allow(missing_docs)]
15161551
#[repr(C)]
15171552
#[derive(Copy, Clone)]
@@ -1542,6 +1577,7 @@ pub union op_flags_union {
15421577
pub uring_cmd_flags: IoringUringCmdFlags,
15431578
pub futex_flags: FutexWaitvFlags,
15441579
pub install_fd_flags: IoringFixedFdFlags,
1580+
pub socket_op: IoringSocketOp,
15451581
}
15461582

15471583
#[allow(missing_docs)]
@@ -1559,6 +1595,7 @@ pub union splice_fd_in_or_file_index_or_addr_len_union {
15591595
pub splice_fd_in: i32,
15601596
pub file_index: u32,
15611597
pub addr_len: addr_len_struct,
1598+
pub optlen: u32,
15621599
}
15631600

15641601
#[allow(missing_docs)]

0 commit comments

Comments
 (0)