From 697e36544390f4675355204d409dad67ba786cbe Mon Sep 17 00:00:00 2001 From: Aphek Date: Thu, 4 Dec 2025 00:46:33 -0300 Subject: [PATCH] newlib: Fix ambiguous glob exports and other warnings for Vita and 3DS --- src/new/vita/mod.rs | 2 -- src/new/vita/unistd.rs | 7 ------- src/unix/mod.rs | 3 ++- src/unix/newlib/generic.rs | 10 +++++----- src/unix/newlib/horizon/mod.rs | 9 ++++++--- src/unix/newlib/mod.rs | 26 -------------------------- src/unix/newlib/rtems/mod.rs | 2 -- src/unix/newlib/vita/mod.rs | 2 -- 8 files changed, 13 insertions(+), 48 deletions(-) delete mode 100644 src/new/vita/unistd.rs diff --git a/src/new/vita/mod.rs b/src/new/vita/mod.rs index 38783a3f19fbc..21205ebd046fb 100644 --- a/src/new/vita/mod.rs +++ b/src/new/vita/mod.rs @@ -1,4 +1,2 @@ //! VITASDK system library. // FIXME(vita): link to headers or manpages needed. - -pub(crate) mod unistd; diff --git a/src/new/vita/unistd.rs b/src/new/vita/unistd.rs deleted file mode 100644 index 8d55ee5823315..0000000000000 --- a/src/new/vita/unistd.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Header: `unistd.h` - -pub use crate::new::common::posix::unistd::{ - STDERR_FILENO, - STDIN_FILENO, - STDOUT_FILENO, -}; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 60a5b32100c23..d2ab7274ae237 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -142,7 +142,7 @@ s! { pub ipv6mr_interface: c_uint, } - #[cfg(not(target_os = "cygwin"))] + #[cfg(all(not(target_os = "cygwin"), not(target_os = "horizon")))] pub struct hostent { pub h_name: *mut c_char, pub h_aliases: *mut *mut c_char, @@ -156,6 +156,7 @@ s! { pub iov_len: size_t, } + #[cfg(not(target_os = "horizon"))] pub struct pollfd { pub fd: c_int, pub events: c_short, diff --git a/src/unix/newlib/generic.rs b/src/unix/newlib/generic.rs index ba4dfbe528b69..303de806b653f 100644 --- a/src/unix/newlib/generic.rs +++ b/src/unix/newlib/generic.rs @@ -1,16 +1,15 @@ //! Common types used by most newlib platforms -use crate::off_t; +#[allow(unused_imports)] // needed for platforms that don't use the prelude here use crate::prelude::*; s! { + #[cfg(all(not(target_os = "vita"), not(target_os = "horizon")))] pub struct sigset_t { - #[cfg(target_os = "horizon")] - __val: [c_ulong; 16], - #[cfg(not(target_os = "horizon"))] __val: u32, } + #[cfg(all(not(target_os = "vita"), not(target_os = "horizon")))] pub struct stat { pub st_dev: crate::dev_t, pub st_ino: crate::ino_t, @@ -19,7 +18,7 @@ s! { pub st_uid: crate::uid_t, pub st_gid: crate::gid_t, pub st_rdev: crate::dev_t, - pub st_size: off_t, + pub st_size: crate::off_t, pub st_atime: crate::time_t, pub st_spare1: c_long, pub st_mtime: crate::time_t, @@ -31,6 +30,7 @@ s! { pub st_spare4: [c_long; 2usize], } + #[cfg(not(target_os = "vita"))] pub struct dirent { pub d_ino: crate::ino_t, pub d_type: c_uchar, diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs index 3958e02734ada..ac500b1c79a32 100644 --- a/src/unix/newlib/horizon/mod.rs +++ b/src/unix/newlib/horizon/mod.rs @@ -28,6 +28,12 @@ s! { pub h_addr_list: *mut *mut c_char, } + pub struct pollfd { + pub fd: c_int, + pub events: c_int, + pub revents: c_int, + } + pub struct sockaddr { pub sa_family: crate::sa_family_t, pub sa_data: [c_char; 26usize], @@ -141,9 +147,6 @@ pub const MSG_MORE: c_int = 0; pub const MSG_NOSIGNAL: c_int = 0; pub const SOL_CONFIG: c_uint = 65534; -pub const _SC_PAGESIZE: c_int = 8; -pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; - pub const PTHREAD_STACK_MIN: size_t = 4096; pub const WNOHANG: c_int = 1; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 0deff9db71ccd..13ae188687363 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -64,21 +64,6 @@ cfg_if! { } } -cfg_if! { - if #[cfg(not(target_os = "horizon"))] { - s! { - pub struct hostent { - pub h_name: *mut c_char, - pub h_aliases: *mut *mut c_char, - pub h_addrtype: c_int, - pub h_length: c_int, - pub h_addr_list: *mut *mut c_char, - pub h_addr: *mut c_char, - } - } - } -} - s! { // The order of the `ai_addr` field in this struct is crucial // for converting between the Rust and C types. @@ -108,21 +93,10 @@ s! { pub imr_interface: in_addr, } - pub struct linger { - pub l_onoff: c_int, - pub l_linger: c_int, - } - pub struct in_addr { pub s_addr: crate::in_addr_t, } - pub struct pollfd { - pub fd: c_int, - pub events: c_int, - pub revents: c_int, - } - pub struct lconv { pub decimal_point: *mut c_char, pub thousands_sep: *mut c_char, diff --git a/src/unix/newlib/rtems/mod.rs b/src/unix/newlib/rtems/mod.rs index 0e23352744149..ec4534e32a11f 100644 --- a/src/unix/newlib/rtems/mod.rs +++ b/src/unix/newlib/rtems/mod.rs @@ -73,8 +73,6 @@ pub const EAI_SERVICE: c_int = 9; pub const EAI_SYSTEM: c_int = 11; pub const EAI_OVERFLOW: c_int = 14; -pub const _SC_PAGESIZE: c_int = 8; -pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; pub const PTHREAD_STACK_MIN: size_t = 0; // sys/wait.h diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs index 2a456f47363d9..302601de96afd 100644 --- a/src/unix/newlib/vita/mod.rs +++ b/src/unix/newlib/vita/mod.rs @@ -164,8 +164,6 @@ pub const EAI_MEMORY: c_int = -10; pub const EAI_SYSTEM: c_int = -11; pub const EAI_OVERFLOW: c_int = -12; -pub const _SC_PAGESIZE: c_int = 8; -pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; pub const PTHREAD_STACK_MIN: size_t = 32 * 1024; pub const IP_HDRINCL: c_int = 2;