about summary refs log tree commit diff
path: root/src/libstd/sys/unix/process
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2019-11-27 10:28:39 -0800
committerDavid Tolnay <dtolnay@gmail.com>2019-11-29 18:37:58 -0800
commitc34fbfaad38cf5829ef5cfe780dc9d58480adeaa (patch)
treee57b66ed06aec18dc13ff7f14a243ca3dc3c27d1 /src/libstd/sys/unix/process
parent9081929d45f12d3f56d43b1d6db7519981580fc9 (diff)
downloadrust-c34fbfaad38cf5829ef5cfe780dc9d58480adeaa.tar.gz
rust-c34fbfaad38cf5829ef5cfe780dc9d58480adeaa.zip
Format libstd/sys with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/sys *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/sys -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/sys outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
Diffstat (limited to 'src/libstd/sys/unix/process')
-rw-r--r--src/libstd/sys/unix/process/process_common.rs64
-rw-r--r--src/libstd/sys/unix/process/process_fuchsia.rs102
-rw-r--r--src/libstd/sys/unix/process/zircon.rs173
3 files changed, 200 insertions, 139 deletions
diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs
index 0e6f96bb228..c9109b0c9d4 100644
--- a/src/libstd/sys/unix/process/process_common.rs
+++ b/src/libstd/sys/unix/process/process_common.rs
@@ -1,6 +1,7 @@
 use crate::os::unix::prelude::*;
 
-use crate::ffi::{OsString, OsStr, CString, CStr};
+use crate::collections::BTreeMap;
+use crate::ffi::{CStr, CString, OsStr, OsString};
 use crate::fmt;
 use crate::io;
 use crate::ptr;
@@ -8,12 +9,11 @@ use crate::sys::fd::FileDesc;
 use crate::sys::fs::File;
 use crate::sys::pipe::{self, AnonPipe};
 use crate::sys_common::process::CommandEnv;
-use crate::collections::BTreeMap;
 
 #[cfg(not(target_os = "fuchsia"))]
 use crate::sys::fs::OpenOptions;
 
-use libc::{c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE};
+use libc::{c_char, c_int, gid_t, uid_t, EXIT_FAILURE, EXIT_SUCCESS};
 
 cfg_if::cfg_if! {
     if #[cfg(target_os = "fuchsia")] {
@@ -204,10 +204,7 @@ impl Command {
         &mut self.closures
     }
 
-    pub unsafe fn pre_exec(
-        &mut self,
-        f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>,
-    ) {
+    pub unsafe fn pre_exec(&mut self, f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>) {
         self.closures.push(f);
     }
 
@@ -236,26 +233,21 @@ impl Command {
         self.env.have_changed_path()
     }
 
-    pub fn setup_io(&self, default: Stdio, needs_stdin: bool)
-                -> io::Result<(StdioPipes, ChildPipes)> {
+    pub fn setup_io(
+        &self,
+        default: Stdio,
+        needs_stdin: bool,
+    ) -> io::Result<(StdioPipes, ChildPipes)> {
         let null = Stdio::Null;
-        let default_stdin = if needs_stdin {&default} else {&null};
+        let default_stdin = if needs_stdin { &default } else { &null };
         let stdin = self.stdin.as_ref().unwrap_or(default_stdin);
         let stdout = self.stdout.as_ref().unwrap_or(&default);
         let stderr = self.stderr.as_ref().unwrap_or(&default);
         let (their_stdin, our_stdin) = stdin.to_child_stdio(true)?;
         let (their_stdout, our_stdout) = stdout.to_child_stdio(false)?;
         let (their_stderr, our_stderr) = stderr.to_child_stdio(false)?;
-        let ours = StdioPipes {
-            stdin: our_stdin,
-            stdout: our_stdout,
-            stderr: our_stderr,
-        };
-        let theirs = ChildPipes {
-            stdin: their_stdin,
-            stdout: their_stdout,
-            stderr: their_stderr,
-        };
+        let ours = StdioPipes { stdin: our_stdin, stdout: our_stdout, stderr: our_stderr };
+        let theirs = ChildPipes { stdin: their_stdin, stdout: their_stdout, stderr: their_stderr };
         Ok((ours, theirs))
     }
 }
@@ -270,21 +262,21 @@ fn os2c(s: &OsStr, saw_nul: &mut bool) -> CString {
 // Helper type to manage ownership of the strings within a C-style array.
 pub struct CStringArray {
     items: Vec<CString>,
-    ptrs: Vec<*const c_char>
+    ptrs: Vec<*const c_char>,
 }
 
 impl CStringArray {
     pub fn with_capacity(capacity: usize) -> Self {
         let mut result = CStringArray {
             items: Vec::with_capacity(capacity),
-            ptrs: Vec::with_capacity(capacity+1)
+            ptrs: Vec::with_capacity(capacity + 1),
         };
         result.ptrs.push(ptr::null());
         result
     }
     pub fn push(&mut self, item: CString) {
         let l = self.ptrs.len();
-        self.ptrs[l-1] = item.as_ptr();
+        self.ptrs[l - 1] = item.as_ptr();
         self.ptrs.push(ptr::null());
         self.items.push(item);
     }
@@ -315,12 +307,9 @@ fn construct_envp(env: BTreeMap<OsString, OsString>, saw_nul: &mut bool) -> CStr
 }
 
 impl Stdio {
-    pub fn to_child_stdio(&self, readable: bool)
-                      -> io::Result<(ChildStdio, Option<AnonPipe>)> {
+    pub fn to_child_stdio(&self, readable: bool) -> io::Result<(ChildStdio, Option<AnonPipe>)> {
         match *self {
-            Stdio::Inherit => {
-                Ok((ChildStdio::Inherit, None))
-            },
+            Stdio::Inherit => Ok((ChildStdio::Inherit, None)),
 
             // Make sure that the source descriptors are not an stdio
             // descriptor, otherwise the order which we set the child's
@@ -339,11 +328,7 @@ impl Stdio {
 
             Stdio::MakePipe => {
                 let (reader, writer) = pipe::anon_pipe()?;
-                let (ours, theirs) = if readable {
-                    (writer, reader)
-                } else {
-                    (reader, writer)
-                };
+                let (ours, theirs) = if readable { (writer, reader) } else { (reader, writer) };
                 Ok((ChildStdio::Owned(theirs.into_fd()), Some(ours)))
             }
 
@@ -352,17 +337,13 @@ impl Stdio {
                 let mut opts = OpenOptions::new();
                 opts.read(readable);
                 opts.write(!readable);
-                let path = unsafe {
-                    CStr::from_ptr(DEV_NULL.as_ptr() as *const _)
-                };
+                let path = unsafe { CStr::from_ptr(DEV_NULL.as_ptr() as *const _) };
                 let fd = File::open_c(&path, &opts)?;
                 Ok((ChildStdio::Owned(fd.into_fd()), None))
             }
 
             #[cfg(target_os = "fuchsia")]
-            Stdio::Null => {
-                Ok((ChildStdio::Null, None))
-            }
+            Stdio::Null => Ok((ChildStdio::Null, None)),
         }
     }
 }
@@ -430,7 +411,7 @@ mod tests {
                 Ok(t) => t,
                 Err(e) => panic!("received error for `{}`: {}", stringify!($e), e),
             }
-        }
+        };
     }
 
     // See #14232 for more information, but it appears that signal delivery to a
@@ -461,8 +442,7 @@ mod tests {
             let stdin_write = pipes.stdin.take().unwrap();
             let stdout_read = pipes.stdout.take().unwrap();
 
-            t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, old_set.as_ptr(),
-                                         ptr::null_mut())));
+            t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, old_set.as_ptr(), ptr::null_mut())));
 
             t!(cvt(libc::kill(cat.id() as libc::pid_t, libc::SIGINT)));
             // We need to wait until SIGINT is definitely delivered. The
diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs
index 486c12f9bf8..f0bd1cdfed5 100644
--- a/src/libstd/sys/unix/process/process_fuchsia.rs
+++ b/src/libstd/sys/unix/process/process_fuchsia.rs
@@ -1,11 +1,11 @@
 use crate::convert::TryInto;
-use crate::io;
 use crate::fmt;
+use crate::io;
 use crate::mem;
 use crate::ptr;
 
-use crate::sys::process::zircon::{Handle, zx_handle_t};
 use crate::sys::process::process_common::*;
+use crate::sys::process::zircon::{zx_handle_t, Handle};
 
 use libc::{c_int, size_t};
 
@@ -14,13 +14,18 @@ use libc::{c_int, size_t};
 ////////////////////////////////////////////////////////////////////////////////
 
 impl Command {
-    pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
-                 -> io::Result<(Process, StdioPipes)> {
+    pub fn spawn(
+        &mut self,
+        default: Stdio,
+        needs_stdin: bool,
+    ) -> io::Result<(Process, StdioPipes)> {
         let envp = self.capture_env();
 
         if self.saw_nul() {
-            return Err(io::Error::new(io::ErrorKind::InvalidInput,
-                                      "nul byte found in provided data"));
+            return Err(io::Error::new(
+                io::ErrorKind::InvalidInput,
+                "nul byte found in provided data",
+            ));
         }
 
         let (ours, theirs) = self.setup_io(default, needs_stdin)?;
@@ -32,21 +37,23 @@ impl Command {
 
     pub fn exec(&mut self, default: Stdio) -> io::Error {
         if self.saw_nul() {
-            return io::Error::new(io::ErrorKind::InvalidInput,
-                                  "nul byte found in provided data")
+            return io::Error::new(io::ErrorKind::InvalidInput, "nul byte found in provided data");
         }
 
         match self.setup_io(default, true) {
             Ok((_, _)) => {
                 // FIXME: This is tough because we don't support the exec syscalls
                 unimplemented!();
-            },
+            }
             Err(e) => e,
         }
     }
 
-    unsafe fn do_exec(&mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>)
-                      -> io::Result<zx_handle_t> {
+    unsafe fn do_exec(
+        &mut self,
+        stdio: ChildPipes,
+        maybe_envp: Option<&CStringArray>,
+    ) -> io::Result<zx_handle_t> {
         use crate::sys::process::zircon::*;
 
         let envp = match maybe_envp {
@@ -108,10 +115,15 @@ impl Command {
         let mut process_handle: zx_handle_t = 0;
         zx_cvt(fdio_spawn_etc(
             ZX_HANDLE_INVALID,
-            FDIO_SPAWN_CLONE_JOB | FDIO_SPAWN_CLONE_LDSVC | FDIO_SPAWN_CLONE_NAMESPACE
-            | FDIO_SPAWN_CLONE_ENVIRON,  // this is ignored when envp is non-null
-            self.get_program().as_ptr(), self.get_argv().as_ptr(), envp,
-            actions.len() as size_t, actions.as_ptr(),
+            FDIO_SPAWN_CLONE_JOB
+                | FDIO_SPAWN_CLONE_LDSVC
+                | FDIO_SPAWN_CLONE_NAMESPACE
+                | FDIO_SPAWN_CLONE_ENVIRON, // this is ignored when envp is non-null
+            self.get_program().as_ptr(),
+            self.get_argv().as_ptr(),
+            envp,
+            actions.len() as size_t,
+            actions.as_ptr(),
             &mut process_handle,
             ptr::null_mut(),
         ))?;
@@ -137,7 +149,9 @@ impl Process {
     pub fn kill(&mut self) -> io::Result<()> {
         use crate::sys::process::zircon::*;
 
-        unsafe { zx_cvt(zx_task_kill(self.handle.raw()))?; }
+        unsafe {
+            zx_cvt(zx_task_kill(self.handle.raw()))?;
+        }
 
         Ok(())
     }
@@ -151,16 +165,26 @@ impl Process {
         let mut avail: 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,
-                                      &mut proc_info as *mut _ as *mut libc::c_void,
-                                      mem::size_of::<zx_info_process_t>(), &mut actual,
-                                      &mut avail))?;
+            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::<zx_info_process_t>(),
+                &mut actual,
+                &mut avail,
+            ))?;
         }
         if actual != 1 {
-            return Err(io::Error::new(io::ErrorKind::InvalidData,
-                                      "Failed to get exit status of process"));
+            return Err(io::Error::new(
+                io::ErrorKind::InvalidData,
+                "Failed to get exit status of process",
+            ));
         }
         Ok(ExitStatus(proc_info.return_code))
     }
@@ -174,23 +198,31 @@ impl Process {
         let mut avail: size_t = 0;
 
         unsafe {
-            let status = zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED,
-                                            0, ptr::null_mut());
+            let status =
+                zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED, 0, ptr::null_mut());
             match status {
-                0 => { }, // Success
+                0 => {} // Success
                 x if x == ERR_TIMED_OUT => {
                     return Ok(None);
-                },
-                _ => { panic!("Failed to wait on process handle: {}", status); },
+                }
+                _ => {
+                    panic!("Failed to wait on process handle: {}", status);
+                }
             }
-            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::<zx_info_process_t>(), &mut actual,
-                                      &mut avail))?;
+            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::<zx_info_process_t>(),
+                &mut actual,
+                &mut avail,
+            ))?;
         }
         if actual != 1 {
-            return Err(io::Error::new(io::ErrorKind::InvalidData,
-                                      "Failed to get exit status of process"));
+            return Err(io::Error::new(
+                io::ErrorKind::InvalidData,
+                "Failed to get exit status of process",
+            ));
         }
         Ok(Some(ExitStatus(proc_info.return_code)))
     }
diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs
index 188a6b5f2da..750b8f0762a 100644
--- a/src/libstd/sys/unix/process/zircon.rs
+++ b/src/libstd/sys/unix/process/zircon.rs
@@ -1,8 +1,8 @@
 #![allow(non_camel_case_types, unused)]
 
 use crate::convert::TryInto;
-use crate::io;
 use crate::i64;
+use crate::io;
 use crate::mem::MaybeUninit;
 use crate::os::raw::c_char;
 
@@ -16,27 +16,26 @@ pub type zx_status_t = i32;
 pub const ZX_HANDLE_INVALID: zx_handle_t = 0;
 
 pub type zx_time_t = i64;
-pub const ZX_TIME_INFINITE : zx_time_t = i64::MAX;
+pub const ZX_TIME_INFINITE: zx_time_t = i64::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: T) -> io::Result<T> where T: TryInto<zx_status_t>+Copy {
+pub fn zx_cvt<T>(t: T) -> io::Result<T>
+where
+    T: TryInto<zx_status_t> + Copy,
+{
     if let Ok(status) = TryInto::try_into(t) {
-        if status < 0 {
-            Err(io::Error::from_raw_os_error(status))
-        } else {
-            Ok(t)
-        }
+        if status < 0 { Err(io::Error::from_raw_os_error(status)) } else { Ok(t) }
     } else {
         Err(io::Error::last_os_error())
     }
@@ -49,9 +48,7 @@ pub struct Handle {
 
 impl Handle {
     pub fn new(raw: zx_handle_t) -> Handle {
-        Handle {
-            raw,
-        }
+        Handle { raw }
     }
 
     pub fn raw(&self) -> zx_handle_t {
@@ -61,7 +58,9 @@ impl Handle {
 
 impl Drop for Handle {
     fn drop(&mut self) {
-        unsafe { zx_cvt(zx_handle_close(self.raw)).expect("Failed to close zx_handle_t"); }
+        unsafe {
+            zx_cvt(zx_handle_close(self.raw)).expect("Failed to close zx_handle_t");
+        }
     }
 }
 
@@ -75,22 +74,34 @@ pub struct zx_info_process_t {
     pub debugger_attached: bool,
 }
 
-extern {
+extern "C" {
     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: size_t, actual_size: *mut size_t,
-                              avail: *mut size_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: size_t,
+        actual_size: *mut size_t,
+        avail: *mut size_t,
+    ) -> zx_status_t;
 }
 
 #[derive(Default)]
@@ -103,11 +114,18 @@ pub struct fdio_spawn_action_t {
     pub reserved1: u64,
 }
 
-extern {
-    pub fn fdio_spawn_etc(job: zx_handle_t, flags: u32, path: *const c_char,
-                          argv: *const *const c_char, envp: *const *const c_char,
-                          action_count: size_t, actions: *const fdio_spawn_action_t,
-                          process: *mut zx_handle_t, err_msg: *mut c_char) -> zx_status_t;
+extern "C" {
+    pub fn fdio_spawn_etc(
+        job: zx_handle_t,
+        flags: u32,
+        path: *const c_char,
+        argv: *const *const c_char,
+        envp: *const *const c_char,
+        action_count: size_t,
+        actions: *const fdio_spawn_action_t,
+        process: *mut zx_handle_t,
+        err_msg: *mut c_char,
+    ) -> zx_status_t;
 
     pub fn fdio_fd_clone(fd: c_int, out_handle: *mut zx_handle_t) -> zx_status_t;
     pub fn fdio_fd_create(handle: zx_handle_t, fd: *mut c_int) -> zx_status_t;
@@ -129,60 +147,74 @@ pub const FDIO_SPAWN_ACTION_TRANSFER_FD: u32 = 0x0002;
 
 // Errors
 
-#[allow(unused)] pub const ERR_INTERNAL: zx_status_t = -1;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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
@@ -192,67 +224,84 @@ pub const FDIO_SPAWN_ACTION_TRANSFER_FD: u32 = 0x0002;
 // 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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[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;
+#[allow(unused)]
+pub const ERR_NO_SPACE: zx_status_t = -54;