diff options
| author | Michał Łowicki <mlowicki@gmail.com> | 2025-04-18 10:38:17 +0200 |
|---|---|---|
| committer | Michał Łowicki <michal.lowicki@datadoghq.com> | 2025-06-16 09:15:17 +0200 |
| commit | 426ab142507fca8704d934da556f1c96b0fd61b2 (patch) | |
| tree | 971db0ea8dc6503539410cda2de05189570c6264 /library/std/src/sys/net/connection/socket/unix.rs | |
| parent | ed44c0e3b3a4f90c464361ec6892c1d42c15ea8f (diff) | |
| download | rust-426ab142507fca8704d934da556f1c96b0fd61b2.tar.gz rust-426ab142507fca8704d934da556f1c96b0fd61b2.zip | |
Set MSG_NOSIGNAL for UnixSteam
https://github.com/rust-lang/rust/issues/139956 fix
Diffstat (limited to 'library/std/src/sys/net/connection/socket/unix.rs')
| -rw-r--r-- | library/std/src/sys/net/connection/socket/unix.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/src/sys/net/connection/socket/unix.rs b/library/std/src/sys/net/connection/socket/unix.rs index b35d5d2aa84..b2a4961c3c5 100644 --- a/library/std/src/sys/net/connection/socket/unix.rs +++ b/library/std/src/sys/net/connection/socket/unix.rs @@ -281,6 +281,14 @@ impl Socket { self.0.duplicate().map(Socket) } + pub fn send_with_flags(&self, buf: &[u8], flags: c_int) -> io::Result<usize> { + let len = cmp::min(buf.len(), <wrlen_t>::MAX as usize) as wrlen_t; + let ret = cvt(unsafe { + libc::send(self.as_raw_fd(), buf.as_ptr() as *const c_void, len, flags) + })?; + Ok(ret as usize) + } + fn recv_with_flags(&self, mut buf: BorrowedCursor<'_>, flags: c_int) -> io::Result<()> { let ret = cvt(unsafe { libc::recv( |
