mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 08:37:14 +00:00
Rollup merge of #32687 - mneumann:dragonfly_fix_libstd, r=alexcrichton
Fix libstd on DragonFly Following changes: * birthtime does not exist on DragonFly * errno: __dfly_error is no more. Use #[thread_local] static errno. * clock_gettime expects a c_ulong These changes are required to build DragonFly snapshots again.
This commit is contained in:
commit
2baa1503c9
|
@ -63,10 +63,6 @@ pub trait MetadataExt {
|
|||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_ctime_nsec(&self) -> i64;
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_birthtime(&self) -> i64;
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_birthtime_nsec(&self) -> i64;
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_blksize(&self) -> u64;
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_blocks(&self) -> u64;
|
||||
|
@ -129,12 +125,6 @@ fn st_ctime(&self) -> i64 {
|
|||
fn st_ctime_nsec(&self) -> i64 {
|
||||
self.as_inner().as_inner().st_ctime_nsec as i64
|
||||
}
|
||||
fn st_birthtime(&self) -> i64 {
|
||||
self.as_inner().as_inner().st_birthtime as i64
|
||||
}
|
||||
fn st_birthtime_nsec(&self) -> i64 {
|
||||
self.as_inner().as_inner().st_birthtime_nsec as i64
|
||||
}
|
||||
fn st_blksize(&self) -> u64 {
|
||||
self.as_inner().as_inner().st_blksize as u64
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
static ENV_LOCK: StaticMutex = StaticMutex::new();
|
||||
|
||||
/// Returns the platform-specific value of errno
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub fn errno() -> i32 {
|
||||
extern {
|
||||
#[cfg_attr(any(target_os = "linux", target_os = "emscripten"),
|
||||
|
@ -47,7 +48,6 @@ pub fn errno() -> i32 {
|
|||
target_env = "newlib"),
|
||||
link_name = "__errno")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "___errno")]
|
||||
#[cfg_attr(target_os = "dragonfly", link_name = "__dfly_error")]
|
||||
#[cfg_attr(any(target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "freebsd"),
|
||||
|
@ -60,6 +60,16 @@ pub fn errno() -> i32 {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub fn errno() -> i32 {
|
||||
extern {
|
||||
#[thread_local]
|
||||
static errno: c_int;
|
||||
}
|
||||
|
||||
errno as i32
|
||||
}
|
||||
|
||||
/// Gets a detailed string description for the given error number.
|
||||
pub fn error_string(errno: i32) -> String {
|
||||
extern {
|
||||
|
|
|
@ -303,8 +303,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub type clock_t = libc::c_int;
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub type clock_t = libc::c_ulong;
|
||||
|
||||
impl Timespec {
|
||||
pub fn now(clock: libc::c_int) -> Timespec {
|
||||
pub fn now(clock: clock_t) -> Timespec {
|
||||
let mut t = Timespec {
|
||||
t: libc::timespec {
|
||||
tv_sec: 0,
|
||||
|
|
Loading…
Reference in a new issue