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
56 changes: 0 additions & 56 deletions src/unix/newlib/aarch64/mod.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/unix/newlib/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,3 @@ pub const MSG_DONTROUTE: c_int = 0;
pub const MSG_WAITALL: c_int = 0;
pub const MSG_MORE: c_int = 0;
pub const MSG_NOSIGNAL: c_int = 0;

pub use crate::unix::newlib::generic::{
dirent,
sigset_t,
stat,
};
35 changes: 0 additions & 35 deletions src/unix/newlib/generic.rs

This file was deleted.

67 changes: 40 additions & 27 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ pub type blksize_t = i32;
pub type clockid_t = c_ulong;

cfg_if! {
if #[cfg(any(target_os = "espidf"))] {
if #[cfg(any(target_os = "espidf", target_os = "vita"))] {
pub type dev_t = c_short;
pub type ino_t = c_ushort;
pub type off_t = c_long;
} else if #[cfg(any(target_os = "vita"))] {
pub type dev_t = c_short;
pub type ino_t = c_ushort;
pub type off_t = c_int;
} else {
} else if #[cfg(any(target_arch = "arm", target_arch = "powerpc"))] {
pub type dev_t = u32;
pub type ino_t = u32;
pub type off_t = i64;
} else {
core::compile_error!("unsupported target");
}
}

Expand Down Expand Up @@ -55,12 +53,12 @@ pub type useconds_t = u32;

cfg_if! {
if #[cfg(any(
target_os = "horizon",
all(target_os = "espidf", not(espidf_time32))
all(target_os = "espidf", espidf_time32),
target_os = "vita"
))] {
pub type time_t = c_longlong;
pub type time_t = c_long;
} else {
pub type time_t = i32;
pub type time_t = i64;
Comment on lines +60 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks wrong for the vita, which uses 32-bit time, as --enable-newlib-long-time_t is set when building newlib in vitasdk (currently the only supported SDK).

The correct definition would be c_long (effectively i32).

Sources in the top-level comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That's fixed now.

}
}

Expand Down Expand Up @@ -325,6 +323,35 @@ s! {
// Unverified
size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
}

#[cfg(all(not(target_os = "vita"), not(target_os = "horizon")))]
pub struct sigset_t {
__val: u32,
}

pub struct stat {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino_t,
pub st_mode: crate::mode_t,
pub st_nlink: crate::nlink_t,
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_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
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,
pub d_name: [c_char; 256usize],
}
}

pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
Expand Down Expand Up @@ -935,8 +962,6 @@ extern "C" {
pub fn uname(buf: *mut crate::utsname) -> c_int;
}

mod generic;

cfg_if! {
if #[cfg(target_os = "espidf")] {
mod espidf;
Expand All @@ -950,22 +975,10 @@ cfg_if! {
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
} else if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else if #[cfg(target_arch = "powerpc")] {
mod powerpc;
pub use self::powerpc::*;
} else {
// Only tested on ARM so far. Other platforms might have different
// definitions for types and constants.
pub use target_arch_not_implemented;
}
}

cfg_if! {
if #[cfg(target_os = "rtems")] {
} else if #[cfg(target_os = "rtems")] {
mod rtems;
pub use self::rtems::*;
} else {
core::compile_error!("unsupported target");
}
}
18 changes: 0 additions & 18 deletions src/unix/newlib/powerpc/mod.rs

This file was deleted.