Merge branch 'msg_cmsg_cloexec' into 'master'
feat: Implement MSG_CMSG_CLOEXEC handling to recvmsg See merge request redox-os/relibc!975
This commit is contained in:
@@ -50,6 +50,7 @@ pub const MSG_PEEK: c_int = 2;
|
||||
pub const MSG_TRUNC: c_int = 32;
|
||||
pub const MSG_DONTWAIT: c_int = 64;
|
||||
pub const MSG_WAITALL: c_int = 256;
|
||||
pub const MSG_CMSG_CLOEXEC: c_int = 0x40000000;
|
||||
|
||||
pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 70;
|
||||
pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 71;
|
||||
|
||||
@@ -394,6 +394,7 @@ unsafe fn deserialize_ancillary_data_from_stream(
|
||||
msg_stream: &[u8],
|
||||
cursor: &mut usize,
|
||||
cmsg_space_provided: usize,
|
||||
flags: c_int,
|
||||
) -> Result<()> {
|
||||
let mut current_cmsg_ptr_in_user_buf = if !mhdr.msg_control.is_null() && cmsg_space_provided > 0
|
||||
{
|
||||
@@ -449,7 +450,12 @@ unsafe fn deserialize_ancillary_data_from_stream(
|
||||
)
|
||||
};
|
||||
|
||||
redox_rt::sys::sys_call_ro(socket as usize, fds_bytes, CallFlags::FD, &[])?;
|
||||
let mut call_flags = CallFlags::FD;
|
||||
if flags & MSG_CMSG_CLOEXEC == MSG_CMSG_CLOEXEC {
|
||||
call_flags |= CallFlags::FD_CLOEXEC;
|
||||
}
|
||||
|
||||
redox_rt::sys::sys_call_ro(socket as usize, fds_bytes, call_flags, &[])?;
|
||||
|
||||
for fd in fds_usize {
|
||||
temp_posix_cmsg_data_buf.extend_from_slice(&(fd as c_int).to_le_bytes());
|
||||
@@ -908,6 +914,7 @@ impl PalSocket for Sys {
|
||||
&msg_stream,
|
||||
&mut cursor,
|
||||
cmsg_space_provided_by_user as usize,
|
||||
flags,
|
||||
)
|
||||
})?;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user