From e3910794961b820defedd909b11e69681803e0db Mon Sep 17 00:00:00 2001 From: Trevor Merrifield Date: Mon, 11 Sep 2017 20:02:44 -0400 Subject: Retain suid/sgid/sticky bits in Metadata.permissions Most users would expect set_permissions(Metadata.permissions()) to be non-destructive. While we can't guarantee this, we can at least pass the needed info to chmod. Also update the PermissionsExt documentation to disambiguate what it contains, and to refer to the underlying value as `st_mode` rather than its type `mode_t`. Closes #44147 --- src/libstd/sys/unix/ext/fs.rs | 4 ++-- src/libstd/sys/unix/fs.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index f44b9aa9615..96c0f4eab42 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -68,8 +68,8 @@ impl FileExt for fs::File { /// Unix-specific extensions to `Permissions` #[stable(feature = "fs_ext", since = "1.1.0")] pub trait PermissionsExt { - /// Returns the underlying raw `mode_t` bits that are the standard Unix - /// permissions for this file. + /// Returns the 12 least significant bits of `st_mode` which are the + /// standard Unix permissions for this file. /// /// # Examples /// diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 13112fc1fa5..e0ce02873f5 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -95,7 +95,7 @@ pub struct DirBuilder { mode: mode_t } impl FileAttr { pub fn size(&self) -> u64 { self.stat.st_size as u64 } pub fn perm(&self) -> FilePermissions { - FilePermissions { mode: (self.stat.st_mode as mode_t) & 0o777 } + FilePermissions { mode: (self.stat.st_mode as mode_t) & 0o7777 } } pub fn file_type(&self) -> FileType { -- cgit 1.4.1-3-g733a5 From 6ae9fc277287e4f207012ab65be24058f143d42d Mon Sep 17 00:00:00 2001 From: Trevor Merrifield Date: Sun, 17 Sep 2017 17:42:58 -0400 Subject: Remove st_mode mask --- src/libstd/sys/unix/ext/fs.rs | 4 ++-- src/libstd/sys/unix/fs.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 96c0f4eab42..3e631ad40ac 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -68,8 +68,8 @@ impl FileExt for fs::File { /// Unix-specific extensions to `Permissions` #[stable(feature = "fs_ext", since = "1.1.0")] pub trait PermissionsExt { - /// Returns the 12 least significant bits of `st_mode` which are the - /// standard Unix permissions for this file. + /// Returns the underlying raw `st_mode` bits that contain the standard + /// Unix permissions for this file. /// /// # Examples /// diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index e0ce02873f5..c4616c3b395 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -95,7 +95,7 @@ pub struct DirBuilder { mode: mode_t } impl FileAttr { pub fn size(&self) -> u64 { self.stat.st_size as u64 } pub fn perm(&self) -> FilePermissions { - FilePermissions { mode: (self.stat.st_mode as mode_t) & 0o7777 } + FilePermissions { mode: (self.stat.st_mode as mode_t) } } pub fn file_type(&self) -> FileType { -- cgit 1.4.1-3-g733a5 From 43cff131ddb0e34f7ebe361700dbd5c3c13519cb Mon Sep 17 00:00:00 2001 From: "P.Y. Laligand" Date: Fri, 15 Sep 2017 12:38:08 -0700 Subject: The Magenta kernel is now called Zircon. --- src/ci/docker/dist-fuchsia/build-toolchain.sh | 18 +- src/libstd/build.rs | 4 +- src/libstd/sys/unix/process/magenta.rs | 319 ------------------------- src/libstd/sys/unix/process/mod.rs | 2 +- src/libstd/sys/unix/process/process_fuchsia.rs | 76 +++--- src/libstd/sys/unix/process/zircon.rs | 319 +++++++++++++++++++++++++ src/libstd/sys/unix/rand.rs | 8 +- src/tools/tidy/src/deps.rs | 3 + 8 files changed, 376 insertions(+), 373 deletions(-) delete mode 100644 src/libstd/sys/unix/process/magenta.rs create mode 100644 src/libstd/sys/unix/process/zircon.rs (limited to 'src/libstd/sys') diff --git a/src/ci/docker/dist-fuchsia/build-toolchain.sh b/src/ci/docker/dist-fuchsia/build-toolchain.sh index 10b285a5466..86430b48127 100755 --- a/src/ci/docker/dist-fuchsia/build-toolchain.sh +++ b/src/ci/docker/dist-fuchsia/build-toolchain.sh @@ -16,7 +16,7 @@ source shared.sh # Download sources SRCS=( - "https://fuchsia.googlesource.com/magenta magenta d17073dc8de344ead3b65e8cc6a12280dec38c84" + "https://fuchsia.googlesource.com/zircon zircon d17073dc8de344ead3b65e8cc6a12280dec38c84" "https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025" "https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111" "https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b" @@ -51,7 +51,7 @@ cd llvm mkdir build cd build hide_output cmake -GNinja \ - -DFUCHSIA_SYSROOT=${PWD}/../../magenta/third_party/ulib/musl \ + -DFUCHSIA_SYSROOT=${PWD}/../../zircon/third_party/ulib/musl \ -DLLVM_ENABLE_LTO=OFF \ -DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \ -C ../tools/clang/cmake/caches/Fuchsia.cmake \ @@ -62,21 +62,21 @@ cd ../.. # Build sysroot rm -rf llvm/runtimes/compiler-rt -./magenta/scripts/download-toolchain +./zircon/scripts/download-toolchain build_sysroot() { local arch="$1" case "${arch}" in - x86_64) tgt="magenta-pc-x86-64" ;; - aarch64) tgt="magenta-qemu-arm64" ;; + x86_64) tgt="zircon-pc-x86-64" ;; + aarch64) tgt="zircon-qemu-arm64" ;; esac - hide_output make -C magenta -j$(getconf _NPROCESSORS_ONLN) $tgt + hide_output make -C zircon -j$(getconf _NPROCESSORS_ONLN) $tgt dst=/usr/local/${arch}-unknown-fuchsia mkdir -p $dst - cp -r magenta/build-${tgt}/sysroot/include $dst/ - cp -r magenta/build-${tgt}/sysroot/lib $dst/ + cp -r zircon/build-${tgt}/sysroot/include $dst/ + cp -r zircon/build-${tgt}/sysroot/lib $dst/ cd llvm mkdir build-runtimes-${arch} @@ -112,7 +112,7 @@ build_sysroot() { build_sysroot "x86_64" build_sysroot "aarch64" -rm -rf magenta llvm +rm -rf zircon llvm for arch in x86_64 aarch64; do for tool in clang clang++; do diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 19ea25fc7df..b8061665aa1 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -68,8 +68,8 @@ fn main() { if cfg!(feature = "backtrace") { println!("cargo:rustc-link-lib=backtrace"); } - println!("cargo:rustc-link-lib=magenta"); - println!("cargo:rustc-link-lib=mxio"); + println!("cargo:rustc-link-lib=zircon"); + println!("cargo:rustc-link-lib=fdio"); println!("cargo:rustc-link-lib=launchpad"); // for std::process } } diff --git a/src/libstd/sys/unix/process/magenta.rs b/src/libstd/sys/unix/process/magenta.rs deleted file mode 100644 index bc20a74f114..00000000000 --- a/src/libstd/sys/unix/process/magenta.rs +++ /dev/null @@ -1,319 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(non_camel_case_types)] - -use convert::TryInto; -use io; -use os::raw::c_char; -use u64; - -use libc::{c_int, c_void}; - -pub type mx_handle_t = i32; -pub type mx_vaddr_t = usize; -pub type mx_rights_t = u32; -pub type mx_status_t = i32; - -pub type mx_size_t = usize; - -pub const MX_HANDLE_INVALID: mx_handle_t = 0; - -pub type mx_time_t = u64; -pub const MX_TIME_INFINITE : mx_time_t = u64::MAX; - -pub type mx_signals_t = u32; - -pub const MX_OBJECT_SIGNAL_3 : mx_signals_t = 1 << 3; - -pub const MX_TASK_TERMINATED : mx_signals_t = MX_OBJECT_SIGNAL_3; - -pub const MX_RIGHT_SAME_RIGHTS : mx_rights_t = 1 << 31; - -pub type mx_object_info_topic_t = u32; - -pub const MX_INFO_PROCESS : mx_object_info_topic_t = 3; - -pub fn mx_cvt(t: T) -> io::Result where T: TryInto+Copy { - if let Ok(status) = TryInto::try_into(t) { - if status < 0 { - Err(io::Error::from_raw_os_error(status)) - } else { - Ok(t) - } - } else { - Err(io::Error::last_os_error()) - } -} - -// Safe wrapper around mx_handle_t -pub struct Handle { - raw: mx_handle_t, -} - -impl Handle { - pub fn new(raw: mx_handle_t) -> Handle { - Handle { - raw, - } - } - - pub fn raw(&self) -> mx_handle_t { - self.raw - } -} - -impl Drop for Handle { - fn drop(&mut self) { - unsafe { mx_cvt(mx_handle_close(self.raw)).expect("Failed to close mx_handle_t"); } - } -} - -// Common MX_INFO header -#[derive(Default)] -#[repr(C)] -pub struct mx_info_header_t { - pub topic: u32, // identifies the info struct - pub avail_topic_size: u16, // “native” size of the struct - pub topic_size: u16, // size of the returned struct (<=topic_size) - pub avail_count: u32, // number of records the kernel has - pub count: u32, // number of records returned (limited by buffer size) -} - -#[derive(Default)] -#[repr(C)] -pub struct mx_record_process_t { - pub return_code: c_int, -} - -// Returned for topic MX_INFO_PROCESS -#[derive(Default)] -#[repr(C)] -pub struct mx_info_process_t { - pub hdr: mx_info_header_t, - pub rec: mx_record_process_t, -} - -extern { - pub fn mx_job_default() -> mx_handle_t; - - pub fn mx_task_kill(handle: mx_handle_t) -> mx_status_t; - - pub fn mx_handle_close(handle: mx_handle_t) -> mx_status_t; - - pub fn mx_handle_duplicate(handle: mx_handle_t, rights: mx_rights_t, - out: *const mx_handle_t) -> mx_handle_t; - - pub fn mx_object_wait_one(handle: mx_handle_t, signals: mx_signals_t, timeout: mx_time_t, - pending: *mut mx_signals_t) -> mx_status_t; - - pub fn mx_object_get_info(handle: mx_handle_t, topic: u32, buffer: *mut c_void, - buffer_size: mx_size_t, actual_size: *mut mx_size_t, - avail: *mut mx_size_t) -> mx_status_t; -} - -// From `enum special_handles` in system/ulib/launchpad/launchpad.c -// HND_LOADER_SVC = 0 -// HND_EXEC_VMO = 1 -pub const HND_SPECIAL_COUNT: usize = 2; - -#[repr(C)] -pub struct launchpad_t { - argc: u32, - envc: u32, - args: *const c_char, - args_len: usize, - env: *const c_char, - env_len: usize, - - handles: *mut mx_handle_t, - handles_info: *mut u32, - handle_count: usize, - handle_alloc: usize, - - entry: mx_vaddr_t, - base: mx_vaddr_t, - vdso_base: mx_vaddr_t, - - stack_size: usize, - - special_handles: [mx_handle_t; HND_SPECIAL_COUNT], - loader_message: bool, -} - -extern { - pub fn launchpad_create(job: mx_handle_t, name: *const c_char, - lp: *mut *mut launchpad_t) -> mx_status_t; - - pub fn launchpad_go(lp: *mut launchpad_t, - proc_handle: *mut mx_handle_t, - err_msg: *mut *const c_char) -> mx_status_t; - - pub fn launchpad_destroy(lp: *mut launchpad_t); - - pub fn launchpad_set_args(lp: *mut launchpad_t, argc: c_int, - argv: *const *const c_char) -> mx_status_t; - - pub fn launchpad_set_environ(lp: *mut launchpad_t, envp: *const *const c_char) -> mx_status_t; - - pub fn launchpad_clone(lp: *mut launchpad_t, what: u32) -> mx_status_t; - - pub fn launchpad_clone_fd(lp: *mut launchpad_t, fd: c_int, target_fd: c_int) -> mx_status_t; - - pub fn launchpad_transfer_fd(lp: *mut launchpad_t, fd: c_int, target_fd: c_int) -> mx_status_t; - - pub fn launchpad_elf_load(lp: *mut launchpad_t, vmo: mx_handle_t) -> mx_status_t; - - pub fn launchpad_add_vdso_vmo(lp: *mut launchpad_t) -> mx_status_t; - - pub fn launchpad_load_vdso(lp: *mut launchpad_t, vmo: mx_handle_t) -> mx_status_t; - - pub fn launchpad_vmo_from_file(filename: *const c_char) -> mx_handle_t; -} - -// Launchpad clone constants - -pub const LP_CLONE_MXIO_ROOT: u32 = 0x0001; -pub const LP_CLONE_MXIO_CWD: u32 = 0x0002; -// LP_CLONE_MXIO_STDIO = 0x0004 -// LP_CLONE_MXIO_ALL = 0x00FF -// LP_CLONE_ENVIRON = 0x0100 -// LP_CLONE_DEFAULT_JOB = 0x0200 -// LP_CLONE_ALL = 0xFFFF - -// Errors - -#[allow(unused)] pub const ERR_INTERNAL: mx_status_t = -1; - -// ERR_NOT_SUPPORTED: The operation is not implemented, supported, -// or enabled. -#[allow(unused)] pub const ERR_NOT_SUPPORTED: mx_status_t = -2; - -// ERR_NO_RESOURCES: The system was not able to allocate some resource -// needed for the operation. -#[allow(unused)] pub const ERR_NO_RESOURCES: mx_status_t = -3; - -// ERR_NO_MEMORY: The system was not able to allocate memory needed -// for the operation. -#[allow(unused)] pub const ERR_NO_MEMORY: mx_status_t = -4; - -// ERR_CALL_FAILED: The second phase of mx_channel_call(; did not complete -// successfully. -#[allow(unused)] pub const ERR_CALL_FAILED: mx_status_t = -5; - -// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be -// retried. This should not be seen outside of the VDSO. -#[allow(unused)] pub const ERR_INTERRUPTED_RETRY: mx_status_t = -6; - -// ======= Parameter errors ======= -// ERR_INVALID_ARGS: an argument is invalid, ex. null pointer -#[allow(unused)] pub const ERR_INVALID_ARGS: mx_status_t = -10; - -// ERR_BAD_HANDLE: A specified handle value does not refer to a handle. -#[allow(unused)] pub const ERR_BAD_HANDLE: mx_status_t = -11; - -// ERR_WRONG_TYPE: The subject of the operation is the wrong type to -// perform the operation. -// Example: Attempting a message_read on a thread handle. -#[allow(unused)] pub const ERR_WRONG_TYPE: mx_status_t = -12; - -// ERR_BAD_SYSCALL: The specified syscall number is invalid. -#[allow(unused)] pub const ERR_BAD_SYSCALL: mx_status_t = -13; - -// ERR_OUT_OF_RANGE: An argument is outside the valid range for this -// operation. -#[allow(unused)] pub const ERR_OUT_OF_RANGE: mx_status_t = -14; - -// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for -// this operation. -#[allow(unused)] pub const ERR_BUFFER_TOO_SMALL: mx_status_t = -15; - -// ======= Precondition or state errors ======= -// ERR_BAD_STATE: operation failed because the current state of the -// object does not allow it, or a precondition of the operation is -// not satisfied -#[allow(unused)] pub const ERR_BAD_STATE: mx_status_t = -20; - -// ERR_TIMED_OUT: The time limit for the operation elapsed before -// the operation completed. -#[allow(unused)] pub const ERR_TIMED_OUT: mx_status_t = -21; - -// ERR_SHOULD_WAIT: The operation cannot be performed currently but -// potentially could succeed if the caller waits for a prerequisite -// to be satisfied, for example waiting for a handle to be readable -// or writable. -// Example: Attempting to read from a message pipe that has no -// messages waiting but has an open remote will return ERR_SHOULD_WAIT. -// Attempting to read from a message pipe that has no messages waiting -// and has a closed remote end will return ERR_REMOTE_CLOSED. -#[allow(unused)] pub const ERR_SHOULD_WAIT: mx_status_t = -22; - -// ERR_CANCELED: The in-progress operation (e.g. a wait) has been -// // canceled. -#[allow(unused)] pub const ERR_CANCELED: mx_status_t = -23; - -// ERR_PEER_CLOSED: The operation failed because the remote end -// of the subject of the operation was closed. -#[allow(unused)] pub const ERR_PEER_CLOSED: mx_status_t = -24; - -// ERR_NOT_FOUND: The requested entity is not found. -#[allow(unused)] pub const ERR_NOT_FOUND: mx_status_t = -25; - -// ERR_ALREADY_EXISTS: An object with the specified identifier -// already exists. -// Example: Attempting to create a file when a file already exists -// with that name. -#[allow(unused)] pub const ERR_ALREADY_EXISTS: mx_status_t = -26; - -// ERR_ALREADY_BOUND: The operation failed because the named entity -// is already owned or controlled by another entity. The operation -// could succeed later if the current owner releases the entity. -#[allow(unused)] pub const ERR_ALREADY_BOUND: mx_status_t = -27; - -// ERR_UNAVAILABLE: The subject of the operation is currently unable -// to perform the operation. -// Note: This is used when there's no direct way for the caller to -// observe when the subject will be able to perform the operation -// and should thus retry. -#[allow(unused)] pub const ERR_UNAVAILABLE: mx_status_t = -28; - -// ======= Permission check errors ======= -// ERR_ACCESS_DENIED: The caller did not have permission to perform -// the specified operation. -#[allow(unused)] pub const ERR_ACCESS_DENIED: mx_status_t = -30; - -// ======= Input-output errors ======= -// ERR_IO: Otherwise unspecified error occurred during I/O. -#[allow(unused)] pub const ERR_IO: mx_status_t = -40; - -// ERR_REFUSED: The entity the I/O operation is being performed on -// rejected the operation. -// Example: an I2C device NAK'ing a transaction or a disk controller -// rejecting an invalid command. -#[allow(unused)] pub const ERR_IO_REFUSED: mx_status_t = -41; - -// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity -// check and is possibly corrupted. -// Example: CRC or Parity error. -#[allow(unused)] pub const ERR_IO_DATA_INTEGRITY: mx_status_t = -42; - -// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable -// and may be permanently lost. -// Example: A disk block is irrecoverably damaged. -#[allow(unused)] pub const ERR_IO_DATA_LOSS: mx_status_t = -43; - -// Filesystem specific errors -#[allow(unused)] pub const ERR_BAD_PATH: mx_status_t = -50; -#[allow(unused)] pub const ERR_NOT_DIR: mx_status_t = -51; -#[allow(unused)] pub const ERR_NOT_FILE: mx_status_t = -52; -// ERR_FILE_BIG: A file exceeds a filesystem-specific size limit. -#[allow(unused)] pub const ERR_FILE_BIG: mx_status_t = -53; -// ERR_NO_SPACE: Filesystem or device space is exhausted. -#[allow(unused)] pub const ERR_NO_SPACE: mx_status_t = -54; diff --git a/src/libstd/sys/unix/process/mod.rs b/src/libstd/sys/unix/process/mod.rs index b50384d8eee..2a331069bc2 100644 --- a/src/libstd/sys/unix/process/mod.rs +++ b/src/libstd/sys/unix/process/mod.rs @@ -19,4 +19,4 @@ mod process_inner; #[path = "process_fuchsia.rs"] mod process_inner; #[cfg(target_os = "fuchsia")] -mod magenta; +mod zircon; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 7d583cb3dfc..1a7f544f8e9 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -13,7 +13,7 @@ use libc; use mem; use ptr; -use sys::process::magenta::{Handle, mx_handle_t}; +use sys::process::zircon::{Handle, zx_handle_t}; use sys::process::process_common::*; //////////////////////////////////////////////////////////////////////////////// @@ -51,10 +51,10 @@ impl Command { } unsafe fn do_exec(&mut self, stdio: ChildPipes) - -> io::Result { - use sys::process::magenta::*; + -> io::Result { + use sys::process::zircon::*; - let job_handle = mx_job_default(); + let job_handle = zx_job_default(); let envp = match *self.get_envp() { Some(ref envp) => envp.as_ptr(), None => ptr::null(), @@ -67,39 +67,39 @@ impl Command { } // Duplicate the job handle - let mut job_copy: mx_handle_t = MX_HANDLE_INVALID; - mx_cvt(mx_handle_duplicate(job_handle, MX_RIGHT_SAME_RIGHTS, &mut job_copy))?; + let mut job_copy: zx_handle_t = zx_HANDLE_INVALID; + zx_cvt(zx_handle_duplicate(job_handle, zx_RIGHT_SAME_RIGHTS, &mut job_copy))?; // Create a launchpad let mut launchpad: *mut launchpad_t = ptr::null_mut(); - mx_cvt(launchpad_create(job_copy, self.get_argv()[0], &mut launchpad))?; + zx_cvt(launchpad_create(job_copy, self.get_argv()[0], &mut launchpad))?; let launchpad_destructor = LaunchpadDestructor(launchpad); // Set the process argv - mx_cvt(launchpad_set_args(launchpad, self.get_argv().len() as i32 - 1, + zx_cvt(launchpad_set_args(launchpad, self.get_argv().len() as i32 - 1, self.get_argv().as_ptr()))?; // Setup the environment vars - mx_cvt(launchpad_set_environ(launchpad, envp))?; - mx_cvt(launchpad_add_vdso_vmo(launchpad))?; + zx_cvt(launchpad_set_environ(launchpad, envp))?; + zx_cvt(launchpad_add_vdso_vmo(launchpad))?; // Load the executable - mx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?; - mx_cvt(launchpad_load_vdso(launchpad, MX_HANDLE_INVALID))?; - mx_cvt(launchpad_clone(launchpad, LP_CLONE_MXIO_ROOT | LP_CLONE_MXIO_CWD))?; + zx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?; + zx_cvt(launchpad_load_vdso(launchpad, zx_HANDLE_INVALID))?; + zx_cvt(launchpad_clone(launchpad, LP_CLONE_FDIO_ROOT | LP_CLONE_FDIO_CWD))?; // Clone stdin, stdout, and stderr if let Some(fd) = stdio.stdin.fd() { - mx_cvt(launchpad_transfer_fd(launchpad, fd, 0))?; + zx_cvt(launchpad_transfer_fd(launchpad, fd, 0))?; } else { - mx_cvt(launchpad_clone_fd(launchpad, 0, 0))?; + zx_cvt(launchpad_clone_fd(launchpad, 0, 0))?; } if let Some(fd) = stdio.stdout.fd() { - mx_cvt(launchpad_transfer_fd(launchpad, fd, 1))?; + zx_cvt(launchpad_transfer_fd(launchpad, fd, 1))?; } else { - mx_cvt(launchpad_clone_fd(launchpad, 1, 1))?; + zx_cvt(launchpad_clone_fd(launchpad, 1, 1))?; } if let Some(fd) = stdio.stderr.fd() { - mx_cvt(launchpad_transfer_fd(launchpad, fd, 2))?; + zx_cvt(launchpad_transfer_fd(launchpad, fd, 2))?; } else { - mx_cvt(launchpad_clone_fd(launchpad, 2, 2))?; + zx_cvt(launchpad_clone_fd(launchpad, 2, 2))?; } // We don't want FileDesc::drop to be called on any stdio. It would close their fds. The @@ -113,9 +113,9 @@ impl Command { // `launchpad_go` destroys the launchpad, so we must not mem::forget(launchpad_destructor); - let mut process_handle: mx_handle_t = 0; + let mut process_handle: zx_handle_t = 0; let mut err_msg: *const libc::c_char = ptr::null(); - mx_cvt(launchpad_go(launchpad, &mut process_handle, &mut err_msg))?; + zx_cvt(launchpad_go(launchpad, &mut process_handle, &mut err_msg))?; // FIXME: See if we want to do something with that err_msg Ok(process_handle) @@ -136,27 +136,27 @@ impl Process { } pub fn kill(&mut self) -> io::Result<()> { - use sys::process::magenta::*; + use sys::process::zircon::*; - unsafe { mx_cvt(mx_task_kill(self.handle.raw()))?; } + unsafe { zx_cvt(zx_task_kill(self.handle.raw()))?; } Ok(()) } pub fn wait(&mut self) -> io::Result { use default::Default; - use sys::process::magenta::*; + use sys::process::zircon::*; - let mut proc_info: mx_info_process_t = Default::default(); - let mut actual: mx_size_t = 0; - let mut avail: mx_size_t = 0; + let mut proc_info: zx_info_process_t = Default::default(); + let mut actual: zx_size_t = 0; + let mut avail: zx_size_t = 0; unsafe { - mx_cvt(mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED, - MX_TIME_INFINITE, ptr::null_mut()))?; - mx_cvt(mx_object_get_info(self.handle.raw(), MX_INFO_PROCESS, + zx_cvt(zx_object_wait_one(self.handle.raw(), zx_TASK_TERMINATED, + zx_TIME_INFINITE, ptr::null_mut()))?; + zx_cvt(zx_object_get_info(self.handle.raw(), zx_INFO_PROCESS, &mut proc_info as *mut _ as *mut libc::c_void, - mem::size_of::(), &mut actual, + mem::size_of::(), &mut actual, &mut avail))?; } if actual != 1 { @@ -168,14 +168,14 @@ impl Process { pub fn try_wait(&mut self) -> io::Result> { use default::Default; - use sys::process::magenta::*; + use sys::process::zircon::*; - let mut proc_info: mx_info_process_t = Default::default(); - let mut actual: mx_size_t = 0; - let mut avail: mx_size_t = 0; + let mut proc_info: zx_info_process_t = Default::default(); + let mut actual: zx_size_t = 0; + let mut avail: zx_size_t = 0; unsafe { - let status = mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED, + let status = zx_object_wait_one(self.handle.raw(), zx_TASK_TERMINATED, 0, ptr::null_mut()); match status { 0 => { }, // Success @@ -184,9 +184,9 @@ impl Process { }, _ => { panic!("Failed to wait on process handle: {}", status); }, } - mx_cvt(mx_object_get_info(self.handle.raw(), MX_INFO_PROCESS, + zx_cvt(zx_object_get_info(self.handle.raw(), zx_INFO_PROCESS, &mut proc_info as *mut _ as *mut libc::c_void, - mem::size_of::(), &mut actual, + mem::size_of::(), &mut actual, &mut avail))?; } if actual != 1 { diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs new file mode 100644 index 00000000000..4dbcdb57663 --- /dev/null +++ b/src/libstd/sys/unix/process/zircon.rs @@ -0,0 +1,319 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_camel_case_types)] + +use convert::TryInto; +use io; +use os::raw::c_char; +use u64; + +use libc::{c_int, c_void}; + +pub type zx_handle_t = i32; +pub type zx_vaddr_t = usize; +pub type zx_rights_t = u32; +pub type zx_status_t = i32; + +pub type zx_size_t = usize; + +pub const zx_HANDLE_INVALID: zx_handle_t = 0; + +pub type zx_time_t = u64; +pub const zx_TIME_INFINITE : zx_time_t = u64::MAX; + +pub type zx_signals_t = u32; + +pub const zx_OBJECT_SIGNAL_3 : zx_signals_t = 1 << 3; + +pub const zx_TASK_TERMINATED : zx_signals_t = zx_OBJECT_SIGNAL_3; + +pub const zx_RIGHT_SAME_RIGHTS : zx_rights_t = 1 << 31; + +pub type zx_object_info_topic_t = u32; + +pub const zx_INFO_PROCESS : zx_object_info_topic_t = 3; + +pub fn zx_cvt(t: T) -> io::Result where T: TryInto+Copy { + if let Ok(status) = TryInto::try_into(t) { + if status < 0 { + Err(io::Error::from_raw_os_error(status)) + } else { + Ok(t) + } + } else { + Err(io::Error::last_os_error()) + } +} + +// Safe wrapper around zx_handle_t +pub struct Handle { + raw: zx_handle_t, +} + +impl Handle { + pub fn new(raw: zx_handle_t) -> Handle { + Handle { + raw, + } + } + + pub fn raw(&self) -> zx_handle_t { + self.raw + } +} + +impl Drop for Handle { + fn drop(&mut self) { + unsafe { zx_cvt(zx_handle_close(self.raw)).expect("Failed to close zx_handle_t"); } + } +} + +// Common zx_INFO header +#[derive(Default)] +#[repr(C)] +pub struct zx_info_header_t { + pub topic: u32, // identifies the info struct + pub avail_topic_size: u16, // “native” size of the struct + pub topic_size: u16, // size of the returned struct (<=topic_size) + pub avail_count: u32, // number of records the kernel has + pub count: u32, // number of records returned (limited by buffer size) +} + +#[derive(Default)] +#[repr(C)] +pub struct zx_record_process_t { + pub return_code: c_int, +} + +// Returned for topic zx_INFO_PROCESS +#[derive(Default)] +#[repr(C)] +pub struct zx_info_process_t { + pub hdr: zx_info_header_t, + pub rec: zx_record_process_t, +} + +extern { + pub fn zx_job_default() -> zx_handle_t; + + pub fn zx_task_kill(handle: zx_handle_t) -> zx_status_t; + + pub fn zx_handle_close(handle: zx_handle_t) -> zx_status_t; + + pub fn zx_handle_duplicate(handle: zx_handle_t, rights: zx_rights_t, + out: *const zx_handle_t) -> zx_handle_t; + + pub fn zx_object_wait_one(handle: zx_handle_t, signals: zx_signals_t, timeout: zx_time_t, + pending: *mut zx_signals_t) -> zx_status_t; + + pub fn zx_object_get_info(handle: zx_handle_t, topic: u32, buffer: *mut c_void, + buffer_size: zx_size_t, actual_size: *mut zx_size_t, + avail: *mut zx_size_t) -> zx_status_t; +} + +// From `enum special_handles` in system/ulib/launchpad/launchpad.c +// HND_LOADER_SVC = 0 +// HND_EXEC_VMO = 1 +pub const HND_SPECIAL_COUNT: usize = 2; + +#[repr(C)] +pub struct launchpad_t { + argc: u32, + envc: u32, + args: *const c_char, + args_len: usize, + env: *const c_char, + env_len: usize, + + handles: *mut zx_handle_t, + handles_info: *mut u32, + handle_count: usize, + handle_alloc: usize, + + entry: zx_vaddr_t, + base: zx_vaddr_t, + vdso_base: zx_vaddr_t, + + stack_size: usize, + + special_handles: [zx_handle_t; HND_SPECIAL_COUNT], + loader_message: bool, +} + +extern { + pub fn launchpad_create(job: zx_handle_t, name: *const c_char, + lp: *mut *mut launchpad_t) -> zx_status_t; + + pub fn launchpad_go(lp: *mut launchpad_t, + proc_handle: *mut zx_handle_t, + err_msg: *mut *const c_char) -> zx_status_t; + + pub fn launchpad_destroy(lp: *mut launchpad_t); + + pub fn launchpad_set_args(lp: *mut launchpad_t, argc: c_int, + argv: *const *const c_char) -> zx_status_t; + + pub fn launchpad_set_environ(lp: *mut launchpad_t, envp: *const *const c_char) -> zx_status_t; + + pub fn launchpad_clone(lp: *mut launchpad_t, what: u32) -> zx_status_t; + + pub fn launchpad_clone_fd(lp: *mut launchpad_t, fd: c_int, target_fd: c_int) -> zx_status_t; + + pub fn launchpad_transfer_fd(lp: *mut launchpad_t, fd: c_int, target_fd: c_int) -> zx_status_t; + + pub fn launchpad_elf_load(lp: *mut launchpad_t, vmo: zx_handle_t) -> zx_status_t; + + pub fn launchpad_add_vdso_vmo(lp: *mut launchpad_t) -> zx_status_t; + + pub fn launchpad_load_vdso(lp: *mut launchpad_t, vmo: zx_handle_t) -> zx_status_t; + + pub fn launchpad_vmo_from_file(filename: *const c_char) -> zx_handle_t; +} + +// Launchpad clone constants + +pub const LP_CLONE_FDIO_ROOT: u32 = 0x0001; +pub const LP_CLONE_FDIO_CWD: u32 = 0x0002; +// LP_CLONE_FDIO_STDIO = 0x0004 +// LP_CLONE_FDIO_ALL = 0x00FF +// LP_CLONE_ENVIRON = 0x0100 +// LP_CLONE_DEFAULT_JOB = 0x0200 +// LP_CLONE_ALL = 0xFFFF + +// Errors + +#[allow(unused)] pub const ERR_INTERNAL: zx_status_t = -1; + +// ERR_NOT_SUPPORTED: The operation is not implemented, supported, +// or enabled. +#[allow(unused)] pub const ERR_NOT_SUPPORTED: zx_status_t = -2; + +// ERR_NO_RESOURCES: The system was not able to allocate some resource +// needed for the operation. +#[allow(unused)] pub const ERR_NO_RESOURCES: zx_status_t = -3; + +// ERR_NO_MEMORY: The system was not able to allocate memory needed +// for the operation. +#[allow(unused)] pub const ERR_NO_MEMORY: zx_status_t = -4; + +// ERR_CALL_FAILED: The second phase of zx_channel_call(; did not complete +// successfully. +#[allow(unused)] pub const ERR_CALL_FAILED: zx_status_t = -5; + +// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be +// retried. This should not be seen outside of the VDSO. +#[allow(unused)] pub const ERR_INTERRUPTED_RETRY: zx_status_t = -6; + +// ======= Parameter errors ======= +// ERR_INVALID_ARGS: an argument is invalid, ex. null pointer +#[allow(unused)] pub const ERR_INVALID_ARGS: zx_status_t = -10; + +// ERR_BAD_HANDLE: A specified handle value does not refer to a handle. +#[allow(unused)] pub const ERR_BAD_HANDLE: zx_status_t = -11; + +// ERR_WRONG_TYPE: The subject of the operation is the wrong type to +// perform the operation. +// Example: Attempting a message_read on a thread handle. +#[allow(unused)] pub const ERR_WRONG_TYPE: zx_status_t = -12; + +// ERR_BAD_SYSCALL: The specified syscall number is invalid. +#[allow(unused)] pub const ERR_BAD_SYSCALL: zx_status_t = -13; + +// ERR_OUT_OF_RANGE: An argument is outside the valid range for this +// operation. +#[allow(unused)] pub const ERR_OUT_OF_RANGE: zx_status_t = -14; + +// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for +// this operation. +#[allow(unused)] pub const ERR_BUFFER_TOO_SMALL: zx_status_t = -15; + +// ======= Precondition or state errors ======= +// ERR_BAD_STATE: operation failed because the current state of the +// object does not allow it, or a precondition of the operation is +// not satisfied +#[allow(unused)] pub const ERR_BAD_STATE: zx_status_t = -20; + +// ERR_TIMED_OUT: The time limit for the operation elapsed before +// the operation completed. +#[allow(unused)] pub const ERR_TIMED_OUT: zx_status_t = -21; + +// ERR_SHOULD_WAIT: The operation cannot be performed currently but +// potentially could succeed if the caller waits for a prerequisite +// to be satisfied, for example waiting for a handle to be readable +// or writable. +// Example: Attempting to read from a message pipe that has no +// messages waiting but has an open remote will return ERR_SHOULD_WAIT. +// Attempting to read from a message pipe that has no messages waiting +// and has a closed remote end will return ERR_REMOTE_CLOSED. +#[allow(unused)] pub const ERR_SHOULD_WAIT: zx_status_t = -22; + +// ERR_CANCELED: The in-progress operation (e.g. a wait) has been +// // canceled. +#[allow(unused)] pub const ERR_CANCELED: zx_status_t = -23; + +// ERR_PEER_CLOSED: The operation failed because the remote end +// of the subject of the operation was closed. +#[allow(unused)] pub const ERR_PEER_CLOSED: zx_status_t = -24; + +// ERR_NOT_FOUND: The requested entity is not found. +#[allow(unused)] pub const ERR_NOT_FOUND: zx_status_t = -25; + +// ERR_ALREADY_EXISTS: An object with the specified identifier +// already exists. +// Example: Attempting to create a file when a file already exists +// with that name. +#[allow(unused)] pub const ERR_ALREADY_EXISTS: zx_status_t = -26; + +// ERR_ALREADY_BOUND: The operation failed because the named entity +// is already owned or controlled by another entity. The operation +// could succeed later if the current owner releases the entity. +#[allow(unused)] pub const ERR_ALREADY_BOUND: zx_status_t = -27; + +// ERR_UNAVAILABLE: The subject of the operation is currently unable +// to perform the operation. +// Note: This is used when there's no direct way for the caller to +// observe when the subject will be able to perform the operation +// and should thus retry. +#[allow(unused)] pub const ERR_UNAVAILABLE: zx_status_t = -28; + +// ======= Permission check errors ======= +// ERR_ACCESS_DENIED: The caller did not have permission to perform +// the specified operation. +#[allow(unused)] pub const ERR_ACCESS_DENIED: zx_status_t = -30; + +// ======= Input-output errors ======= +// ERR_IO: Otherwise unspecified error occurred during I/O. +#[allow(unused)] pub const ERR_IO: zx_status_t = -40; + +// ERR_REFUSED: The entity the I/O operation is being performed on +// rejected the operation. +// Example: an I2C device NAK'ing a transaction or a disk controller +// rejecting an invalid command. +#[allow(unused)] pub const ERR_IO_REFUSED: zx_status_t = -41; + +// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity +// check and is possibly corrupted. +// Example: CRC or Parity error. +#[allow(unused)] pub const ERR_IO_DATA_INTEGRITY: zx_status_t = -42; + +// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable +// and may be permanently lost. +// Example: A disk block is irrecoverably damaged. +#[allow(unused)] pub const ERR_IO_DATA_LOSS: zx_status_t = -43; + +// Filesystem specific errors +#[allow(unused)] pub const ERR_BAD_PATH: zx_status_t = -50; +#[allow(unused)] pub const ERR_NOT_DIR: zx_status_t = -51; +#[allow(unused)] pub const ERR_NOT_FILE: zx_status_t = -52; +// ERR_FILE_BIG: A file exceeds a filesystem-specific size limit. +#[allow(unused)] pub const ERR_FILE_BIG: zx_status_t = -53; +// ERR_NO_SPACE: Filesystem or device space is exhausted. +#[allow(unused)] pub const ERR_NO_SPACE: zx_status_t = -54; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 1f56a299407..fd066c9cdbe 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -344,15 +344,15 @@ mod imp { use io; use rand::Rng; - #[link(name = "magenta")] + #[link(name = "zircon")] extern { - fn mx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32; + fn zx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32; } fn getrandom(buf: &mut [u8]) -> Result { unsafe { let mut actual = 0; - let status = mx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual); + let status = zx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual); if status == 0 { Ok(actual) } else { @@ -387,7 +387,7 @@ mod imp { let ret = getrandom(buf); match ret { Err(err) => { - panic!("kernel mx_cprng_draw call failed! (returned {}, buf.len() {})", + panic!("kernel zx_cprng_draw call failed! (returned {}, buf.len() {})", err, buf.len()) } Ok(actual) => { diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index e9e4b55402c..d4613d29a36 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -35,8 +35,11 @@ static EXCEPTIONS: &'static [&'static str] = &[ "thread-id", // Apache-2.0, mdbook "cssparser", // MPL-2.0, rustdoc "smallvec", // MPL-2.0, rustdoc + // TODO: remove magenta references when "everything" has moved over to using the zircon name. "magenta-sys", // BSD-3-Clause, rustdoc "magenta", // BSD-3-Clause, rustdoc + "zircon-sys", // BSD-3-Clause, rustdoc + "zircon", // BSD-3-Clause, rustdoc "cssparser-macros", // MPL-2.0, rustdoc "selectors", // MPL-2.0, rustdoc ]; -- cgit 1.4.1-3-g733a5 From cc4e82fe7a9126a068e27dcdfc251a1b4be1aa77 Mon Sep 17 00:00:00 2001 From: "P.Y. Laligand" Date: Fri, 15 Sep 2017 14:11:04 -0700 Subject: Fixed casing issues. --- src/libstd/sys/unix/process/process_fuchsia.rs | 16 ++++++++-------- src/libstd/sys/unix/process/zircon.rs | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 1a7f544f8e9..6059acdd485 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -67,8 +67,8 @@ impl Command { } // Duplicate the job handle - let mut job_copy: zx_handle_t = zx_HANDLE_INVALID; - zx_cvt(zx_handle_duplicate(job_handle, zx_RIGHT_SAME_RIGHTS, &mut job_copy))?; + let mut job_copy: zx_handle_t = ZX_HANDLE_INVALID; + zx_cvt(zx_handle_duplicate(job_handle, ZX_RIGHT_SAME_RIGHTS, &mut job_copy))?; // Create a launchpad let mut launchpad: *mut launchpad_t = ptr::null_mut(); zx_cvt(launchpad_create(job_copy, self.get_argv()[0], &mut launchpad))?; @@ -82,7 +82,7 @@ impl Command { zx_cvt(launchpad_add_vdso_vmo(launchpad))?; // Load the executable zx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?; - zx_cvt(launchpad_load_vdso(launchpad, zx_HANDLE_INVALID))?; + zx_cvt(launchpad_load_vdso(launchpad, ZX_HANDLE_INVALID))?; zx_cvt(launchpad_clone(launchpad, LP_CLONE_FDIO_ROOT | LP_CLONE_FDIO_CWD))?; // Clone stdin, stdout, and stderr @@ -152,9 +152,9 @@ impl Process { let mut avail: zx_size_t = 0; unsafe { - zx_cvt(zx_object_wait_one(self.handle.raw(), zx_TASK_TERMINATED, - zx_TIME_INFINITE, ptr::null_mut()))?; - zx_cvt(zx_object_get_info(self.handle.raw(), zx_INFO_PROCESS, + zx_cvt(zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED, + ZX_TIME_INFINITE, ptr::null_mut()))?; + zx_cvt(zx_object_get_info(self.handle.raw(), ZX_INFO_PROCESS, &mut proc_info as *mut _ as *mut libc::c_void, mem::size_of::(), &mut actual, &mut avail))?; @@ -175,7 +175,7 @@ impl Process { let mut avail: zx_size_t = 0; unsafe { - let status = zx_object_wait_one(self.handle.raw(), zx_TASK_TERMINATED, + let status = zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED, 0, ptr::null_mut()); match status { 0 => { }, // Success @@ -184,7 +184,7 @@ impl Process { }, _ => { panic!("Failed to wait on process handle: {}", status); }, } - zx_cvt(zx_object_get_info(self.handle.raw(), zx_INFO_PROCESS, + zx_cvt(zx_object_get_info(self.handle.raw(), ZX_INFO_PROCESS, &mut proc_info as *mut _ as *mut libc::c_void, mem::size_of::(), &mut actual, &mut avail))?; diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index 4dbcdb57663..2a0fcabcf7f 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -24,22 +24,22 @@ pub type zx_status_t = i32; pub type zx_size_t = usize; -pub const zx_HANDLE_INVALID: zx_handle_t = 0; +pub const ZX_HANDLE_INVALID: zx_handle_t = 0; pub type zx_time_t = u64; -pub const zx_TIME_INFINITE : zx_time_t = u64::MAX; +pub const ZX_TIME_INFINITE : zx_time_t = u64::MAX; pub type zx_signals_t = u32; -pub const zx_OBJECT_SIGNAL_3 : zx_signals_t = 1 << 3; +pub const ZX_OBJECT_SIGNAL_3 : zx_signals_t = 1 << 3; -pub const zx_TASK_TERMINATED : zx_signals_t = zx_OBJECT_SIGNAL_3; +pub const ZX_TASK_TERMINATED : zx_signals_t = ZX_OBJECT_SIGNAL_3; -pub const zx_RIGHT_SAME_RIGHTS : zx_rights_t = 1 << 31; +pub const ZX_RIGHT_SAME_RIGHTS : zx_rights_t = 1 << 31; pub type zx_object_info_topic_t = u32; -pub const zx_INFO_PROCESS : zx_object_info_topic_t = 3; +pub const ZX_INFO_PROCESS : zx_object_info_topic_t = 3; pub fn zx_cvt(t: T) -> io::Result where T: TryInto+Copy { if let Ok(status) = TryInto::try_into(t) { @@ -76,7 +76,7 @@ impl Drop for Handle { } } -// Common zx_INFO header +// Common ZX_INFO header #[derive(Default)] #[repr(C)] pub struct zx_info_header_t { @@ -93,7 +93,7 @@ pub struct zx_record_process_t { pub return_code: c_int, } -// Returned for topic zx_INFO_PROCESS +// Returned for topic ZX_INFO_PROCESS #[derive(Default)] #[repr(C)] pub struct zx_info_process_t { -- cgit 1.4.1-3-g733a5 From d7a17fb3cf3bedd5efdda46a8412cdce097d1154 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Sun, 24 Sep 2017 14:31:50 -0700 Subject: LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACE --- src/libstd/sys/unix/process/process_fuchsia.rs | 2 +- src/libstd/sys/unix/process/zircon.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 6059acdd485..5d34da04446 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -83,7 +83,7 @@ impl Command { // Load the executable zx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?; zx_cvt(launchpad_load_vdso(launchpad, ZX_HANDLE_INVALID))?; - zx_cvt(launchpad_clone(launchpad, LP_CLONE_FDIO_ROOT | LP_CLONE_FDIO_CWD))?; + zx_cvt(launchpad_clone(launchpad, LP_CLONE_FDIO_NAMESPACE | LP_CLONE_FDIO_CWD))?; // Clone stdin, stdout, and stderr if let Some(fd) = stdio.stdin.fd() { diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index 2a0fcabcf7f..b5ec11b40fd 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -180,7 +180,7 @@ extern { // Launchpad clone constants -pub const LP_CLONE_FDIO_ROOT: u32 = 0x0001; +pub const LP_CLONE_FDIO_NAMESPACE: u32 = 0x0001; pub const LP_CLONE_FDIO_CWD: u32 = 0x0002; // LP_CLONE_FDIO_STDIO = 0x0004 // LP_CLONE_FDIO_ALL = 0x00FF -- cgit 1.4.1-3-g733a5