FenrirWolf
7 years ago
committed by
GitHub
82 changed files with 3934 additions and 929 deletions
@ -0,0 +1,131 @@
@@ -0,0 +1,131 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::android::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_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; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Android-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,230 @@
@@ -0,0 +1,230 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Android-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = c_long; |
||||
|
||||
#[doc(inline)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; |
||||
|
||||
#[cfg(any(target_arch = "arm", target_arch = "x86"))] |
||||
mod arch { |
||||
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type mode_t = u32; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: c_ulonglong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad0: [c_uchar; 4], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __st_ino: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: c_uint, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: c_uint, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: c_ulonglong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad3: [c_uchar; 4], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: c_longlong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: c_ulonglong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: c_ulonglong, |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
#[cfg(target_arch = "aarch64")] |
||||
mod arch { |
||||
use os::raw::{c_uchar, c_ulong}; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type mode_t = u32; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad0: [c_uchar; 4], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __st_ino: ino_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: mode_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: nlink_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad3: [c_uchar; 4], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: off_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: blksize_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: blkcnt_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: ino_t, |
||||
} |
||||
} |
||||
|
||||
#[cfg(target_arch = "x86_64")] |
||||
mod arch { |
||||
use os::raw::{c_uint, c_long, c_ulong}; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type mode_t = u32; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type nlink_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: ino_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: c_uint, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_ulong, |
||||
__unused: [c_long; 3], |
||||
} |
||||
} |
||||
|
@ -0,0 +1,151 @@
@@ -0,0 +1,151 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::bitrig::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as 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 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Bitrig-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Bitrig-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: i64, |
||||
} |
@ -0,0 +1,146 @@
@@ -0,0 +1,146 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::dragonfly::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_lspare(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
fn st_lspare(&self) -> u32 { |
||||
self.as_inner().as_inner().st_lspare as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Dragonfly-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Dragonfly-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_lspare: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
} |
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::emscripten::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_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; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat64 |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Linux-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Emscripten-specific raw type definitions
|
||||
//! This is basically exactly the same as the linux definitions,
|
||||
//! except using the musl-specific stat64 structure in liblibc.
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::{c_long, c_short, c_uint, c_ulong}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = c_ulong; |
||||
|
||||
#[doc(inline)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad1: c_short, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __st_ino: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad2: c_uint, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
} |
@ -0,0 +1,156 @@
@@ -0,0 +1,156 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::freebsd::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_lspare(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as 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 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
fn st_lspare(&self) -> u32 { |
||||
self.as_inner().as_inner().st_lspare as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! FreeBSD-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! FreeBSD-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_lspare: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
#[cfg(target_arch = "x86")] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __unused: [u8; 8], |
||||
} |
@ -0,0 +1,105 @@
@@ -0,0 +1,105 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_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; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Fuchsia-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,270 @@
@@ -0,0 +1,270 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Fuchsia-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_ulong; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = c_ulong; |
||||
|
||||
#[doc(inline)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; |
||||
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "le32", |
||||
target_arch = "powerpc", |
||||
target_arch = "arm"))] |
||||
mod arch { |
||||
use os::raw::{c_long, c_short, c_uint}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad1: c_short, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __st_ino: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad2: c_uint, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
} |
||||
} |
||||
|
||||
#[cfg(target_arch = "mips")] |
||||
mod arch { |
||||
use os::raw::{c_long, c_ulong}; |
||||
|
||||
#[cfg(target_env = "musl")] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; |
||||
#[cfg(not(target_env = "musl"))] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[cfg(target_env = "musl")] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[cfg(not(target_env = "musl"))] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[cfg(target_env = "musl")] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[cfg(not(target_env = "musl"))] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_pad1: [c_long; 3], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: c_ulong, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_pad2: [c_long; 2], |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_pad5: [c_long; 14], |
||||
} |
||||
} |
||||
|
||||
#[cfg(target_arch = "mips64")] |
||||
mod arch { |
||||
pub use libc::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; |
||||
} |
||||
|
||||
#[cfg(target_arch = "aarch64")] |
||||
mod arch { |
||||
use os::raw::{c_long, c_int}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad1: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad2: c_int, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __unused: [c_int; 2], |
||||
} |
||||
} |
||||
|
||||
#[cfg(target_arch = "x86_64")] |
||||
mod arch { |
||||
use os::raw::{c_long, c_int}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __pad0: c_int, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __unused: [c_long; 3], |
||||
} |
||||
} |
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::haiku::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_crtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_crtime_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; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_crtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_crtime as i64 |
||||
} |
||||
fn st_crtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_crtime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Haiku-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Haiku-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::{c_long}; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
// Use the direct definition of usize, instead of uintptr_t like in libc
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = usize; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = i32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = i64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = i32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: ino_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: mode_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: nlink_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: off_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: blksize_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_crtime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_crtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_type: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: blkcnt_t, |
||||
} |
@ -0,0 +1,156 @@
@@ -0,0 +1,156 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::ios::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_lspare(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as 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 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
fn st_lspare(&self) -> u32 { |
||||
self.as_inner().as_inner().st_lspare as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! iOS-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! iOS-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_lspare: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_qspare: [i64; 2], |
||||
} |
@ -0,0 +1,162 @@
@@ -0,0 +1,162 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::macos::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_lspare(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_qspare(&self) -> [u64; 2]; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as 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 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
fn st_lspare(&self) -> u32 { |
||||
self.as_inner().as_inner().st_lspare as u32 |
||||
} |
||||
fn st_qspare(&self) -> [u64; 2] { |
||||
let qspare = self.as_inner().as_inner().st_qspare; |
||||
[qspare[0] as u64, qspare[1] as u64] |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! macOS-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! macOS-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u16, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_lspare: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_qspare: [i64; 2], |
||||
} |
@ -0,0 +1,151 @@
@@ -0,0 +1,151 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::netbsd::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atimensec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtimensec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctimensec 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_birthtimensec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! OpenBSD-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! NetBSD-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
st_spare: [u32; 2], |
||||
} |
@ -0,0 +1,151 @@
@@ -0,0 +1,151 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::openbsd::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[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; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_flags(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gen(&self) -> u32; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as 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 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
fn st_gen(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gen as u32 |
||||
} |
||||
fn st_flags(&self) -> u32 { |
||||
self.as_inner().as_inner().st_flags as u32 |
||||
} |
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! OpenBSD-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! OpenBSD-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = usize; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: u64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: i32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_flags: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gen: u32, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime: i64, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_birthtime_nsec: c_long, |
||||
} |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
Equivalent to C's `char` type. |
||||
|
||||
[C's `char` type] is completely unlike [Rust's `char` type]; while Rust's type represents a unicode scalar value, C's `char` type is just an ordinary integer. This type will always be either [`i8`] or [`u8`], as the type is defined as being one byte long. |
||||
|
||||
C chars are most commonly used to make C strings. Unlike Rust, where the length of a string is included alongside the string, C strings mark the end of a string with the character `'\0'`. See [`CStr`] for more information. |
||||
|
||||
[C's `char` type]: https://en.wikipedia.org/wiki/C_data_types#Basic_types |
||||
[Rust's `char` type]: ../../primitive.char.html |
||||
[`CStr`]: ../../ffi/struct.CStr.html |
||||
[`i8`]: ../../primitive.i8.html |
||||
[`u8`]: ../../primitive.u8.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `double` type. |
||||
|
||||
This type will almost always be [`f64`], which is guaranteed to be an [IEEE-754 double-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number with at least the precision of a [`float`], and it may be `f32` or something entirely different from the IEEE-754 standard. |
||||
|
||||
[IEEE-754 double-precision float]: https://en.wikipedia.org/wiki/IEEE_754 |
||||
[`float`]: type.c_float.html |
||||
[`f64`]: ../../primitive.f64.html |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Equivalent to C's `float` type. |
||||
|
||||
This type will almost always be [`f32`], which is guaranteed to be an [IEEE-754 single-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number, and it may have less precision than `f32` or not follow the IEEE-754 standard at all. |
||||
|
||||
[IEEE-754 single-precision float]: https://en.wikipedia.org/wiki/IEEE_754 |
||||
[`f32`]: ../../primitive.f32.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `signed int` (`int`) type. |
||||
|
||||
This type will almost always be [`i32`], but may differ on some esoteric systems. The C standard technically only requires that this type be a signed integer that is at least the size of a [`short`]; some systems define it as an [`i16`], for example. |
||||
|
||||
[`short`]: type.c_short.html |
||||
[`i32`]: ../../primitive.i32.html |
||||
[`i16`]: ../../primitive.i16.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `signed long` (`long`) type. |
||||
|
||||
This type will always be [`i32`] or [`i64`]. Most notably, many Linux-based systems assume an `i64`, but Windows assumes `i32`. The C standard technically only requires that this type be a signed integer that is at least 32 bits and at least the size of an [`int`], although in practice, no system would have a `long` that is neither an `i32` nor `i64`. |
||||
|
||||
[`int`]: type.c_int.html |
||||
[`i32`]: ../../primitive.i32.html |
||||
[`i64`]: ../../primitive.i64.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `signed long long` (`long long`) type. |
||||
|
||||
This type will almost always be [`i64`], but may differ on some systems. The C standard technically only requires that this type be a signed integer that is at least 64 bits and at least the size of a [`long`], although in practice, no system would have a `long long` that is not an `i64`, as most systems do not have a standardised [`i128`] type. |
||||
|
||||
[`long`]: type.c_int.html |
||||
[`i64`]: ../../primitive.i64.html |
||||
[`i128`]: ../../primitive.i128.html |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Equivalent to C's `signed char` type. |
||||
|
||||
This type will always be [`i8`], but is included for completeness. It is defined as being a signed integer the same size as a C [`char`]. |
||||
|
||||
[`char`]: type.c_char.html |
||||
[`i8`]: ../../primitive.i8.html |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Equivalent to C's `signed short` (`short`) type. |
||||
|
||||
This type will almost always be [`i16`], but may differ on some esoteric systems. The C standard technically only requires that this type be a signed integer with at least 16 bits; some systems may define it as `i32`, for example. |
||||
|
||||
[`char`]: type.c_char.html |
||||
[`i16`]: ../../primitive.i16.html |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Equivalent to C's `unsigned char` type. |
||||
|
||||
This type will always be [`u8`], but is included for completeness. It is defined as being an unsigned integer the same size as a C [`char`]. |
||||
|
||||
[`char`]: type.c_char.html |
||||
[`u8`]: ../../primitive.u8.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `unsigned int` type. |
||||
|
||||
This type will almost always be [`u32`], but may differ on some esoteric systems. The C standard technically only requires that this type be an unsigned integer with the same size as an [`int`]; some systems define it as a [`u16`], for example. |
||||
|
||||
[`int`]: type.c_int.html |
||||
[`u32`]: ../../primitive.u32.html |
||||
[`u16`]: ../../primitive.u16.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `unsigned long` type. |
||||
|
||||
This type will always be [`u32`] or [`u64`]. Most notably, many Linux-based systems assume an `u64`, but Windows assumes `u32`. The C standard technically only requires that this type be an unsigned integer with the size of a [`long`], although in practice, no system would have a `ulong` that is neither a `u32` nor `u64`. |
||||
|
||||
[`long`]: type.c_long.html |
||||
[`u32`]: ../../primitive.u32.html |
||||
[`u64`]: ../../primitive.u64.html |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
Equivalent to C's `unsigned long long` type. |
||||
|
||||
This type will almost always be [`u64`], but may differ on some systems. The C standard technically only requires that this type be an unsigned integer with the size of a [`long long`], although in practice, no system would have a `long long` that is not a `u64`, as most systems do not have a standardised [`u128`] type. |
||||
|
||||
[`long long`]: type.c_longlong.html |
||||
[`u64`]: ../../primitive.u64.html |
||||
[`u128`]: ../../primitive.u128.html |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Equivalent to C's `unsigned short` type. |
||||
|
||||
This type will almost always be [`u16`], but may differ on some esoteric systems. The C standard technically only requires that this type be an unsigned integer with the same size as a [`short`]. |
||||
|
||||
[`short`]: type.c_short.html |
||||
[`u16`]: ../../primitive.u16.html |
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![stable(feature = "metadata_ext", since = "1.1.0")] |
||||
|
||||
use libc; |
||||
|
||||
use fs::Metadata; |
||||
use sys_common::AsInner; |
||||
|
||||
#[allow(deprecated)] |
||||
use os::solaris::raw; |
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
pub trait MetadataExt { |
||||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \ |
||||
methods of this trait")] |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat; |
||||
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_dev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ino(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mode(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_nlink(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_uid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_gid(&self) -> u32; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_rdev(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_size(&self) -> u64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_atime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_mtime_nsec(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime(&self) -> i64; |
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")] |
||||
fn st_ctime_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; |
||||
} |
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")] |
||||
impl MetadataExt for Metadata { |
||||
#[allow(deprecated)] |
||||
fn as_raw_stat(&self) -> &raw::stat { |
||||
unsafe { |
||||
&*(self.as_inner().as_inner() as *const libc::stat |
||||
as *const raw::stat) |
||||
} |
||||
} |
||||
fn st_dev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_dev as u64 |
||||
} |
||||
fn st_ino(&self) -> u64 { |
||||
self.as_inner().as_inner().st_ino as u64 |
||||
} |
||||
fn st_mode(&self) -> u32 { |
||||
self.as_inner().as_inner().st_mode as u32 |
||||
} |
||||
fn st_nlink(&self) -> u64 { |
||||
self.as_inner().as_inner().st_nlink as u64 |
||||
} |
||||
fn st_uid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_uid as u32 |
||||
} |
||||
fn st_gid(&self) -> u32 { |
||||
self.as_inner().as_inner().st_gid as u32 |
||||
} |
||||
fn st_rdev(&self) -> u64 { |
||||
self.as_inner().as_inner().st_rdev as u64 |
||||
} |
||||
fn st_size(&self) -> u64 { |
||||
self.as_inner().as_inner().st_size as u64 |
||||
} |
||||
fn st_atime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime as i64 |
||||
} |
||||
fn st_atime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_atime_nsec as i64 |
||||
} |
||||
fn st_mtime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime as i64 |
||||
} |
||||
fn st_mtime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_mtime_nsec as i64 |
||||
} |
||||
fn st_ctime(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime as i64 |
||||
} |
||||
fn st_ctime_nsec(&self) -> i64 { |
||||
self.as_inner().as_inner().st_ctime_nsec as i64 |
||||
} |
||||
fn st_blksize(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blksize as u64 |
||||
} |
||||
fn st_blocks(&self) -> u64 { |
||||
self.as_inner().as_inner().st_blocks as u64 |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Solaris-specific definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
|
||||
pub mod raw; |
||||
pub mod fs; |
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Solaris-specific raw type definitions
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")] |
||||
#![rustc_deprecated(since = "1.8.0",
|
||||
reason = "these type aliases are no longer supported by \ |
||||
the standard library, the `libc` crate on \ |
||||
crates.io should be used instead for the correct \ |
||||
definitions")] |
||||
#![allow(deprecated)] |
||||
|
||||
use os::raw::c_long; |
||||
use os::unix::raw::{uid_t, gid_t}; |
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type fflags_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; |
||||
|
||||
#[stable(feature = "pthread_t", since = "1.8.0")] |
||||
pub type pthread_t = u32; |
||||
|
||||
#[repr(C)] |
||||
#[derive(Clone)] |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub struct stat { |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_dev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ino: ino_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mode: mode_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_nlink: nlink_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_uid: uid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_gid: gid_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_rdev: dev_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_size: off_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_atime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_mtime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime: time_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_ctime_nsec: c_long, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blksize: blksize_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub st_blocks: blkcnt_t, |
||||
#[stable(feature = "raw_ext", since = "1.1.0")] |
||||
pub __unused: [u8; 16] |
||||
} |
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate rand; |
||||
|
||||
use std::env::*; |
||||
use std::iter::repeat; |
||||
use std::ffi::{OsString, OsStr}; |
||||
|
||||
use rand::Rng; |
||||
|
||||
fn make_rand_name() -> OsString { |
||||
let mut rng = rand::thread_rng(); |
||||
let n = format!("TEST{}", rng.gen_ascii_chars().take(10) |
||||
.collect::<String>()); |
||||
let n = OsString::from(n); |
||||
assert!(var_os(&n).is_none()); |
||||
n |
||||
} |
||||
|
||||
fn eq(a: Option<OsString>, b: Option<&str>) { |
||||
assert_eq!(a.as_ref().map(|s| &**s), b.map(OsStr::new).map(|s| &*s)); |
||||
} |
||||
|
||||
#[test] |
||||
fn test_set_var() { |
||||
let n = make_rand_name(); |
||||
set_var(&n, "VALUE"); |
||||
eq(var_os(&n), Some("VALUE")); |
||||
} |
||||
|
||||
#[test] |
||||
fn test_remove_var() { |
||||
let n = make_rand_name(); |
||||
set_var(&n, "VALUE"); |
||||
remove_var(&n); |
||||
eq(var_os(&n), None); |
||||
} |
||||
|
||||
#[test] |
||||
fn test_set_var_overwrite() { |
||||
let n = make_rand_name(); |
||||
set_var(&n, "1"); |
||||
set_var(&n, "2"); |
||||
eq(var_os(&n), Some("2")); |
||||
set_var(&n, ""); |
||||
eq(var_os(&n), Some("")); |
||||
} |
||||
|
||||
#[test] |
||||
#[cfg_attr(target_os = "emscripten", ignore)] |
||||
fn test_var_big() { |
||||
let mut s = "".to_string(); |
||||
let mut i = 0; |
||||
while i < 100 { |
||||
s.push_str("aaaaaaaaaa"); |
||||
i += 1; |
||||
} |
||||
let n = make_rand_name(); |
||||
set_var(&n, &s); |
||||
eq(var_os(&n), Some(&s)); |
||||
} |
||||
|
||||
#[test] |
||||
#[cfg_attr(target_os = "emscripten", ignore)] |
||||
fn test_env_set_get_huge() { |
||||
let n = make_rand_name(); |
||||
let s = repeat("x").take(10000).collect::<String>(); |
||||
set_var(&n, &s); |
||||
eq(var_os(&n), Some(&s)); |
||||
remove_var(&n); |
||||
eq(var_os(&n), None); |
||||
} |
||||
|
||||
#[test] |
||||
fn test_env_set_var() { |
||||
let n = make_rand_name(); |
||||
|
||||
let mut e = vars_os(); |
||||
set_var(&n, "VALUE"); |
||||
assert!(!e.any(|(k, v)| { |
||||
&*k == &*n && &*v == "VALUE" |
||||
})); |
||||
|
||||
assert!(vars_os().any(|(k, v)| { |
||||
&*k == &*n && &*v == "VALUE" |
||||
})); |
||||
} |
Loading…
Reference in new issue