Remove nacl from libstd

This commit is contained in:
est31 2017-10-05 05:01:41 +02:00
parent b8fad2d219
commit aad1c998c7
10 changed files with 4 additions and 232 deletions

View File

@ -38,7 +38,6 @@ pub mod linux;
#[cfg(all(not(dox), target_os = "haiku"))] pub mod haiku;
#[cfg(all(not(dox), target_os = "ios"))] pub mod ios;
#[cfg(all(not(dox), target_os = "macos"))] pub mod macos;
#[cfg(all(not(dox), target_os = "nacl"))] pub mod nacl;
#[cfg(all(not(dox), target_os = "netbsd"))] pub mod netbsd;
#[cfg(all(not(dox), target_os = "openbsd"))] pub mod openbsd;
#[cfg(all(not(dox), target_os = "solaris"))] pub mod solaris;

View File

@ -1,128 +0,0 @@
// 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::nacl::raw;
/// OS-specific extension methods for `fs::Metadata`
#[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
}
}

View File

@ -1,16 +0,0 @@
// 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.
//! Nacl-specific definitions
#![stable(feature = "raw_ext", since = "1.1.0")]
pub mod raw;
pub mod fs;

View File

@ -1,56 +0,0 @@
// 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.
//! Nacl-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)]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_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 pid_t = i32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type uid_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type gid_t = u32;
#[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 blksize_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "pthread_t", since = "1.8.0")]
pub type pthread_t = usize;
#[repr(C)]
#[derive(Copy, 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_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: i64,
#[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: i64,
#[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: i64,
}

View File

@ -118,27 +118,6 @@ pub mod os {
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(all(target_os = "nacl", not(target_arch = "le32")))]
pub mod os {
pub const FAMILY: &'static str = "unix";
pub const OS: &'static str = "nacl";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".so";
pub const DLL_EXTENSION: &'static str = "so";
pub const EXE_SUFFIX: &'static str = ".nexe";
pub const EXE_EXTENSION: &'static str = "nexe";
}
#[cfg(all(target_os = "nacl", target_arch = "le32"))]
pub mod os {
pub const FAMILY: &'static str = "unix";
pub const OS: &'static str = "pnacl";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".pso";
pub const DLL_EXTENSION: &'static str = "pso";
pub const EXE_SUFFIX: &'static str = ".pexe";
pub const EXE_EXTENSION: &'static str = "pexe";
}
#[cfg(target_os = "haiku")]
pub mod os {
pub const FAMILY: &'static str = "unix";

View File

@ -22,7 +22,6 @@ use libc;
#[cfg(all(not(dox), target_os = "haiku"))] pub use os::haiku as platform;
#[cfg(all(not(dox), target_os = "ios"))] pub use os::ios as platform;
#[cfg(all(not(dox), target_os = "macos"))] pub use os::macos as platform;
#[cfg(all(not(dox), target_os = "nacl"))] pub use os::nacl as platform;
#[cfg(all(not(dox), target_os = "netbsd"))] pub use os::netbsd as platform;
#[cfg(all(not(dox), target_os = "openbsd"))] pub use os::openbsd as platform;
#[cfg(all(not(dox), target_os = "solaris"))] pub use os::solaris as platform;
@ -77,11 +76,11 @@ pub fn init() {
reset_sigpipe();
}
#[cfg(not(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia")))]
#[cfg(not(any(target_os = "emscripten", target_os="fuchsia")))]
unsafe fn reset_sigpipe() {
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != libc::SIG_ERR);
}
#[cfg(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia"))]
#[cfg(any(target_os = "emscripten", target_os="fuchsia"))]
unsafe fn reset_sigpipe() {}
}

View File

@ -483,12 +483,10 @@ pub fn home_dir() -> Option<PathBuf> {
#[cfg(any(target_os = "android",
target_os = "ios",
target_os = "nacl",
target_os = "emscripten"))]
unsafe fn fallback() -> Option<OsString> { None }
#[cfg(not(any(target_os = "android",
target_os = "ios",
target_os = "nacl",
target_os = "emscripten")))]
unsafe fn fallback() -> Option<OsString> {
let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {

View File

@ -464,7 +464,6 @@ mod tests {
// test from being flaky we ignore it on macOS.
#[test]
#[cfg_attr(target_os = "macos", ignore)]
#[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl.
// When run under our current QEMU emulation test suite this test fails,
// although the reason isn't very clear as to why. For now this test is
// ignored there.

View File

@ -184,8 +184,8 @@ impl Command {
*sys::os::environ() = envp.as_ptr();
}
// NaCl has no signal support.
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
// emscripten has no signal support.
#[cfg(not(any(target_os = "emscripten")))]
{
use mem;
// Reset signal handling so the child process starts in a

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(target_os = "nacl", allow(dead_code))]
/// Common code for printing the backtrace in the same way across the different
/// supported platforms.