Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions library/std/src/sys/net/connection/socket/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::ffi::CStr;
use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
use crate::net::{Shutdown, SocketAddr};
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
#[cfg(target_os = "nuttx")]
use crate::ptr::null;
use crate::sys::fd::FileDesc;
use crate::sys::net::{getsockopt, setsockopt};
use crate::sys::pal::IsMinusOne;
Expand Down Expand Up @@ -186,6 +188,16 @@ impl Socket {
Err(e) => return Err(e),
}

#[cfg(target_os = "nuttx")]
let mut pollfd = libc::pollfd {
fd: self.as_raw_fd(),
events: libc::POLLOUT,
revents: 0,
arg: null(),
cb: null(),
r#priv: null(),
};
#[cfg(not(target_os = "nuttx"))]
let mut pollfd = libc::pollfd { fd: self.as_raw_fd(), events: libc::POLLOUT, revents: 0 };

if timeout.as_secs() == 0 && timeout.subsec_nanos() == 0 {
Expand Down
31 changes: 31 additions & 0 deletions library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![allow(missing_docs, nonstandard_style)]

use crate::io;
#[cfg(target_os = "nuttx")]
use crate::ptr::null;

pub mod conf;
#[cfg(target_os = "fuchsia")]
Expand Down Expand Up @@ -88,6 +90,35 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
)))]
'poll: {
use crate::sys::io::errno;

#[cfg(target_os = "nuttx")]
let pfds: &mut [_] = &mut [
libc::pollfd {
fd: 0,
events: 0,
revents: 0,
arg: null(),
cb: null(),
r#priv: null(),
},
libc::pollfd {
fd: 1,
events: 0,
revents: 0,
arg: null(),
cb: null(),
r#priv: null(),
},
libc::pollfd {
fd: 2,
events: 0,
revents: 0,
arg: null(),
cb: null(),
r#priv: null(),
},
];
#[cfg(not(target_os = "nuttx"))]
let pfds: &mut [_] = &mut [
libc::pollfd { fd: 0, events: 0, revents: 0 },
libc::pollfd { fd: 1, events: 0, revents: 0 },
Expand Down
Loading