about summary refs log tree commit diff
path: root/src/libstd/sys/cloudabi
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:04 -0500
committerMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:47 -0500
commita06baa56b95674fc626b3c3fd680d6a65357fe60 (patch)
treecd9d867c2ca3cff5c1d6b3bd73377c44649fb075 /src/libstd/sys/cloudabi
parent8eb7c58dbb7b32701af113bc58722d0d1fefb1eb (diff)
downloadrust-a06baa56b95674fc626b3c3fd680d6a65357fe60.tar.gz
rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.zip
Format the world
Diffstat (limited to 'src/libstd/sys/cloudabi')
-rw-r--r--src/libstd/sys/cloudabi/abi/cloudabi.rs2098
-rw-r--r--src/libstd/sys/cloudabi/condvar.rs42
-rw-r--r--src/libstd/sys/cloudabi/mod.rs5
-rw-r--r--src/libstd/sys/cloudabi/mutex.rs2
-rw-r--r--src/libstd/sys/cloudabi/rwlock.rs22
5 files changed, 1116 insertions, 1053 deletions
diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs
index 38db4dd5165..d113a7b3d60 100644
--- a/src/libstd/sys/cloudabi/abi/cloudabi.rs
+++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs
@@ -124,24 +124,24 @@ include!("bitflags.rs");
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum advice {
-  /// The application expects that it will not access the
-  /// specified data in the near future.
-  DONTNEED   = 1,
-  /// The application expects to access the specified data
-  /// once and then not reuse it thereafter.
-  NOREUSE    = 2,
-  /// The application has no advice to give on its behavior
-  /// with respect to the specified data.
-  NORMAL     = 3,
-  /// The application expects to access the specified data
-  /// in a random order.
-  RANDOM     = 4,
-  /// The application expects to access the specified data
-  /// sequentially from lower offsets to higher offsets.
-  SEQUENTIAL = 5,
-  /// The application expects to access the specified data
-  /// in the near future.
-  WILLNEED   = 6,
+    /// The application expects that it will not access the
+    /// specified data in the near future.
+    DONTNEED = 1,
+    /// The application expects to access the specified data
+    /// once and then not reuse it thereafter.
+    NOREUSE = 2,
+    /// The application has no advice to give on its behavior
+    /// with respect to the specified data.
+    NORMAL = 3,
+    /// The application expects to access the specified data
+    /// in a random order.
+    RANDOM = 4,
+    /// The application expects to access the specified data
+    /// sequentially from lower offsets to higher offsets.
+    SEQUENTIAL = 5,
+    /// The application expects to access the specified data
+    /// in the near future.
+    WILLNEED = 6,
 }
 
 /// Enumeration describing the kind of value stored in [`auxv`](struct.auxv.html).
@@ -149,69 +149,69 @@ pub enum advice {
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum auxtype {
-  /// Base address of the binary argument data provided to
-  /// [`proc_exec()`](fn.proc_exec.html).
-  ARGDATA      = 256,
-  /// Length of the binary argument data provided to
-  /// [`proc_exec()`](fn.proc_exec.html).
-  ARGDATALEN   = 257,
-  /// Base address at which the executable is placed in
-  /// memory.
-  BASE         =   7,
-  /// Base address of a buffer of random data that may be
-  /// used for non-cryptographic purposes, for example as a
-  /// canary for stack smashing protection.
-  CANARY       = 258,
-  /// Length of a buffer of random data that may be used
-  /// for non-cryptographic purposes, for example as a
-  /// canary for stack smashing protection.
-  CANARYLEN    = 259,
-  /// Number of CPUs that the system this process is running
-  /// on has.
-  NCPUS        = 260,
-  /// Terminator of the auxiliary vector.
-  NULL         =   0,
-  /// Smallest memory object size for which individual
-  /// memory protection controls can be configured.
-  PAGESZ       =   6,
-  /// Address of the first ELF program header of the
-  /// executable.
-  PHDR         =   3,
-  /// Number of ELF program headers of the executable.
-  PHNUM        =   4,
-  /// Identifier of the process.
-  ///
-  /// This environment does not provide any simple numerical
-  /// process identifiers, for the reason that these are not
-  /// useful in distributed contexts. Instead, processes are
-  /// identified by a UUID.
-  ///
-  /// This record should point to sixteen bytes of binary
-  /// data, containing a version 4 UUID (fully random).
-  PID          = 263,
-  /// Address of the ELF header of the vDSO.
-  ///
-  /// The vDSO is a shared library that is mapped in the
-  /// address space of the process. It provides entry points
-  /// for every system call supported by the environment,
-  /// all having a corresponding symbol that is prefixed
-  /// with `cloudabi_sys_`. System calls should be invoked
-  /// through these entry points.
-  ///
-  /// The first advantage of letting processes call into a
-  /// vDSO to perform system calls instead of raising
-  /// hardware traps is that it allows for easy emulation of
-  /// executables on top of existing operating systems. The
-  /// second advantage is that in cases where an operating
-  /// system provides native support for CloudABI executables,
-  /// it may still implement partial userspace
-  /// implementations of these system calls to improve
-  /// performance (e.g., [`clock_time_get()`](fn.clock_time_get.html)). It also provides
-  /// a more dynamic way of adding, removing or replacing
-  /// system calls.
-  SYSINFO_EHDR = 262,
-  /// Thread ID of the initial thread of the process.
-  TID          = 261,
+    /// Base address of the binary argument data provided to
+    /// [`proc_exec()`](fn.proc_exec.html).
+    ARGDATA = 256,
+    /// Length of the binary argument data provided to
+    /// [`proc_exec()`](fn.proc_exec.html).
+    ARGDATALEN = 257,
+    /// Base address at which the executable is placed in
+    /// memory.
+    BASE = 7,
+    /// Base address of a buffer of random data that may be
+    /// used for non-cryptographic purposes, for example as a
+    /// canary for stack smashing protection.
+    CANARY = 258,
+    /// Length of a buffer of random data that may be used
+    /// for non-cryptographic purposes, for example as a
+    /// canary for stack smashing protection.
+    CANARYLEN = 259,
+    /// Number of CPUs that the system this process is running
+    /// on has.
+    NCPUS = 260,
+    /// Terminator of the auxiliary vector.
+    NULL = 0,
+    /// Smallest memory object size for which individual
+    /// memory protection controls can be configured.
+    PAGESZ = 6,
+    /// Address of the first ELF program header of the
+    /// executable.
+    PHDR = 3,
+    /// Number of ELF program headers of the executable.
+    PHNUM = 4,
+    /// Identifier of the process.
+    ///
+    /// This environment does not provide any simple numerical
+    /// process identifiers, for the reason that these are not
+    /// useful in distributed contexts. Instead, processes are
+    /// identified by a UUID.
+    ///
+    /// This record should point to sixteen bytes of binary
+    /// data, containing a version 4 UUID (fully random).
+    PID = 263,
+    /// Address of the ELF header of the vDSO.
+    ///
+    /// The vDSO is a shared library that is mapped in the
+    /// address space of the process. It provides entry points
+    /// for every system call supported by the environment,
+    /// all having a corresponding symbol that is prefixed
+    /// with `cloudabi_sys_`. System calls should be invoked
+    /// through these entry points.
+    ///
+    /// The first advantage of letting processes call into a
+    /// vDSO to perform system calls instead of raising
+    /// hardware traps is that it allows for easy emulation of
+    /// executables on top of existing operating systems. The
+    /// second advantage is that in cases where an operating
+    /// system provides native support for CloudABI executables,
+    /// it may still implement partial userspace
+    /// implementations of these system calls to improve
+    /// performance (e.g., [`clock_time_get()`](fn.clock_time_get.html)). It also provides
+    /// a more dynamic way of adding, removing or replacing
+    /// system calls.
+    SYSINFO_EHDR = 262,
+    /// Thread ID of the initial thread of the process.
+    TID = 261,
 }
 
 /// Identifiers for clocks.
@@ -219,21 +219,21 @@ pub enum auxtype {
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum clockid {
-  /// The system-wide monotonic clock, which is defined as a
-  /// clock measuring real time, whose value cannot be
-  /// adjusted and which cannot have negative clock jumps.
-  ///
-  /// The epoch of this clock is undefined. The absolute
-  /// time value of this clock therefore has no meaning.
-  MONOTONIC          = 1,
-  /// The CPU-time clock associated with the current
-  /// process.
-  PROCESS_CPUTIME_ID = 2,
-  /// The system-wide clock measuring real time. Time value
-  /// zero corresponds with 1970-01-01T00:00:00Z.
-  REALTIME           = 3,
-  /// The CPU-time clock associated with the current thread.
-  THREAD_CPUTIME_ID  = 4,
+    /// The system-wide monotonic clock, which is defined as a
+    /// clock measuring real time, whose value cannot be
+    /// adjusted and which cannot have negative clock jumps.
+    ///
+    /// The epoch of this clock is undefined. The absolute
+    /// time value of this clock therefore has no meaning.
+    MONOTONIC = 1,
+    /// The CPU-time clock associated with the current
+    /// process.
+    PROCESS_CPUTIME_ID = 2,
+    /// The system-wide clock measuring real time. Time value
+    /// zero corresponds with 1970-01-01T00:00:00Z.
+    REALTIME = 3,
+    /// The CPU-time clock associated with the current thread.
+    THREAD_CPUTIME_ID = 4,
 }
 
 /// A userspace condition variable.
@@ -270,160 +270,160 @@ pub const DIRCOOKIE_START: dircookie = dircookie(0);
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum errno {
-  /// No error occurred. System call completed successfully.
-  SUCCESS        =  0,
-  /// Argument list too long.
-  TOOBIG         =  1,
-  /// Permission denied.
-  ACCES          =  2,
-  /// Address in use.
-  ADDRINUSE      =  3,
-  /// Address not available.
-  ADDRNOTAVAIL   =  4,
-  /// Address family not supported.
-  AFNOSUPPORT    =  5,
-  /// Resource unavailable, or operation would block.
-  AGAIN          =  6,
-  /// Connection already in progress.
-  ALREADY        =  7,
-  /// Bad file descriptor.
-  BADF           =  8,
-  /// Bad message.
-  BADMSG         =  9,
-  /// Device or resource busy.
-  BUSY           = 10,
-  /// Operation canceled.
-  CANCELED       = 11,
-  /// No child processes.
-  CHILD          = 12,
-  /// Connection aborted.
-  CONNABORTED    = 13,
-  /// Connection refused.
-  CONNREFUSED    = 14,
-  /// Connection reset.
-  CONNRESET      = 15,
-  /// Resource deadlock would occur.
-  DEADLK         = 16,
-  /// Destination address required.
-  DESTADDRREQ    = 17,
-  /// Mathematics argument out of domain of function.
-  DOM            = 18,
-  /// Reserved.
-  DQUOT          = 19,
-  /// File exists.
-  EXIST          = 20,
-  /// Bad address.
-  FAULT          = 21,
-  /// File too large.
-  FBIG           = 22,
-  /// Host is unreachable.
-  HOSTUNREACH    = 23,
-  /// Identifier removed.
-  IDRM           = 24,
-  /// Illegal byte sequence.
-  ILSEQ          = 25,
-  /// Operation in progress.
-  INPROGRESS     = 26,
-  /// Interrupted function.
-  INTR           = 27,
-  /// Invalid argument.
-  INVAL          = 28,
-  /// I/O error.
-  IO             = 29,
-  /// Socket is connected.
-  ISCONN         = 30,
-  /// Is a directory.
-  ISDIR          = 31,
-  /// Too many levels of symbolic links.
-  LOOP           = 32,
-  /// File descriptor value too large.
-  MFILE          = 33,
-  /// Too many links.
-  MLINK          = 34,
-  /// Message too large.
-  MSGSIZE        = 35,
-  /// Reserved.
-  MULTIHOP       = 36,
-  /// Filename too long.
-  NAMETOOLONG    = 37,
-  /// Network is down.
-  NETDOWN        = 38,
-  /// Connection aborted by network.
-  NETRESET       = 39,
-  /// Network unreachable.
-  NETUNREACH     = 40,
-  /// Too many files open in system.
-  NFILE          = 41,
-  /// No buffer space available.
-  NOBUFS         = 42,
-  /// No such device.
-  NODEV          = 43,
-  /// No such file or directory.
-  NOENT          = 44,
-  /// Executable file format error.
-  NOEXEC         = 45,
-  /// No locks available.
-  NOLCK          = 46,
-  /// Reserved.
-  NOLINK         = 47,
-  /// Not enough space.
-  NOMEM          = 48,
-  /// No message of the desired type.
-  NOMSG          = 49,
-  /// Protocol not available.
-  NOPROTOOPT     = 50,
-  /// No space left on device.
-  NOSPC          = 51,
-  /// Function not supported.
-  NOSYS          = 52,
-  /// The socket is not connected.
-  NOTCONN        = 53,
-  /// Not a directory or a symbolic link to a directory.
-  NOTDIR         = 54,
-  /// Directory not empty.
-  NOTEMPTY       = 55,
-  /// State not recoverable.
-  NOTRECOVERABLE = 56,
-  /// Not a socket.
-  NOTSOCK        = 57,
-  /// Not supported, or operation not supported on socket.
-  NOTSUP         = 58,
-  /// Inappropriate I/O control operation.
-  NOTTY          = 59,
-  /// No such device or address.
-  NXIO           = 60,
-  /// Value too large to be stored in data type.
-  OVERFLOW       = 61,
-  /// Previous owner died.
-  OWNERDEAD      = 62,
-  /// Operation not permitted.
-  PERM           = 63,
-  /// Broken pipe.
-  PIPE           = 64,
-  /// Protocol error.
-  PROTO          = 65,
-  /// Protocol not supported.
-  PROTONOSUPPORT = 66,
-  /// Protocol wrong type for socket.
-  PROTOTYPE      = 67,
-  /// Result too large.
-  RANGE          = 68,
-  /// Read-only file system.
-  ROFS           = 69,
-  /// Invalid seek.
-  SPIPE          = 70,
-  /// No such process.
-  SRCH           = 71,
-  /// Reserved.
-  STALE          = 72,
-  /// Connection timed out.
-  TIMEDOUT       = 73,
-  /// Text file busy.
-  TXTBSY         = 74,
-  /// Cross-device link.
-  XDEV           = 75,
-  /// Extension: Capabilities insufficient.
-  NOTCAPABLE     = 76,
+    /// No error occurred. System call completed successfully.
+    SUCCESS = 0,
+    /// Argument list too long.
+    TOOBIG = 1,
+    /// Permission denied.
+    ACCES = 2,
+    /// Address in use.
+    ADDRINUSE = 3,
+    /// Address not available.
+    ADDRNOTAVAIL = 4,
+    /// Address family not supported.
+    AFNOSUPPORT = 5,
+    /// Resource unavailable, or operation would block.
+    AGAIN = 6,
+    /// Connection already in progress.
+    ALREADY = 7,
+    /// Bad file descriptor.
+    BADF = 8,
+    /// Bad message.
+    BADMSG = 9,
+    /// Device or resource busy.
+    BUSY = 10,
+    /// Operation canceled.
+    CANCELED = 11,
+    /// No child processes.
+    CHILD = 12,
+    /// Connection aborted.
+    CONNABORTED = 13,
+    /// Connection refused.
+    CONNREFUSED = 14,
+    /// Connection reset.
+    CONNRESET = 15,
+    /// Resource deadlock would occur.
+    DEADLK = 16,
+    /// Destination address required.
+    DESTADDRREQ = 17,
+    /// Mathematics argument out of domain of function.
+    DOM = 18,
+    /// Reserved.
+    DQUOT = 19,
+    /// File exists.
+    EXIST = 20,
+    /// Bad address.
+    FAULT = 21,
+    /// File too large.
+    FBIG = 22,
+    /// Host is unreachable.
+    HOSTUNREACH = 23,
+    /// Identifier removed.
+    IDRM = 24,
+    /// Illegal byte sequence.
+    ILSEQ = 25,
+    /// Operation in progress.
+    INPROGRESS = 26,
+    /// Interrupted function.
+    INTR = 27,
+    /// Invalid argument.
+    INVAL = 28,
+    /// I/O error.
+    IO = 29,
+    /// Socket is connected.
+    ISCONN = 30,
+    /// Is a directory.
+    ISDIR = 31,
+    /// Too many levels of symbolic links.
+    LOOP = 32,
+    /// File descriptor value too large.
+    MFILE = 33,
+    /// Too many links.
+    MLINK = 34,
+    /// Message too large.
+    MSGSIZE = 35,
+    /// Reserved.
+    MULTIHOP = 36,
+    /// Filename too long.
+    NAMETOOLONG = 37,
+    /// Network is down.
+    NETDOWN = 38,
+    /// Connection aborted by network.
+    NETRESET = 39,
+    /// Network unreachable.
+    NETUNREACH = 40,
+    /// Too many files open in system.
+    NFILE = 41,
+    /// No buffer space available.
+    NOBUFS = 42,
+    /// No such device.
+    NODEV = 43,
+    /// No such file or directory.
+    NOENT = 44,
+    /// Executable file format error.
+    NOEXEC = 45,
+    /// No locks available.
+    NOLCK = 46,
+    /// Reserved.
+    NOLINK = 47,
+    /// Not enough space.
+    NOMEM = 48,
+    /// No message of the desired type.
+    NOMSG = 49,
+    /// Protocol not available.
+    NOPROTOOPT = 50,
+    /// No space left on device.
+    NOSPC = 51,
+    /// Function not supported.
+    NOSYS = 52,
+    /// The socket is not connected.
+    NOTCONN = 53,
+    /// Not a directory or a symbolic link to a directory.
+    NOTDIR = 54,
+    /// Directory not empty.
+    NOTEMPTY = 55,
+    /// State not recoverable.
+    NOTRECOVERABLE = 56,
+    /// Not a socket.
+    NOTSOCK = 57,
+    /// Not supported, or operation not supported on socket.
+    NOTSUP = 58,
+    /// Inappropriate I/O control operation.
+    NOTTY = 59,
+    /// No such device or address.
+    NXIO = 60,
+    /// Value too large to be stored in data type.
+    OVERFLOW = 61,
+    /// Previous owner died.
+    OWNERDEAD = 62,
+    /// Operation not permitted.
+    PERM = 63,
+    /// Broken pipe.
+    PIPE = 64,
+    /// Protocol error.
+    PROTO = 65,
+    /// Protocol not supported.
+    PROTONOSUPPORT = 66,
+    /// Protocol wrong type for socket.
+    PROTOTYPE = 67,
+    /// Result too large.
+    RANGE = 68,
+    /// Read-only file system.
+    ROFS = 69,
+    /// Invalid seek.
+    SPIPE = 70,
+    /// No such process.
+    SRCH = 71,
+    /// Reserved.
+    STALE = 72,
+    /// Connection timed out.
+    TIMEDOUT = 73,
+    /// Text file busy.
+    TXTBSY = 74,
+    /// Cross-device link.
+    XDEV = 75,
+    /// Extension: Capabilities insufficient.
+    NOTCAPABLE = 76,
 }
 
 bitflags! {
@@ -441,30 +441,30 @@ bitflags! {
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum eventtype {
-  /// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id)
-  /// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout).
-  CLOCK          = 1,
-  /// Condition variable [`subscription.union.condvar.condvar`](struct.subscription_condvar.html#structfield.condvar) has
-  /// been woken up and [`subscription.union.condvar.lock`](struct.subscription_condvar.html#structfield.lock) has been
-  /// acquired for writing.
-  CONDVAR        = 2,
-  /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
-  /// data available for reading. This event always triggers
-  /// for regular files.
-  FD_READ        = 3,
-  /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
-  /// capacity available for writing. This event always
-  /// triggers for regular files.
-  FD_WRITE       = 4,
-  /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
-  /// reading.
-  LOCK_RDLOCK    = 5,
-  /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
-  /// writing.
-  LOCK_WRLOCK    = 6,
-  /// The process associated with process descriptor
-  /// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated.
-  PROC_TERMINATE = 7,
+    /// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id)
+    /// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout).
+    CLOCK = 1,
+    /// Condition variable [`subscription.union.condvar.condvar`](struct.subscription_condvar.html#structfield.condvar) has
+    /// been woken up and [`subscription.union.condvar.lock`](struct.subscription_condvar.html#structfield.lock) has been
+    /// acquired for writing.
+    CONDVAR = 2,
+    /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
+    /// data available for reading. This event always triggers
+    /// for regular files.
+    FD_READ = 3,
+    /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
+    /// capacity available for writing. This event always
+    /// triggers for regular files.
+    FD_WRITE = 4,
+    /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
+    /// reading.
+    LOCK_RDLOCK = 5,
+    /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
+    /// writing.
+    LOCK_WRLOCK = 6,
+    /// The process associated with process descriptor
+    /// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated.
+    PROC_TERMINATE = 7,
 }
 
 /// Exit code generated by a process when exiting.
@@ -483,7 +483,7 @@ pub struct fd(pub u32);
 pub const PROCESS_CHILD: fd = fd(0xffffffff);
 /// Passed to [`mem_map()`](fn.mem_map.html) when creating a mapping to
 /// anonymous memory.
-pub const MAP_ANON_FD  : fd = fd(0xffffffff);
+pub const MAP_ANON_FD: fd = fd(0xffffffff);
 
 bitflags! {
   /// File descriptor flags.
@@ -533,33 +533,33 @@ pub type filesize = u64;
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum filetype {
-  /// The type of the file descriptor or file is unknown or
-  /// is different from any of the other types specified.
-  UNKNOWN          =   0,
-  /// The file descriptor or file refers to a block device
-  /// inode.
-  BLOCK_DEVICE     =  16,
-  /// The file descriptor or file refers to a character
-  /// device inode.
-  CHARACTER_DEVICE =  17,
-  /// The file descriptor or file refers to a directory
-  /// inode.
-  DIRECTORY        =  32,
-  /// The file descriptor refers to a process handle.
-  PROCESS          =  80,
-  /// The file descriptor or file refers to a regular file
-  /// inode.
-  REGULAR_FILE     =  96,
-  /// The file descriptor refers to a shared memory object.
-  SHARED_MEMORY    = 112,
-  /// The file descriptor or file refers to a datagram
-  /// socket.
-  SOCKET_DGRAM     = 128,
-  /// The file descriptor or file refers to a byte-stream
-  /// socket.
-  SOCKET_STREAM    = 130,
-  /// The file refers to a symbolic link inode.
-  SYMBOLIC_LINK    = 144,
+    /// The type of the file descriptor or file is unknown or
+    /// is different from any of the other types specified.
+    UNKNOWN = 0,
+    /// The file descriptor or file refers to a block device
+    /// inode.
+    BLOCK_DEVICE = 16,
+    /// The file descriptor or file refers to a character
+    /// device inode.
+    CHARACTER_DEVICE = 17,
+    /// The file descriptor or file refers to a directory
+    /// inode.
+    DIRECTORY = 32,
+    /// The file descriptor refers to a process handle.
+    PROCESS = 80,
+    /// The file descriptor or file refers to a regular file
+    /// inode.
+    REGULAR_FILE = 96,
+    /// The file descriptor refers to a shared memory object.
+    SHARED_MEMORY = 112,
+    /// The file descriptor or file refers to a datagram
+    /// socket.
+    SOCKET_DGRAM = 128,
+    /// The file descriptor or file refers to a byte-stream
+    /// socket.
+    SOCKET_STREAM = 130,
+    /// The file refers to a symbolic link inode.
+    SYMBOLIC_LINK = 144,
 }
 
 bitflags! {
@@ -599,13 +599,13 @@ pub type linkcount = u32;
 pub struct lock(pub u32);
 /// Value indicating that the lock is in its initial
 /// unlocked state.
-pub const LOCK_UNLOCKED      : lock = lock(0x00000000);
+pub const LOCK_UNLOCKED: lock = lock(0x00000000);
 /// Bitmask indicating that the lock is write-locked. If
 /// set, the lower 30 bits of the lock contain the
 /// identifier of the thread that owns the write lock.
 /// Otherwise, the lower 30 bits of the lock contain the
 /// number of acquired read locks.
-pub const LOCK_WRLOCKED      : lock = lock(0x40000000);
+pub const LOCK_WRLOCKED: lock = lock(0x40000000);
 /// Bitmask indicating that the lock is either read locked
 /// or write locked, and that one or more threads have
 /// their execution suspended, waiting to acquire the
@@ -623,7 +623,7 @@ pub const LOCK_KERNEL_MANAGED: lock = lock(0x80000000);
 /// Value indicating that the lock is in an incorrect
 /// state. A lock cannot be in its initial unlocked state,
 /// while also managed by the kernel.
-pub const LOCK_BOGUS         : lock = lock(0x80000000);
+pub const LOCK_BOGUS: lock = lock(0x80000000);
 
 bitflags! {
   /// Flags determining the method of how paths are resolved.
@@ -850,10 +850,10 @@ bitflags! {
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum scope {
-  /// The object is stored in private memory.
-  PRIVATE = 4,
-  /// The object is stored in shared memory.
-  SHARED  = 8,
+    /// The object is stored in private memory.
+    PRIVATE = 4,
+    /// The object is stored in shared memory.
+    SHARED = 8,
 }
 
 bitflags! {
@@ -881,110 +881,110 @@ bitflags! {
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum signal {
-  /// Process abort signal.
-  ///
-  /// Action: Terminates the process.
-  ABRT   =  1,
-  /// Alarm clock.
-  ///
-  /// Action: Terminates the process.
-  ALRM   =  2,
-  /// Access to an undefined portion of a memory object.
-  ///
-  /// Action: Terminates the process.
-  BUS    =  3,
-  /// Child process terminated, stopped, or continued.
-  ///
-  /// Action: Ignored.
-  CHLD   =  4,
-  /// Continue executing, if stopped.
-  ///
-  /// Action: Continues executing, if stopped.
-  CONT   =  5,
-  /// Erroneous arithmetic operation.
-  ///
-  /// Action: Terminates the process.
-  FPE    =  6,
-  /// Hangup.
-  ///
-  /// Action: Terminates the process.
-  HUP    =  7,
-  /// Illegal instruction.
-  ///
-  /// Action: Terminates the process.
-  ILL    =  8,
-  /// Terminate interrupt signal.
-  ///
-  /// Action: Terminates the process.
-  INT    =  9,
-  /// Kill.
-  ///
-  /// Action: Terminates the process.
-  KILL   = 10,
-  /// Write on a pipe with no one to read it.
-  ///
-  /// Action: Ignored.
-  PIPE   = 11,
-  /// Terminal quit signal.
-  ///
-  /// Action: Terminates the process.
-  QUIT   = 12,
-  /// Invalid memory reference.
-  ///
-  /// Action: Terminates the process.
-  SEGV   = 13,
-  /// Stop executing.
-  ///
-  /// Action: Stops executing.
-  STOP   = 14,
-  /// Bad system call.
-  ///
-  /// Action: Terminates the process.
-  SYS    = 15,
-  /// Termination signal.
-  ///
-  /// Action: Terminates the process.
-  TERM   = 16,
-  /// Trace/breakpoint trap.
-  ///
-  /// Action: Terminates the process.
-  TRAP   = 17,
-  /// Terminal stop signal.
-  ///
-  /// Action: Stops executing.
-  TSTP   = 18,
-  /// Background process attempting read.
-  ///
-  /// Action: Stops executing.
-  TTIN   = 19,
-  /// Background process attempting write.
-  ///
-  /// Action: Stops executing.
-  TTOU   = 20,
-  /// High bandwidth data is available at a socket.
-  ///
-  /// Action: Ignored.
-  URG    = 21,
-  /// User-defined signal 1.
-  ///
-  /// Action: Terminates the process.
-  USR1   = 22,
-  /// User-defined signal 2.
-  ///
-  /// Action: Terminates the process.
-  USR2   = 23,
-  /// Virtual timer expired.
-  ///
-  /// Action: Terminates the process.
-  VTALRM = 24,
-  /// CPU time limit exceeded.
-  ///
-  /// Action: Terminates the process.
-  XCPU   = 25,
-  /// File size limit exceeded.
-  ///
-  /// Action: Terminates the process.
-  XFSZ   = 26,
+    /// Process abort signal.
+    ///
+    /// Action: Terminates the process.
+    ABRT = 1,
+    /// Alarm clock.
+    ///
+    /// Action: Terminates the process.
+    ALRM = 2,
+    /// Access to an undefined portion of a memory object.
+    ///
+    /// Action: Terminates the process.
+    BUS = 3,
+    /// Child process terminated, stopped, or continued.
+    ///
+    /// Action: Ignored.
+    CHLD = 4,
+    /// Continue executing, if stopped.
+    ///
+    /// Action: Continues executing, if stopped.
+    CONT = 5,
+    /// Erroneous arithmetic operation.
+    ///
+    /// Action: Terminates the process.
+    FPE = 6,
+    /// Hangup.
+    ///
+    /// Action: Terminates the process.
+    HUP = 7,
+    /// Illegal instruction.
+    ///
+    /// Action: Terminates the process.
+    ILL = 8,
+    /// Terminate interrupt signal.
+    ///
+    /// Action: Terminates the process.
+    INT = 9,
+    /// Kill.
+    ///
+    /// Action: Terminates the process.
+    KILL = 10,
+    /// Write on a pipe with no one to read it.
+    ///
+    /// Action: Ignored.
+    PIPE = 11,
+    /// Terminal quit signal.
+    ///
+    /// Action: Terminates the process.
+    QUIT = 12,
+    /// Invalid memory reference.
+    ///
+    /// Action: Terminates the process.
+    SEGV = 13,
+    /// Stop executing.
+    ///
+    /// Action: Stops executing.
+    STOP = 14,
+    /// Bad system call.
+    ///
+    /// Action: Terminates the process.
+    SYS = 15,
+    /// Termination signal.
+    ///
+    /// Action: Terminates the process.
+    TERM = 16,
+    /// Trace/breakpoint trap.
+    ///
+    /// Action: Terminates the process.
+    TRAP = 17,
+    /// Terminal stop signal.
+    ///
+    /// Action: Stops executing.
+    TSTP = 18,
+    /// Background process attempting read.
+    ///
+    /// Action: Stops executing.
+    TTIN = 19,
+    /// Background process attempting write.
+    ///
+    /// Action: Stops executing.
+    TTOU = 20,
+    /// High bandwidth data is available at a socket.
+    ///
+    /// Action: Ignored.
+    URG = 21,
+    /// User-defined signal 1.
+    ///
+    /// Action: Terminates the process.
+    USR1 = 22,
+    /// User-defined signal 2.
+    ///
+    /// Action: Terminates the process.
+    USR2 = 23,
+    /// Virtual timer expired.
+    ///
+    /// Action: Terminates the process.
+    VTALRM = 24,
+    /// CPU time limit exceeded.
+    ///
+    /// Action: Terminates the process.
+    XCPU = 25,
+    /// File size limit exceeded.
+    ///
+    /// Action: Terminates the process.
+    XFSZ = 26,
 }
 
 bitflags! {
@@ -1052,12 +1052,12 @@ pub type userdata = u64;
 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
 #[non_exhaustive]
 pub enum whence {
-  /// Seek relative to current position.
-  CUR = 1,
-  /// Seek relative to end-of-file.
-  END = 2,
-  /// Seek relative to start-of-file.
-  SET = 3,
+    /// Seek relative to current position.
+    CUR = 1,
+    /// Seek relative to end-of-file.
+    END = 2,
+    /// Seek relative to start-of-file.
+    SET = 3,
 }
 
 /// Auxiliary vector entry.
@@ -1073,631 +1073,629 @@ pub enum whence {
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct auxv {
-  /// The type of the auxiliary vector entry.
-  pub a_type: auxtype,
-  pub union: auxv_union
+    /// The type of the auxiliary vector entry.
+    pub a_type: auxtype,
+    pub union: auxv_union,
 }
 /// A union inside `auxv`.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub union auxv_union {
-  /// Used when `a_type` is [`ARGDATALEN`](enum.auxtype.html#variant.ARGDATALEN), [`CANARYLEN`](enum.auxtype.html#variant.CANARYLEN), [`NCPUS`](enum.auxtype.html#variant.NCPUS), [`PAGESZ`](enum.auxtype.html#variant.PAGESZ), [`PHNUM`](enum.auxtype.html#variant.PHNUM), or [`TID`](enum.auxtype.html#variant.TID).
-/// A numerical value.
-  pub a_val: usize,
-  /// Used when `a_type` is [`ARGDATA`](enum.auxtype.html#variant.ARGDATA), [`BASE`](enum.auxtype.html#variant.BASE), [`CANARY`](enum.auxtype.html#variant.CANARY), [`PHDR`](enum.auxtype.html#variant.PHDR), [`PID`](enum.auxtype.html#variant.PID), or [`SYSINFO_EHDR`](enum.auxtype.html#variant.SYSINFO_EHDR).
-/// A pointer value.
-  pub a_ptr: *mut (),
+    /// Used when `a_type` is [`ARGDATALEN`](enum.auxtype.html#variant.ARGDATALEN), [`CANARYLEN`](enum.auxtype.html#variant.CANARYLEN), [`NCPUS`](enum.auxtype.html#variant.NCPUS), [`PAGESZ`](enum.auxtype.html#variant.PAGESZ), [`PHNUM`](enum.auxtype.html#variant.PHNUM), or [`TID`](enum.auxtype.html#variant.TID).
+    /// A numerical value.
+    pub a_val: usize,
+    /// Used when `a_type` is [`ARGDATA`](enum.auxtype.html#variant.ARGDATA), [`BASE`](enum.auxtype.html#variant.BASE), [`CANARY`](enum.auxtype.html#variant.CANARY), [`PHDR`](enum.auxtype.html#variant.PHDR), [`PID`](enum.auxtype.html#variant.PID), or [`SYSINFO_EHDR`](enum.auxtype.html#variant.SYSINFO_EHDR).
+    /// A pointer value.
+    pub a_ptr: *mut (),
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn auxv_layout_test_32() {
-  assert_eq!(core::mem::size_of::<auxv>(), 8);
-  assert_eq!(core::mem::align_of::<auxv>(), 4);
-  unsafe {
-    let obj: auxv = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.a_type as *const _ as usize - base, 0);
-    assert_eq!(&obj.union.a_val as *const _ as usize - base, 4);
-    assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 4);
-  }
+    assert_eq!(core::mem::size_of::<auxv>(), 8);
+    assert_eq!(core::mem::align_of::<auxv>(), 4);
+    unsafe {
+        let obj: auxv = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.a_type as *const _ as usize - base, 0);
+        assert_eq!(&obj.union.a_val as *const _ as usize - base, 4);
+        assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 4);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn auxv_layout_test_64() {
-  assert_eq!(core::mem::size_of::<auxv>(), 16);
-  assert_eq!(core::mem::align_of::<auxv>(), 8);
-  unsafe {
-    let obj: auxv = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.a_type as *const _ as usize - base, 0);
-    assert_eq!(&obj.union.a_val as *const _ as usize - base, 8);
-    assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 8);
-  }
+    assert_eq!(core::mem::size_of::<auxv>(), 16);
+    assert_eq!(core::mem::align_of::<auxv>(), 8);
+    unsafe {
+        let obj: auxv = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.a_type as *const _ as usize - base, 0);
+        assert_eq!(&obj.union.a_val as *const _ as usize - base, 8);
+        assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 8);
+    }
 }
 
 /// A region of memory for scatter/gather writes.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct ciovec {
-  /// The address and length of the buffer to be written.
-  pub buf: (*const (), usize),
+    /// The address and length of the buffer to be written.
+    pub buf: (*const (), usize),
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn ciovec_layout_test_32() {
-  assert_eq!(core::mem::size_of::<ciovec>(), 8);
-  assert_eq!(core::mem::align_of::<ciovec>(), 4);
-  unsafe {
-    let obj: ciovec = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
-  }
+    assert_eq!(core::mem::size_of::<ciovec>(), 8);
+    assert_eq!(core::mem::align_of::<ciovec>(), 4);
+    unsafe {
+        let obj: ciovec = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn ciovec_layout_test_64() {
-  assert_eq!(core::mem::size_of::<ciovec>(), 16);
-  assert_eq!(core::mem::align_of::<ciovec>(), 8);
-  unsafe {
-    let obj: ciovec = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
-  }
+    assert_eq!(core::mem::size_of::<ciovec>(), 16);
+    assert_eq!(core::mem::align_of::<ciovec>(), 8);
+    unsafe {
+        let obj: ciovec = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
+    }
 }
 
 /// A directory entry.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct dirent {
-  /// The offset of the next directory entry stored in this
-  /// directory.
-  pub d_next: dircookie,
-  /// The serial number of the file referred to by this
-  /// directory entry.
-  pub d_ino: inode,
-  /// The length of the name of the directory entry.
-  pub d_namlen: u32,
-  /// The type of the file referred to by this directory
-  /// entry.
-  pub d_type: filetype,
+    /// The offset of the next directory entry stored in this
+    /// directory.
+    pub d_next: dircookie,
+    /// The serial number of the file referred to by this
+    /// directory entry.
+    pub d_ino: inode,
+    /// The length of the name of the directory entry.
+    pub d_namlen: u32,
+    /// The type of the file referred to by this directory
+    /// entry.
+    pub d_type: filetype,
 }
 #[test]
 fn dirent_layout_test() {
-  assert_eq!(core::mem::size_of::<dirent>(), 24);
-  assert_eq!(core::mem::align_of::<dirent>(), 8);
-  unsafe {
-    let obj: dirent = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.d_next as *const _ as usize - base, 0);
-    assert_eq!(&obj.d_ino as *const _ as usize - base, 8);
-    assert_eq!(&obj.d_namlen as *const _ as usize - base, 16);
-    assert_eq!(&obj.d_type as *const _ as usize - base, 20);
-  }
+    assert_eq!(core::mem::size_of::<dirent>(), 24);
+    assert_eq!(core::mem::align_of::<dirent>(), 8);
+    unsafe {
+        let obj: dirent = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.d_next as *const _ as usize - base, 0);
+        assert_eq!(&obj.d_ino as *const _ as usize - base, 8);
+        assert_eq!(&obj.d_namlen as *const _ as usize - base, 16);
+        assert_eq!(&obj.d_type as *const _ as usize - base, 20);
+    }
 }
 
 /// An event that occurred.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct event {
-  /// User-provided value that got attached to
-  /// [`subscription.userdata`](struct.subscription.html#structfield.userdata).
-  pub userdata: userdata,
-  /// If non-zero, an error that occurred while processing
-  /// the subscription request.
-  pub error: errno,
-  /// The type of the event that occurred.
-  pub type_: eventtype,
-  pub union: event_union
+    /// User-provided value that got attached to
+    /// [`subscription.userdata`](struct.subscription.html#structfield.userdata).
+    pub userdata: userdata,
+    /// If non-zero, an error that occurred while processing
+    /// the subscription request.
+    pub error: errno,
+    /// The type of the event that occurred.
+    pub type_: eventtype,
+    pub union: event_union,
 }
 /// A union inside `event`.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub union event_union {
-  /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
-  pub fd_readwrite: event_fd_readwrite,
-  /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
-  pub proc_terminate: event_proc_terminate,
+    /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+    pub fd_readwrite: event_fd_readwrite,
+    /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
+    pub proc_terminate: event_proc_terminate,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct event_fd_readwrite {
-  /// The number of bytes available
-  /// for reading or writing.
-  pub nbytes: filesize,
-  /// Obsolete.
-  pub unused: [u8; 4],
-  /// The state of the file
-  /// descriptor.
-  pub flags: eventrwflags,
+    /// The number of bytes available
+    /// for reading or writing.
+    pub nbytes: filesize,
+    /// Obsolete.
+    pub unused: [u8; 4],
+    /// The state of the file
+    /// descriptor.
+    pub flags: eventrwflags,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct event_proc_terminate {
-  /// Obsolete.
-  pub unused: [u8; 4],
-  /// If zero, the process has
-  /// exited.
-  /// Otherwise, the signal
-  /// condition causing it to
-  /// terminated.
-  pub signal: signal,
-  /// If exited, the exit code of
-  /// the process.
-  pub exitcode: exitcode,
+    /// Obsolete.
+    pub unused: [u8; 4],
+    /// If zero, the process has
+    /// exited.
+    /// Otherwise, the signal
+    /// condition causing it to
+    /// terminated.
+    pub signal: signal,
+    /// If exited, the exit code of
+    /// the process.
+    pub exitcode: exitcode,
 }
 #[test]
 fn event_layout_test() {
-  assert_eq!(core::mem::size_of::<event>(), 32);
-  assert_eq!(core::mem::align_of::<event>(), 8);
-  unsafe {
-    let obj: event = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
-    assert_eq!(&obj.error as *const _ as usize - base, 8);
-    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
-    assert_eq!(&obj.union.fd_readwrite.nbytes as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.fd_readwrite.unused as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 28);
-    assert_eq!(&obj.union.proc_terminate.unused as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.proc_terminate.signal as *const _ as usize - base, 20);
-    assert_eq!(&obj.union.proc_terminate.exitcode as *const _ as usize - base, 24);
-  }
+    assert_eq!(core::mem::size_of::<event>(), 32);
+    assert_eq!(core::mem::align_of::<event>(), 8);
+    unsafe {
+        let obj: event = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+        assert_eq!(&obj.error as *const _ as usize - base, 8);
+        assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+        assert_eq!(&obj.union.fd_readwrite.nbytes as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.fd_readwrite.unused as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 28);
+        assert_eq!(&obj.union.proc_terminate.unused as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.proc_terminate.signal as *const _ as usize - base, 20);
+        assert_eq!(&obj.union.proc_terminate.exitcode as *const _ as usize - base, 24);
+    }
 }
 
 /// File descriptor attributes.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct fdstat {
-  /// File type.
-  pub fs_filetype: filetype,
-  /// File descriptor flags.
-  pub fs_flags: fdflags,
-  /// Rights that apply to this file descriptor.
-  pub fs_rights_base: rights,
-  /// Maximum set of rights that can be installed on new
-  /// file descriptors that are created through this file
-  /// descriptor, e.g., through [`file_open()`](fn.file_open.html).
-  pub fs_rights_inheriting: rights,
+    /// File type.
+    pub fs_filetype: filetype,
+    /// File descriptor flags.
+    pub fs_flags: fdflags,
+    /// Rights that apply to this file descriptor.
+    pub fs_rights_base: rights,
+    /// Maximum set of rights that can be installed on new
+    /// file descriptors that are created through this file
+    /// descriptor, e.g., through [`file_open()`](fn.file_open.html).
+    pub fs_rights_inheriting: rights,
 }
 #[test]
 fn fdstat_layout_test() {
-  assert_eq!(core::mem::size_of::<fdstat>(), 24);
-  assert_eq!(core::mem::align_of::<fdstat>(), 8);
-  unsafe {
-    let obj: fdstat = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0);
-    assert_eq!(&obj.fs_flags as *const _ as usize - base, 2);
-    assert_eq!(&obj.fs_rights_base as *const _ as usize - base, 8);
-    assert_eq!(&obj.fs_rights_inheriting as *const _ as usize - base, 16);
-  }
+    assert_eq!(core::mem::size_of::<fdstat>(), 24);
+    assert_eq!(core::mem::align_of::<fdstat>(), 8);
+    unsafe {
+        let obj: fdstat = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0);
+        assert_eq!(&obj.fs_flags as *const _ as usize - base, 2);
+        assert_eq!(&obj.fs_rights_base as *const _ as usize - base, 8);
+        assert_eq!(&obj.fs_rights_inheriting as *const _ as usize - base, 16);
+    }
 }
 
 /// File attributes.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct filestat {
-  /// Device ID of device containing the file.
-  pub st_dev: device,
-  /// File serial number.
-  pub st_ino: inode,
-  /// File type.
-  pub st_filetype: filetype,
-  /// Number of hard links to the file.
-  pub st_nlink: linkcount,
-  /// For regular files, the file size in bytes. For
-  /// symbolic links, the length in bytes of the pathname
-  /// contained in the symbolic link.
-  pub st_size: filesize,
-  /// Last data access timestamp.
-  pub st_atim: timestamp,
-  /// Last data modification timestamp.
-  pub st_mtim: timestamp,
-  /// Last file status change timestamp.
-  pub st_ctim: timestamp,
+    /// Device ID of device containing the file.
+    pub st_dev: device,
+    /// File serial number.
+    pub st_ino: inode,
+    /// File type.
+    pub st_filetype: filetype,
+    /// Number of hard links to the file.
+    pub st_nlink: linkcount,
+    /// For regular files, the file size in bytes. For
+    /// symbolic links, the length in bytes of the pathname
+    /// contained in the symbolic link.
+    pub st_size: filesize,
+    /// Last data access timestamp.
+    pub st_atim: timestamp,
+    /// Last data modification timestamp.
+    pub st_mtim: timestamp,
+    /// Last file status change timestamp.
+    pub st_ctim: timestamp,
 }
 #[test]
 fn filestat_layout_test() {
-  assert_eq!(core::mem::size_of::<filestat>(), 56);
-  assert_eq!(core::mem::align_of::<filestat>(), 8);
-  unsafe {
-    let obj: filestat = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.st_dev as *const _ as usize - base, 0);
-    assert_eq!(&obj.st_ino as *const _ as usize - base, 8);
-    assert_eq!(&obj.st_filetype as *const _ as usize - base, 16);
-    assert_eq!(&obj.st_nlink as *const _ as usize - base, 20);
-    assert_eq!(&obj.st_size as *const _ as usize - base, 24);
-    assert_eq!(&obj.st_atim as *const _ as usize - base, 32);
-    assert_eq!(&obj.st_mtim as *const _ as usize - base, 40);
-    assert_eq!(&obj.st_ctim as *const _ as usize - base, 48);
-  }
+    assert_eq!(core::mem::size_of::<filestat>(), 56);
+    assert_eq!(core::mem::align_of::<filestat>(), 8);
+    unsafe {
+        let obj: filestat = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.st_dev as *const _ as usize - base, 0);
+        assert_eq!(&obj.st_ino as *const _ as usize - base, 8);
+        assert_eq!(&obj.st_filetype as *const _ as usize - base, 16);
+        assert_eq!(&obj.st_nlink as *const _ as usize - base, 20);
+        assert_eq!(&obj.st_size as *const _ as usize - base, 24);
+        assert_eq!(&obj.st_atim as *const _ as usize - base, 32);
+        assert_eq!(&obj.st_mtim as *const _ as usize - base, 40);
+        assert_eq!(&obj.st_ctim as *const _ as usize - base, 48);
+    }
 }
 
 /// A region of memory for scatter/gather reads.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct iovec {
-  /// The address and length of the buffer to be filled.
-  pub buf: (*mut (), usize),
+    /// The address and length of the buffer to be filled.
+    pub buf: (*mut (), usize),
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn iovec_layout_test_32() {
-  assert_eq!(core::mem::size_of::<iovec>(), 8);
-  assert_eq!(core::mem::align_of::<iovec>(), 4);
-  unsafe {
-    let obj: iovec = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
-  }
+    assert_eq!(core::mem::size_of::<iovec>(), 8);
+    assert_eq!(core::mem::align_of::<iovec>(), 4);
+    unsafe {
+        let obj: iovec = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn iovec_layout_test_64() {
-  assert_eq!(core::mem::size_of::<iovec>(), 16);
-  assert_eq!(core::mem::align_of::<iovec>(), 8);
-  unsafe {
-    let obj: iovec = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
-  }
+    assert_eq!(core::mem::size_of::<iovec>(), 16);
+    assert_eq!(core::mem::align_of::<iovec>(), 8);
+    unsafe {
+        let obj: iovec = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
+    }
 }
 
 /// Path lookup properties.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct lookup {
-  /// The working directory at which the resolution of the
-  /// path starts.
-  pub fd: fd,
-  /// Flags determining the method of how the path is
-  /// resolved.
-  pub flags: lookupflags,
+    /// The working directory at which the resolution of the
+    /// path starts.
+    pub fd: fd,
+    /// Flags determining the method of how the path is
+    /// resolved.
+    pub flags: lookupflags,
 }
 #[test]
 fn lookup_layout_test() {
-  assert_eq!(core::mem::size_of::<lookup>(), 8);
-  assert_eq!(core::mem::align_of::<lookup>(), 4);
-  unsafe {
-    let obj: lookup = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.fd as *const _ as usize - base, 0);
-    assert_eq!(&obj.flags as *const _ as usize - base, 4);
-  }
+    assert_eq!(core::mem::size_of::<lookup>(), 8);
+    assert_eq!(core::mem::align_of::<lookup>(), 4);
+    unsafe {
+        let obj: lookup = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.fd as *const _ as usize - base, 0);
+        assert_eq!(&obj.flags as *const _ as usize - base, 4);
+    }
 }
 
 /// Entry point for a process (`_start`).
 ///
 /// **auxv**:
 /// The auxiliary vector. See [`auxv`](struct.auxv.html).
-pub type processentry = unsafe extern "C" fn(
-  auxv: *const auxv,
-) -> ();
+pub type processentry = unsafe extern "C" fn(auxv: *const auxv) -> ();
 
 /// Arguments of [`sock_recv()`](fn.sock_recv.html).
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct recv_in {
-  /// List of scatter/gather vectors where message data
-  /// should be stored.
-  pub ri_data: (*const iovec, usize),
-  /// Buffer where numbers of incoming file descriptors
-  /// should be stored.
-  pub ri_fds: (*mut fd, usize),
-  /// Message flags.
-  pub ri_flags: riflags,
+    /// List of scatter/gather vectors where message data
+    /// should be stored.
+    pub ri_data: (*const iovec, usize),
+    /// Buffer where numbers of incoming file descriptors
+    /// should be stored.
+    pub ri_fds: (*mut fd, usize),
+    /// Message flags.
+    pub ri_flags: riflags,
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn recv_in_layout_test_32() {
-  assert_eq!(core::mem::size_of::<recv_in>(), 20);
-  assert_eq!(core::mem::align_of::<recv_in>(), 4);
-  unsafe {
-    let obj: recv_in = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4);
-    assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 8);
-    assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 12);
-    assert_eq!(&obj.ri_flags as *const _ as usize - base, 16);
-  }
+    assert_eq!(core::mem::size_of::<recv_in>(), 20);
+    assert_eq!(core::mem::align_of::<recv_in>(), 4);
+    unsafe {
+        let obj: recv_in = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4);
+        assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 8);
+        assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 12);
+        assert_eq!(&obj.ri_flags as *const _ as usize - base, 16);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn recv_in_layout_test_64() {
-  assert_eq!(core::mem::size_of::<recv_in>(), 40);
-  assert_eq!(core::mem::align_of::<recv_in>(), 8);
-  unsafe {
-    let obj: recv_in = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8);
-    assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 16);
-    assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 24);
-    assert_eq!(&obj.ri_flags as *const _ as usize - base, 32);
-  }
+    assert_eq!(core::mem::size_of::<recv_in>(), 40);
+    assert_eq!(core::mem::align_of::<recv_in>(), 8);
+    unsafe {
+        let obj: recv_in = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8);
+        assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 16);
+        assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 24);
+        assert_eq!(&obj.ri_flags as *const _ as usize - base, 32);
+    }
 }
 
 /// Results of [`sock_recv()`](fn.sock_recv.html).
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct recv_out {
-  /// Number of bytes stored in [`recv_in.ri_data`](struct.recv_in.html#structfield.ri_data).
-  pub ro_datalen: usize,
-  /// Number of file descriptors stored in [`recv_in.ri_fds`](struct.recv_in.html#structfield.ri_fds).
-  pub ro_fdslen: usize,
-  /// Fields that were used by previous implementations.
-  pub ro_unused: [u8; 40],
-  /// Message flags.
-  pub ro_flags: roflags,
+    /// Number of bytes stored in [`recv_in.ri_data`](struct.recv_in.html#structfield.ri_data).
+    pub ro_datalen: usize,
+    /// Number of file descriptors stored in [`recv_in.ri_fds`](struct.recv_in.html#structfield.ri_fds).
+    pub ro_fdslen: usize,
+    /// Fields that were used by previous implementations.
+    pub ro_unused: [u8; 40],
+    /// Message flags.
+    pub ro_flags: roflags,
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn recv_out_layout_test_32() {
-  assert_eq!(core::mem::size_of::<recv_out>(), 52);
-  assert_eq!(core::mem::align_of::<recv_out>(), 4);
-  unsafe {
-    let obj: recv_out = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
-    assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4);
-    assert_eq!(&obj.ro_unused as *const _ as usize - base, 8);
-    assert_eq!(&obj.ro_flags as *const _ as usize - base, 48);
-  }
+    assert_eq!(core::mem::size_of::<recv_out>(), 52);
+    assert_eq!(core::mem::align_of::<recv_out>(), 4);
+    unsafe {
+        let obj: recv_out = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
+        assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4);
+        assert_eq!(&obj.ro_unused as *const _ as usize - base, 8);
+        assert_eq!(&obj.ro_flags as *const _ as usize - base, 48);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn recv_out_layout_test_64() {
-  assert_eq!(core::mem::size_of::<recv_out>(), 64);
-  assert_eq!(core::mem::align_of::<recv_out>(), 8);
-  unsafe {
-    let obj: recv_out = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
-    assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8);
-    assert_eq!(&obj.ro_unused as *const _ as usize - base, 16);
-    assert_eq!(&obj.ro_flags as *const _ as usize - base, 56);
-  }
+    assert_eq!(core::mem::size_of::<recv_out>(), 64);
+    assert_eq!(core::mem::align_of::<recv_out>(), 8);
+    unsafe {
+        let obj: recv_out = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
+        assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8);
+        assert_eq!(&obj.ro_unused as *const _ as usize - base, 16);
+        assert_eq!(&obj.ro_flags as *const _ as usize - base, 56);
+    }
 }
 
 /// Arguments of [`sock_send()`](fn.sock_send.html).
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct send_in {
-  /// List of scatter/gather vectors where message data
-  /// should be retrieved.
-  pub si_data: (*const ciovec, usize),
-  /// File descriptors that need to be attached to the
-  /// message.
-  pub si_fds: (*const fd, usize),
-  /// Message flags.
-  pub si_flags: siflags,
+    /// List of scatter/gather vectors where message data
+    /// should be retrieved.
+    pub si_data: (*const ciovec, usize),
+    /// File descriptors that need to be attached to the
+    /// message.
+    pub si_fds: (*const fd, usize),
+    /// Message flags.
+    pub si_flags: siflags,
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn send_in_layout_test_32() {
-  assert_eq!(core::mem::size_of::<send_in>(), 20);
-  assert_eq!(core::mem::align_of::<send_in>(), 4);
-  unsafe {
-    let obj: send_in = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4);
-    assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 8);
-    assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 12);
-    assert_eq!(&obj.si_flags as *const _ as usize - base, 16);
-  }
+    assert_eq!(core::mem::size_of::<send_in>(), 20);
+    assert_eq!(core::mem::align_of::<send_in>(), 4);
+    unsafe {
+        let obj: send_in = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4);
+        assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 8);
+        assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 12);
+        assert_eq!(&obj.si_flags as *const _ as usize - base, 16);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn send_in_layout_test_64() {
-  assert_eq!(core::mem::size_of::<send_in>(), 40);
-  assert_eq!(core::mem::align_of::<send_in>(), 8);
-  unsafe {
-    let obj: send_in = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
-    assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8);
-    assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 16);
-    assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 24);
-    assert_eq!(&obj.si_flags as *const _ as usize - base, 32);
-  }
+    assert_eq!(core::mem::size_of::<send_in>(), 40);
+    assert_eq!(core::mem::align_of::<send_in>(), 8);
+    unsafe {
+        let obj: send_in = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
+        assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8);
+        assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 16);
+        assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 24);
+        assert_eq!(&obj.si_flags as *const _ as usize - base, 32);
+    }
 }
 
 /// Results of [`sock_send()`](fn.sock_send.html).
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct send_out {
-  /// Number of bytes transmitted.
-  pub so_datalen: usize,
+    /// Number of bytes transmitted.
+    pub so_datalen: usize,
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn send_out_layout_test_32() {
-  assert_eq!(core::mem::size_of::<send_out>(), 4);
-  assert_eq!(core::mem::align_of::<send_out>(), 4);
-  unsafe {
-    let obj: send_out = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
-  }
+    assert_eq!(core::mem::size_of::<send_out>(), 4);
+    assert_eq!(core::mem::align_of::<send_out>(), 4);
+    unsafe {
+        let obj: send_out = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn send_out_layout_test_64() {
-  assert_eq!(core::mem::size_of::<send_out>(), 8);
-  assert_eq!(core::mem::align_of::<send_out>(), 8);
-  unsafe {
-    let obj: send_out = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
-  }
+    assert_eq!(core::mem::size_of::<send_out>(), 8);
+    assert_eq!(core::mem::align_of::<send_out>(), 8);
+    unsafe {
+        let obj: send_out = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
+    }
 }
 
 /// Subscription to an event.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription {
-  /// User-provided value that is attached to the
-  /// subscription in the kernel and returned through
-  /// [`event.userdata`](struct.event.html#structfield.userdata).
-  pub userdata: userdata,
-  /// Used by previous implementations. Ignored.
-  pub unused: u16,
-  /// The type of the event to which to subscribe.
-  ///
-  /// Currently, [`CONDVAR`](enum.eventtype.html#variant.CONDVAR),
-  /// [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK), and [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK)
-  /// must be provided as the first subscription and may
-  /// only be followed by up to one other subscription,
-  /// having type [`CLOCK`](enum.eventtype.html#variant.CLOCK).
-  pub type_: eventtype,
-  pub union: subscription_union
+    /// User-provided value that is attached to the
+    /// subscription in the kernel and returned through
+    /// [`event.userdata`](struct.event.html#structfield.userdata).
+    pub userdata: userdata,
+    /// Used by previous implementations. Ignored.
+    pub unused: u16,
+    /// The type of the event to which to subscribe.
+    ///
+    /// Currently, [`CONDVAR`](enum.eventtype.html#variant.CONDVAR),
+    /// [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK), and [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK)
+    /// must be provided as the first subscription and may
+    /// only be followed by up to one other subscription,
+    /// having type [`CLOCK`](enum.eventtype.html#variant.CLOCK).
+    pub type_: eventtype,
+    pub union: subscription_union,
 }
 /// A union inside `subscription`.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub union subscription_union {
-  /// Used when `type_` is [`CLOCK`](enum.eventtype.html#variant.CLOCK).
-  pub clock: subscription_clock,
-  /// Used when `type_` is [`CONDVAR`](enum.eventtype.html#variant.CONDVAR).
-  pub condvar: subscription_condvar,
-  /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
-  pub fd_readwrite: subscription_fd_readwrite,
-  /// Used when `type_` is [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK) or [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK).
-  pub lock: subscription_lock,
-  /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
-  pub proc_terminate: subscription_proc_terminate,
+    /// Used when `type_` is [`CLOCK`](enum.eventtype.html#variant.CLOCK).
+    pub clock: subscription_clock,
+    /// Used when `type_` is [`CONDVAR`](enum.eventtype.html#variant.CONDVAR).
+    pub condvar: subscription_condvar,
+    /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+    pub fd_readwrite: subscription_fd_readwrite,
+    /// Used when `type_` is [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK) or [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK).
+    pub lock: subscription_lock,
+    /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
+    pub proc_terminate: subscription_proc_terminate,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription_clock {
-  /// The user-defined unique
-  /// identifier of the clock.
-  pub identifier: userdata,
-  /// The clock against which the
-  /// timestamp should be compared.
-  pub clock_id: clockid,
-  /// The absolute or relative
-  /// timestamp.
-  pub timeout: timestamp,
-  /// The amount of time that the
-  /// kernel may wait additionally
-  /// to coalesce with other events.
-  pub precision: timestamp,
-  /// Flags specifying whether the
-  /// timeout is absolute or
-  /// relative.
-  pub flags: subclockflags,
+    /// The user-defined unique
+    /// identifier of the clock.
+    pub identifier: userdata,
+    /// The clock against which the
+    /// timestamp should be compared.
+    pub clock_id: clockid,
+    /// The absolute or relative
+    /// timestamp.
+    pub timeout: timestamp,
+    /// The amount of time that the
+    /// kernel may wait additionally
+    /// to coalesce with other events.
+    pub precision: timestamp,
+    /// Flags specifying whether the
+    /// timeout is absolute or
+    /// relative.
+    pub flags: subclockflags,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription_condvar {
-  /// The condition variable on
-  /// which to wait to be woken up.
-  pub condvar: *mut condvar,
-  /// The lock that will be
-  /// released while waiting.
-  ///
-  /// The lock will be reacquired
-  /// for writing when the condition
-  /// variable triggers.
-  pub lock: *mut lock,
-  /// Whether the condition variable
-  /// is stored in private or shared
-  /// memory.
-  pub condvar_scope: scope,
-  /// Whether the lock is stored in
-  /// private or shared memory.
-  pub lock_scope: scope,
+    /// The condition variable on
+    /// which to wait to be woken up.
+    pub condvar: *mut condvar,
+    /// The lock that will be
+    /// released while waiting.
+    ///
+    /// The lock will be reacquired
+    /// for writing when the condition
+    /// variable triggers.
+    pub lock: *mut lock,
+    /// Whether the condition variable
+    /// is stored in private or shared
+    /// memory.
+    pub condvar_scope: scope,
+    /// Whether the lock is stored in
+    /// private or shared memory.
+    pub lock_scope: scope,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription_fd_readwrite {
-  /// The file descriptor on which
-  /// to wait for it to become ready
-  /// for reading or writing.
-  pub fd: fd,
-  /// Under which conditions to
-  /// trigger.
-  pub flags: subrwflags,
+    /// The file descriptor on which
+    /// to wait for it to become ready
+    /// for reading or writing.
+    pub fd: fd,
+    /// Under which conditions to
+    /// trigger.
+    pub flags: subrwflags,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription_lock {
-  /// The lock that will be acquired
-  /// for reading or writing.
-  pub lock: *mut lock,
-  /// Whether the lock is stored in
-  /// private or shared memory.
-  pub lock_scope: scope,
+    /// The lock that will be acquired
+    /// for reading or writing.
+    pub lock: *mut lock,
+    /// Whether the lock is stored in
+    /// private or shared memory.
+    pub lock_scope: scope,
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct subscription_proc_terminate {
-  /// The process descriptor on
-  /// which to wait for process
-  /// termination.
-  pub fd: fd,
+    /// The process descriptor on
+    /// which to wait for process
+    /// termination.
+    pub fd: fd,
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn subscription_layout_test_32() {
-  assert_eq!(core::mem::size_of::<subscription>(), 56);
-  assert_eq!(core::mem::align_of::<subscription>(), 8);
-  unsafe {
-    let obj: subscription = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
-    assert_eq!(&obj.unused as *const _ as usize - base, 8);
-    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
-    assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
-    assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
-    assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
-    assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 20);
-    assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 25);
-    assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
-    assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 20);
-    assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
-  }
+    assert_eq!(core::mem::size_of::<subscription>(), 56);
+    assert_eq!(core::mem::align_of::<subscription>(), 8);
+    unsafe {
+        let obj: subscription = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+        assert_eq!(&obj.unused as *const _ as usize - base, 8);
+        assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+        assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
+        assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
+        assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
+        assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 20);
+        assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 25);
+        assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
+        assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 20);
+        assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn subscription_layout_test_64() {
-  assert_eq!(core::mem::size_of::<subscription>(), 56);
-  assert_eq!(core::mem::align_of::<subscription>(), 8);
-  unsafe {
-    let obj: subscription = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
-    assert_eq!(&obj.unused as *const _ as usize - base, 8);
-    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
-    assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
-    assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
-    assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
-    assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 32);
-    assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 33);
-    assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
-    assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
-    assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 24);
-    assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
-  }
+    assert_eq!(core::mem::size_of::<subscription>(), 56);
+    assert_eq!(core::mem::align_of::<subscription>(), 8);
+    unsafe {
+        let obj: subscription = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+        assert_eq!(&obj.unused as *const _ as usize - base, 8);
+        assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+        assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
+        assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
+        assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
+        assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 32);
+        assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 33);
+        assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
+        assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
+        assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 24);
+        assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
+    }
 }
 
 /// The Thread Control Block (TCB).
@@ -1722,31 +1720,31 @@ fn subscription_layout_test_64() {
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct tcb {
-  /// Pointer that may be freely assigned by the system. Its
-  /// value cannot be interpreted by the application.
-  pub parent: *mut (),
+    /// Pointer that may be freely assigned by the system. Its
+    /// value cannot be interpreted by the application.
+    pub parent: *mut (),
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn tcb_layout_test_32() {
-  assert_eq!(core::mem::size_of::<tcb>(), 4);
-  assert_eq!(core::mem::align_of::<tcb>(), 4);
-  unsafe {
-    let obj: tcb = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.parent as *const _ as usize - base, 0);
-  }
+    assert_eq!(core::mem::size_of::<tcb>(), 4);
+    assert_eq!(core::mem::align_of::<tcb>(), 4);
+    unsafe {
+        let obj: tcb = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.parent as *const _ as usize - base, 0);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn tcb_layout_test_64() {
-  assert_eq!(core::mem::size_of::<tcb>(), 8);
-  assert_eq!(core::mem::align_of::<tcb>(), 8);
-  unsafe {
-    let obj: tcb = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.parent as *const _ as usize - base, 0);
-  }
+    assert_eq!(core::mem::size_of::<tcb>(), 8);
+    assert_eq!(core::mem::align_of::<tcb>(), 8);
+    unsafe {
+        let obj: tcb = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.parent as *const _ as usize - base, 0);
+    }
 }
 
 /// Entry point for additionally created threads.
@@ -1755,103 +1753,150 @@ fn tcb_layout_test_64() {
 ///
 /// `aux`: copy of the value stored in
 /// [`threadattr.argument`](struct.threadattr.html#structfield.argument).
-pub type threadentry = unsafe extern "C" fn(
-  tid: tid,
-  aux: *mut (),
-) -> ();
+pub type threadentry = unsafe extern "C" fn(tid: tid, aux: *mut ()) -> ();
 
 /// Attributes for thread creation.
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct threadattr {
-  /// Initial program counter value.
-  pub entry_point: threadentry,
-  /// Region allocated to serve as stack space.
-  pub stack: (*mut (), usize),
-  /// Argument to be forwarded to the entry point function.
-  pub argument: *mut (),
+    /// Initial program counter value.
+    pub entry_point: threadentry,
+    /// Region allocated to serve as stack space.
+    pub stack: (*mut (), usize),
+    /// Argument to be forwarded to the entry point function.
+    pub argument: *mut (),
 }
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn threadattr_layout_test_32() {
-  assert_eq!(core::mem::size_of::<threadattr>(), 16);
-  assert_eq!(core::mem::align_of::<threadattr>(), 4);
-  unsafe {
-    let obj: threadattr = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
-    assert_eq!(&obj.stack.0 as *const _ as usize - base, 4);
-    assert_eq!(&obj.stack.1 as *const _ as usize - base, 8);
-    assert_eq!(&obj.argument as *const _ as usize - base, 12);
-  }
+    assert_eq!(core::mem::size_of::<threadattr>(), 16);
+    assert_eq!(core::mem::align_of::<threadattr>(), 4);
+    unsafe {
+        let obj: threadattr = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
+        assert_eq!(&obj.stack.0 as *const _ as usize - base, 4);
+        assert_eq!(&obj.stack.1 as *const _ as usize - base, 8);
+        assert_eq!(&obj.argument as *const _ as usize - base, 12);
+    }
 }
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn threadattr_layout_test_64() {
-  assert_eq!(core::mem::size_of::<threadattr>(), 32);
-  assert_eq!(core::mem::align_of::<threadattr>(), 8);
-  unsafe {
-    let obj: threadattr = core::mem::uninitialized();
-    let base = &obj as *const _ as usize;
-    assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
-    assert_eq!(&obj.stack.0 as *const _ as usize - base, 8);
-    assert_eq!(&obj.stack.1 as *const _ as usize - base, 16);
-    assert_eq!(&obj.argument as *const _ as usize - base, 24);
-  }
+    assert_eq!(core::mem::size_of::<threadattr>(), 32);
+    assert_eq!(core::mem::align_of::<threadattr>(), 8);
+    unsafe {
+        let obj: threadattr = core::mem::uninitialized();
+        let base = &obj as *const _ as usize;
+        assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
+        assert_eq!(&obj.stack.0 as *const _ as usize - base, 8);
+        assert_eq!(&obj.stack.1 as *const _ as usize - base, 16);
+        assert_eq!(&obj.argument as *const _ as usize - base, 24);
+    }
 }
 
 /// The table with pointers to all syscall implementations.
 #[allow(improper_ctypes)]
 extern "C" {
-  fn cloudabi_sys_clock_res_get(_: clockid, _: *mut timestamp) -> errno;
-  fn cloudabi_sys_clock_time_get(_: clockid, _: timestamp, _: *mut timestamp) -> errno;
-  fn cloudabi_sys_condvar_signal(_: *mut condvar, _: scope, _: nthreads) -> errno;
-  fn cloudabi_sys_fd_close(_: fd) -> errno;
-  fn cloudabi_sys_fd_create1(_: filetype, _: *mut fd) -> errno;
-  fn cloudabi_sys_fd_create2(_: filetype, _: *mut fd, _: *mut fd) -> errno;
-  fn cloudabi_sys_fd_datasync(_: fd) -> errno;
-  fn cloudabi_sys_fd_dup(_: fd, _: *mut fd) -> errno;
-  fn cloudabi_sys_fd_pread(_: fd, _: *const iovec, _: usize, _: filesize, _: *mut usize) -> errno;
-  fn cloudabi_sys_fd_pwrite(_: fd, _: *const ciovec, _: usize, _: filesize, _: *mut usize) -> errno;
-  fn cloudabi_sys_fd_read(_: fd, _: *const iovec, _: usize, _: *mut usize) -> errno;
-  fn cloudabi_sys_fd_replace(_: fd, _: fd) -> errno;
-  fn cloudabi_sys_fd_seek(_: fd, _: filedelta, _: whence, _: *mut filesize) -> errno;
-  fn cloudabi_sys_fd_stat_get(_: fd, _: *mut fdstat) -> errno;
-  fn cloudabi_sys_fd_stat_put(_: fd, _: *const fdstat, _: fdsflags) -> errno;
-  fn cloudabi_sys_fd_sync(_: fd) -> errno;
-  fn cloudabi_sys_fd_write(_: fd, _: *const ciovec, _: usize, _: *mut usize) -> errno;
-  fn cloudabi_sys_file_advise(_: fd, _: filesize, _: filesize, _: advice) -> errno;
-  fn cloudabi_sys_file_allocate(_: fd, _: filesize, _: filesize) -> errno;
-  fn cloudabi_sys_file_create(_: fd, _: *const u8, _: usize, _: filetype) -> errno;
-  fn cloudabi_sys_file_link(_: lookup, _: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
-  fn cloudabi_sys_file_open(_: lookup, _: *const u8, _: usize, _: oflags, _: *const fdstat, _: *mut fd) -> errno;
-  fn cloudabi_sys_file_readdir(_: fd, _: *mut (), _: usize, _: dircookie, _: *mut usize) -> errno;
-  fn cloudabi_sys_file_readlink(_: fd, _: *const u8, _: usize, _: *mut u8, _: usize, _: *mut usize) -> errno;
-  fn cloudabi_sys_file_rename(_: fd, _: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
-  fn cloudabi_sys_file_stat_fget(_: fd, _: *mut filestat) -> errno;
-  fn cloudabi_sys_file_stat_fput(_: fd, _: *const filestat, _: fsflags) -> errno;
-  fn cloudabi_sys_file_stat_get(_: lookup, _: *const u8, _: usize, _: *mut filestat) -> errno;
-  fn cloudabi_sys_file_stat_put(_: lookup, _: *const u8, _: usize, _: *const filestat, _: fsflags) -> errno;
-  fn cloudabi_sys_file_symlink(_: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
-  fn cloudabi_sys_file_unlink(_: fd, _: *const u8, _: usize, _: ulflags) -> errno;
-  fn cloudabi_sys_lock_unlock(_: *mut lock, _: scope) -> errno;
-  fn cloudabi_sys_mem_advise(_: *mut (), _: usize, _: advice) -> errno;
-  fn cloudabi_sys_mem_map(_: *mut (), _: usize, _: mprot, _: mflags, _: fd, _: filesize, _: *mut *mut ()) -> errno;
-  fn cloudabi_sys_mem_protect(_: *mut (), _: usize, _: mprot) -> errno;
-  fn cloudabi_sys_mem_sync(_: *mut (), _: usize, _: msflags) -> errno;
-  fn cloudabi_sys_mem_unmap(_: *mut (), _: usize) -> errno;
-  fn cloudabi_sys_poll(_: *const subscription, _: *mut event, _: usize, _: *mut usize) -> errno;
-  fn cloudabi_sys_proc_exec(_: fd, _: *const (), _: usize, _: *const fd, _: usize) -> errno;
-  fn cloudabi_sys_proc_exit(_: exitcode) -> !;
-  fn cloudabi_sys_proc_fork(_: *mut fd, _: *mut tid) -> errno;
-  fn cloudabi_sys_proc_raise(_: signal) -> errno;
-  fn cloudabi_sys_random_get(_: *mut (), _: usize) -> errno;
-  fn cloudabi_sys_sock_recv(_: fd, _: *const recv_in, _: *mut recv_out) -> errno;
-  fn cloudabi_sys_sock_send(_: fd, _: *const send_in, _: *mut send_out) -> errno;
-  fn cloudabi_sys_sock_shutdown(_: fd, _: sdflags) -> errno;
-  fn cloudabi_sys_thread_create(_: *mut threadattr, _: *mut tid) -> errno;
-  fn cloudabi_sys_thread_exit(_: *mut lock, _: scope) -> !;
-  fn cloudabi_sys_thread_yield() -> errno;
+    fn cloudabi_sys_clock_res_get(_: clockid, _: *mut timestamp) -> errno;
+    fn cloudabi_sys_clock_time_get(_: clockid, _: timestamp, _: *mut timestamp) -> errno;
+    fn cloudabi_sys_condvar_signal(_: *mut condvar, _: scope, _: nthreads) -> errno;
+    fn cloudabi_sys_fd_close(_: fd) -> errno;
+    fn cloudabi_sys_fd_create1(_: filetype, _: *mut fd) -> errno;
+    fn cloudabi_sys_fd_create2(_: filetype, _: *mut fd, _: *mut fd) -> errno;
+    fn cloudabi_sys_fd_datasync(_: fd) -> errno;
+    fn cloudabi_sys_fd_dup(_: fd, _: *mut fd) -> errno;
+    fn cloudabi_sys_fd_pread(_: fd, _: *const iovec, _: usize, _: filesize, _: *mut usize)
+    -> errno;
+    fn cloudabi_sys_fd_pwrite(
+        _: fd,
+        _: *const ciovec,
+        _: usize,
+        _: filesize,
+        _: *mut usize,
+    ) -> errno;
+    fn cloudabi_sys_fd_read(_: fd, _: *const iovec, _: usize, _: *mut usize) -> errno;
+    fn cloudabi_sys_fd_replace(_: fd, _: fd) -> errno;
+    fn cloudabi_sys_fd_seek(_: fd, _: filedelta, _: whence, _: *mut filesize) -> errno;
+    fn cloudabi_sys_fd_stat_get(_: fd, _: *mut fdstat) -> errno;
+    fn cloudabi_sys_fd_stat_put(_: fd, _: *const fdstat, _: fdsflags) -> errno;
+    fn cloudabi_sys_fd_sync(_: fd) -> errno;
+    fn cloudabi_sys_fd_write(_: fd, _: *const ciovec, _: usize, _: *mut usize) -> errno;
+    fn cloudabi_sys_file_advise(_: fd, _: filesize, _: filesize, _: advice) -> errno;
+    fn cloudabi_sys_file_allocate(_: fd, _: filesize, _: filesize) -> errno;
+    fn cloudabi_sys_file_create(_: fd, _: *const u8, _: usize, _: filetype) -> errno;
+    fn cloudabi_sys_file_link(
+        _: lookup,
+        _: *const u8,
+        _: usize,
+        _: fd,
+        _: *const u8,
+        _: usize,
+    ) -> errno;
+    fn cloudabi_sys_file_open(
+        _: lookup,
+        _: *const u8,
+        _: usize,
+        _: oflags,
+        _: *const fdstat,
+        _: *mut fd,
+    ) -> errno;
+    fn cloudabi_sys_file_readdir(_: fd, _: *mut (), _: usize, _: dircookie, _: *mut usize)
+    -> errno;
+    fn cloudabi_sys_file_readlink(
+        _: fd,
+        _: *const u8,
+        _: usize,
+        _: *mut u8,
+        _: usize,
+        _: *mut usize,
+    ) -> errno;
+    fn cloudabi_sys_file_rename(
+        _: fd,
+        _: *const u8,
+        _: usize,
+        _: fd,
+        _: *const u8,
+        _: usize,
+    ) -> errno;
+    fn cloudabi_sys_file_stat_fget(_: fd, _: *mut filestat) -> errno;
+    fn cloudabi_sys_file_stat_fput(_: fd, _: *const filestat, _: fsflags) -> errno;
+    fn cloudabi_sys_file_stat_get(_: lookup, _: *const u8, _: usize, _: *mut filestat) -> errno;
+    fn cloudabi_sys_file_stat_put(
+        _: lookup,
+        _: *const u8,
+        _: usize,
+        _: *const filestat,
+        _: fsflags,
+    ) -> errno;
+    fn cloudabi_sys_file_symlink(_: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
+    fn cloudabi_sys_file_unlink(_: fd, _: *const u8, _: usize, _: ulflags) -> errno;
+    fn cloudabi_sys_lock_unlock(_: *mut lock, _: scope) -> errno;
+    fn cloudabi_sys_mem_advise(_: *mut (), _: usize, _: advice) -> errno;
+    fn cloudabi_sys_mem_map(
+        _: *mut (),
+        _: usize,
+        _: mprot,
+        _: mflags,
+        _: fd,
+        _: filesize,
+        _: *mut *mut (),
+    ) -> errno;
+    fn cloudabi_sys_mem_protect(_: *mut (), _: usize, _: mprot) -> errno;
+    fn cloudabi_sys_mem_sync(_: *mut (), _: usize, _: msflags) -> errno;
+    fn cloudabi_sys_mem_unmap(_: *mut (), _: usize) -> errno;
+    fn cloudabi_sys_poll(_: *const subscription, _: *mut event, _: usize, _: *mut usize) -> errno;
+    fn cloudabi_sys_proc_exec(_: fd, _: *const (), _: usize, _: *const fd, _: usize) -> errno;
+    fn cloudabi_sys_proc_exit(_: exitcode) -> !;
+    fn cloudabi_sys_proc_fork(_: *mut fd, _: *mut tid) -> errno;
+    fn cloudabi_sys_proc_raise(_: signal) -> errno;
+    fn cloudabi_sys_random_get(_: *mut (), _: usize) -> errno;
+    fn cloudabi_sys_sock_recv(_: fd, _: *const recv_in, _: *mut recv_out) -> errno;
+    fn cloudabi_sys_sock_send(_: fd, _: *const send_in, _: *mut send_out) -> errno;
+    fn cloudabi_sys_sock_shutdown(_: fd, _: sdflags) -> errno;
+    fn cloudabi_sys_thread_create(_: *mut threadattr, _: *mut tid) -> errno;
+    fn cloudabi_sys_thread_exit(_: *mut lock, _: scope) -> !;
+    fn cloudabi_sys_thread_yield() -> errno;
 }
 
 /// Obtains the resolution of a clock.
@@ -1866,7 +1911,7 @@ extern "C" {
 /// The resolution of the clock.
 #[inline]
 pub unsafe fn clock_res_get(clock_id_: clockid, resolution_: &mut timestamp) -> errno {
-  cloudabi_sys_clock_res_get(clock_id_, resolution_)
+    cloudabi_sys_clock_res_get(clock_id_, resolution_)
 }
 
 /// Obtains the time value of a clock.
@@ -1885,8 +1930,12 @@ pub unsafe fn clock_res_get(clock_id_: clockid, resolution_: &mut timestamp) ->
 /// **time**:
 /// The time value of the clock.
 #[inline]
-pub unsafe fn clock_time_get(clock_id_: clockid, precision_: timestamp, time_: *mut timestamp) -> errno {
-  cloudabi_sys_clock_time_get(clock_id_, precision_, time_)
+pub unsafe fn clock_time_get(
+    clock_id_: clockid,
+    precision_: timestamp,
+    time_: *mut timestamp,
+) -> errno {
+    cloudabi_sys_clock_time_get(clock_id_, precision_, time_)
 }
 
 /// Wakes up threads waiting on a userspace condition variable.
@@ -1913,7 +1962,7 @@ pub unsafe fn clock_time_get(clock_id_: clockid, precision_: timestamp, time_: *
 /// threads, all threads are woken up.
 #[inline]
 pub unsafe fn condvar_signal(condvar_: *mut condvar, scope_: scope, nwaiters_: nthreads) -> errno {
-  cloudabi_sys_condvar_signal(condvar_, scope_, nwaiters_)
+    cloudabi_sys_condvar_signal(condvar_, scope_, nwaiters_)
 }
 
 /// Closes a file descriptor.
@@ -1924,7 +1973,7 @@ pub unsafe fn condvar_signal(condvar_: *mut condvar, scope_: scope, nwaiters_: n
 /// The file descriptor that needs to be closed.
 #[inline]
 pub unsafe fn fd_close(fd_: fd) -> errno {
-  cloudabi_sys_fd_close(fd_)
+    cloudabi_sys_fd_close(fd_)
 }
 
 /// Creates a file descriptor.
@@ -1942,7 +1991,7 @@ pub unsafe fn fd_close(fd_: fd) -> errno {
 /// The file descriptor that has been created.
 #[inline]
 pub unsafe fn fd_create1(type_: filetype, fd_: &mut fd) -> errno {
-  cloudabi_sys_fd_create1(type_, fd_)
+    cloudabi_sys_fd_create1(type_, fd_)
 }
 
 /// Creates a pair of file descriptors.
@@ -1965,7 +2014,7 @@ pub unsafe fn fd_create1(type_: filetype, fd_: &mut fd) -> errno {
 /// The second file descriptor of the pair.
 #[inline]
 pub unsafe fn fd_create2(type_: filetype, fd1_: &mut fd, fd2_: &mut fd) -> errno {
-  cloudabi_sys_fd_create2(type_, fd1_, fd2_)
+    cloudabi_sys_fd_create2(type_, fd1_, fd2_)
 }
 
 /// Synchronizes the data of a file to disk.
@@ -1977,7 +2026,7 @@ pub unsafe fn fd_create2(type_: filetype, fd1_: &mut fd, fd2_: &mut fd) -> errno
 /// needs to be synchronized to disk.
 #[inline]
 pub unsafe fn fd_datasync(fd_: fd) -> errno {
-  cloudabi_sys_fd_datasync(fd_)
+    cloudabi_sys_fd_datasync(fd_)
 }
 
 /// Duplicates a file descriptor.
@@ -1992,7 +2041,7 @@ pub unsafe fn fd_datasync(fd_: fd) -> errno {
 /// The new file descriptor.
 #[inline]
 pub unsafe fn fd_dup(from_: fd, fd_: &mut fd) -> errno {
-  cloudabi_sys_fd_dup(from_, fd_)
+    cloudabi_sys_fd_dup(from_, fd_)
 }
 
 /// Reads from a file descriptor, without using and updating the
@@ -2016,7 +2065,7 @@ pub unsafe fn fd_dup(from_: fd, fd_: &mut fd) -> errno {
 /// The number of bytes read.
 #[inline]
 pub unsafe fn fd_pread(fd_: fd, iovs_: &[iovec], offset_: filesize, nread_: &mut usize) -> errno {
-  cloudabi_sys_fd_pread(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nread_)
+    cloudabi_sys_fd_pread(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nread_)
 }
 
 /// Writes to a file descriptor, without using and updating the
@@ -2039,8 +2088,13 @@ pub unsafe fn fd_pread(fd_: fd, iovs_: &[iovec], offset_: filesize, nread_: &mut
 /// **nwritten**:
 /// The number of bytes written.
 #[inline]
-pub unsafe fn fd_pwrite(fd_: fd, iovs_: &[ciovec], offset_: filesize, nwritten_: &mut usize) -> errno {
-  cloudabi_sys_fd_pwrite(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nwritten_)
+pub unsafe fn fd_pwrite(
+    fd_: fd,
+    iovs_: &[ciovec],
+    offset_: filesize,
+    nwritten_: &mut usize,
+) -> errno {
+    cloudabi_sys_fd_pwrite(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nwritten_)
 }
 
 /// Reads from a file descriptor.
@@ -2059,7 +2113,7 @@ pub unsafe fn fd_pwrite(fd_: fd, iovs_: &[ciovec], offset_: filesize, nwritten_:
 /// The number of bytes read.
 #[inline]
 pub unsafe fn fd_read(fd_: fd, iovs_: &[iovec], nread_: &mut usize) -> errno {
-  cloudabi_sys_fd_read(fd_, iovs_.as_ptr(), iovs_.len(), nread_)
+    cloudabi_sys_fd_read(fd_, iovs_.as_ptr(), iovs_.len(), nread_)
 }
 
 /// Atomically replaces a file descriptor by a copy of another
@@ -2085,7 +2139,7 @@ pub unsafe fn fd_read(fd_: fd, iovs_: &[iovec], nread_: &mut usize) -> errno {
 /// overwritten.
 #[inline]
 pub unsafe fn fd_replace(from_: fd, to_: fd) -> errno {
-  cloudabi_sys_fd_replace(from_, to_)
+    cloudabi_sys_fd_replace(from_, to_)
 }
 
 /// Moves the offset of the file descriptor.
@@ -2107,8 +2161,13 @@ pub unsafe fn fd_replace(from_: fd, to_: fd) -> errno {
 /// The new offset of the file descriptor,
 /// relative to the start of the file.
 #[inline]
-pub unsafe fn fd_seek(fd_: fd, offset_: filedelta, whence_: whence, newoffset_: &mut filesize) -> errno {
-  cloudabi_sys_fd_seek(fd_, offset_, whence_, newoffset_)
+pub unsafe fn fd_seek(
+    fd_: fd,
+    offset_: filedelta,
+    whence_: whence,
+    newoffset_: &mut filesize,
+) -> errno {
+    cloudabi_sys_fd_seek(fd_, offset_, whence_, newoffset_)
 }
 
 /// Gets attributes of a file descriptor.
@@ -2124,7 +2183,7 @@ pub unsafe fn fd_seek(fd_: fd, offset_: filedelta, whence_: whence, newoffset_:
 /// attributes are stored.
 #[inline]
 pub unsafe fn fd_stat_get(fd_: fd, buf_: *mut fdstat) -> errno {
-  cloudabi_sys_fd_stat_get(fd_, buf_)
+    cloudabi_sys_fd_stat_get(fd_, buf_)
 }
 
 /// Adjusts attributes of a file descriptor.
@@ -2144,7 +2203,7 @@ pub unsafe fn fd_stat_get(fd_: fd, buf_: *mut fdstat) -> errno {
 /// be adjusted.
 #[inline]
 pub unsafe fn fd_stat_put(fd_: fd, buf_: *const fdstat, flags_: fdsflags) -> errno {
-  cloudabi_sys_fd_stat_put(fd_, buf_, flags_)
+    cloudabi_sys_fd_stat_put(fd_, buf_, flags_)
 }
 
 /// Synchronizes the data and metadata of a file to disk.
@@ -2156,7 +2215,7 @@ pub unsafe fn fd_stat_put(fd_: fd, buf_: *const fdstat, flags_: fdsflags) -> err
 /// and metadata needs to be synchronized to disk.
 #[inline]
 pub unsafe fn fd_sync(fd_: fd) -> errno {
-  cloudabi_sys_fd_sync(fd_)
+    cloudabi_sys_fd_sync(fd_)
 }
 
 /// Writes to a file descriptor.
@@ -2175,7 +2234,7 @@ pub unsafe fn fd_sync(fd_: fd) -> errno {
 /// The number of bytes written.
 #[inline]
 pub unsafe fn fd_write(fd_: fd, iovs_: &[ciovec], nwritten_: &mut usize) -> errno {
-  cloudabi_sys_fd_write(fd_, iovs_.as_ptr(), iovs_.len(), nwritten_)
+    cloudabi_sys_fd_write(fd_, iovs_.as_ptr(), iovs_.len(), nwritten_)
 }
 
 /// Provides file advisory information on a file descriptor.
@@ -2198,7 +2257,7 @@ pub unsafe fn fd_write(fd_: fd, iovs_: &[ciovec], nwritten_: &mut usize) -> errn
 /// The advice.
 #[inline]
 pub unsafe fn file_advise(fd_: fd, offset_: filesize, len_: filesize, advice_: advice) -> errno {
-  cloudabi_sys_file_advise(fd_, offset_, len_, advice_)
+    cloudabi_sys_file_advise(fd_, offset_, len_, advice_)
 }
 
 /// Forces the allocation of space in a file.
@@ -2217,7 +2276,7 @@ pub unsafe fn file_advise(fd_: fd, offset_: filesize, len_: filesize, advice_: a
 /// The length of the area that is allocated.
 #[inline]
 pub unsafe fn file_allocate(fd_: fd, offset_: filesize, len_: filesize) -> errno {
-  cloudabi_sys_file_allocate(fd_, offset_, len_)
+    cloudabi_sys_file_allocate(fd_, offset_, len_)
 }
 
 /// Creates a file of a specified type.
@@ -2238,7 +2297,7 @@ pub unsafe fn file_allocate(fd_: fd, offset_: filesize, len_: filesize) -> errno
 ///     Creates a directory.
 #[inline]
 pub unsafe fn file_create(fd_: fd, path_: &[u8], type_: filetype) -> errno {
-  cloudabi_sys_file_create(fd_, path_.as_ptr(), path_.len(), type_)
+    cloudabi_sys_file_create(fd_, path_.as_ptr(), path_.len(), type_)
 }
 
 /// Creates a hard link.
@@ -2262,7 +2321,7 @@ pub unsafe fn file_create(fd_: fd, path_: &[u8], type_: filetype) -> errno {
 /// should be created.
 #[inline]
 pub unsafe fn file_link(fd1_: lookup, path1_: &[u8], fd2_: fd, path2_: &[u8]) -> errno {
-  cloudabi_sys_file_link(fd1_, path1_.as_ptr(), path1_.len(), fd2_, path2_.as_ptr(), path2_.len())
+    cloudabi_sys_file_link(fd1_, path1_.as_ptr(), path1_.len(), fd2_, path2_.as_ptr(), path2_.len())
 }
 
 /// Opens a file.
@@ -2297,8 +2356,14 @@ pub unsafe fn file_link(fd1_: lookup, path1_: &[u8], fd2_: fd, path2_: &[u8]) ->
 /// The file descriptor of the file that has been
 /// opened.
 #[inline]
-pub unsafe fn file_open(dirfd_: lookup, path_: &[u8], oflags_: oflags, fds_: *const fdstat, fd_: &mut fd) -> errno {
-  cloudabi_sys_file_open(dirfd_, path_.as_ptr(), path_.len(), oflags_, fds_, fd_)
+pub unsafe fn file_open(
+    dirfd_: lookup,
+    path_: &[u8],
+    oflags_: oflags,
+    fds_: *const fdstat,
+    fd_: &mut fd,
+) -> errno {
+    cloudabi_sys_file_open(dirfd_, path_.as_ptr(), path_.len(), oflags_, fds_, fd_)
 }
 
 /// Reads directory entries from a directory.
@@ -2332,8 +2397,13 @@ pub unsafe fn file_open(dirfd_: lookup, path_: &[u8], oflags_: oflags, fds_: *co
 /// If less than the size of the read buffer, the
 /// end of the directory has been reached.
 #[inline]
-pub unsafe fn file_readdir(fd_: fd, buf_: &mut [u8], cookie_: dircookie, bufused_: &mut usize) -> errno {
-  cloudabi_sys_file_readdir(fd_, buf_.as_mut_ptr() as *mut (), buf_.len(), cookie_, bufused_)
+pub unsafe fn file_readdir(
+    fd_: fd,
+    buf_: &mut [u8],
+    cookie_: dircookie,
+    bufused_: &mut usize,
+) -> errno {
+    cloudabi_sys_file_readdir(fd_, buf_.as_mut_ptr() as *mut (), buf_.len(), cookie_, bufused_)
 }
 
 /// Reads the contents of a symbolic link.
@@ -2356,7 +2426,14 @@ pub unsafe fn file_readdir(fd_: fd, buf_: &mut [u8], cookie_: dircookie, bufused
 /// The number of bytes placed in the buffer.
 #[inline]
 pub unsafe fn file_readlink(fd_: fd, path_: &[u8], buf_: &mut [u8], bufused_: &mut usize) -> errno {
-  cloudabi_sys_file_readlink(fd_, path_.as_ptr(), path_.len(), buf_.as_mut_ptr(), buf_.len(), bufused_)
+    cloudabi_sys_file_readlink(
+        fd_,
+        path_.as_ptr(),
+        path_.len(),
+        buf_.as_mut_ptr(),
+        buf_.len(),
+        bufused_,
+    )
 }
 
 /// Renames a file.
@@ -2380,7 +2457,14 @@ pub unsafe fn file_readlink(fd_: fd, path_: &[u8], buf_: &mut [u8], bufused_: &m
 /// be renamed.
 #[inline]
 pub unsafe fn file_rename(fd1_: fd, path1_: &[u8], fd2_: fd, path2_: &[u8]) -> errno {
-  cloudabi_sys_file_rename(fd1_, path1_.as_ptr(), path1_.len(), fd2_, path2_.as_ptr(), path2_.len())
+    cloudabi_sys_file_rename(
+        fd1_,
+        path1_.as_ptr(),
+        path1_.len(),
+        fd2_,
+        path2_.as_ptr(),
+        path2_.len(),
+    )
 }
 
 /// Gets attributes of a file by file descriptor.
@@ -2396,7 +2480,7 @@ pub unsafe fn file_rename(fd1_: fd, path1_: &[u8], fd2_: fd, path2_: &[u8]) -> e
 /// stored.
 #[inline]
 pub unsafe fn file_stat_fget(fd_: fd, buf_: *mut filestat) -> errno {
-  cloudabi_sys_file_stat_fget(fd_, buf_)
+    cloudabi_sys_file_stat_fget(fd_, buf_)
 }
 
 /// Adjusts attributes of a file by file descriptor.
@@ -2416,7 +2500,7 @@ pub unsafe fn file_stat_fget(fd_: fd, buf_: *mut filestat) -> errno {
 /// be adjusted.
 #[inline]
 pub unsafe fn file_stat_fput(fd_: fd, buf_: *const filestat, flags_: fsflags) -> errno {
-  cloudabi_sys_file_stat_fput(fd_, buf_, flags_)
+    cloudabi_sys_file_stat_fput(fd_, buf_, flags_)
 }
 
 /// Gets attributes of a file by path.
@@ -2437,7 +2521,7 @@ pub unsafe fn file_stat_fput(fd_: fd, buf_: *const filestat, flags_: fsflags) ->
 /// stored.
 #[inline]
 pub unsafe fn file_stat_get(fd_: lookup, path_: &[u8], buf_: *mut filestat) -> errno {
-  cloudabi_sys_file_stat_get(fd_, path_.as_ptr(), path_.len(), buf_)
+    cloudabi_sys_file_stat_get(fd_, path_.as_ptr(), path_.len(), buf_)
 }
 
 /// Adjusts attributes of a file by path.
@@ -2461,8 +2545,13 @@ pub unsafe fn file_stat_get(fd_: lookup, path_: &[u8], buf_: *mut filestat) -> e
 /// A bitmask indicating which attributes have to
 /// be adjusted.
 #[inline]
-pub unsafe fn file_stat_put(fd_: lookup, path_: &[u8], buf_: *const filestat, flags_: fsflags) -> errno {
-  cloudabi_sys_file_stat_put(fd_, path_.as_ptr(), path_.len(), buf_, flags_)
+pub unsafe fn file_stat_put(
+    fd_: lookup,
+    path_: &[u8],
+    buf_: *const filestat,
+    flags_: fsflags,
+) -> errno {
+    cloudabi_sys_file_stat_put(fd_, path_.as_ptr(), path_.len(), buf_, flags_)
 }
 
 /// Creates a symbolic link.
@@ -2481,7 +2570,7 @@ pub unsafe fn file_stat_put(fd_: lookup, path_: &[u8], buf_: *const filestat, fl
 /// link should be created.
 #[inline]
 pub unsafe fn file_symlink(path1_: &[u8], fd_: fd, path2_: &[u8]) -> errno {
-  cloudabi_sys_file_symlink(path1_.as_ptr(), path1_.len(), fd_, path2_.as_ptr(), path2_.len())
+    cloudabi_sys_file_symlink(path1_.as_ptr(), path1_.len(), fd_, path2_.as_ptr(), path2_.len())
 }
 
 /// Unlinks a file, or removes a directory.
@@ -2503,7 +2592,7 @@ pub unsafe fn file_symlink(path1_: &[u8], fd_: fd, path2_: &[u8]) -> errno {
 ///     Otherwise, unlink a file.
 #[inline]
 pub unsafe fn file_unlink(fd_: fd, path_: &[u8], flags_: ulflags) -> errno {
-  cloudabi_sys_file_unlink(fd_, path_.as_ptr(), path_.len(), flags_)
+    cloudabi_sys_file_unlink(fd_, path_.as_ptr(), path_.len(), flags_)
 }
 
 /// Unlocks a write-locked userspace lock.
@@ -2530,7 +2619,7 @@ pub unsafe fn file_unlink(fd_: fd, path_: &[u8], flags_: ulflags) -> errno {
 /// shared memory.
 #[inline]
 pub unsafe fn lock_unlock(lock_: *mut lock, scope_: scope) -> errno {
-  cloudabi_sys_lock_unlock(lock_, scope_)
+    cloudabi_sys_lock_unlock(lock_, scope_)
 }
 
 /// Provides memory advisory information on a region of memory.
@@ -2545,7 +2634,7 @@ pub unsafe fn lock_unlock(lock_: *mut lock, scope_: scope) -> errno {
 /// The advice.
 #[inline]
 pub unsafe fn mem_advise(mapping_: &mut [u8], advice_: advice) -> errno {
-  cloudabi_sys_mem_advise(mapping_.as_mut_ptr() as *mut (), mapping_.len(), advice_)
+    cloudabi_sys_mem_advise(mapping_.as_mut_ptr() as *mut (), mapping_.len(), advice_)
 }
 
 /// Creates a memory mapping, making the contents of a file
@@ -2585,8 +2674,16 @@ pub unsafe fn mem_advise(mapping_: &mut [u8], advice_: advice) -> errno {
 /// **mem**:
 /// The starting address of the memory mapping.
 #[inline]
-pub unsafe fn mem_map(addr_: *mut (), len_: usize, prot_: mprot, flags_: mflags, fd_: fd, off_: filesize, mem_: &mut *mut ()) -> errno {
-  cloudabi_sys_mem_map(addr_, len_, prot_, flags_, fd_, off_, mem_)
+pub unsafe fn mem_map(
+    addr_: *mut (),
+    len_: usize,
+    prot_: mprot,
+    flags_: mflags,
+    fd_: fd,
+    off_: filesize,
+    mem_: &mut *mut (),
+) -> errno {
+    cloudabi_sys_mem_map(addr_, len_, prot_, flags_, fd_, off_, mem_)
 }
 
 /// Changes the protection of a memory mapping.
@@ -2600,7 +2697,7 @@ pub unsafe fn mem_map(addr_: *mut (), len_: usize, prot_: mprot, flags_: mflags,
 /// New protection options.
 #[inline]
 pub unsafe fn mem_protect(mapping_: &mut [u8], prot_: mprot) -> errno {
-  cloudabi_sys_mem_protect(mapping_.as_mut_ptr() as *mut (), mapping_.len(), prot_)
+    cloudabi_sys_mem_protect(mapping_.as_mut_ptr() as *mut (), mapping_.len(), prot_)
 }
 
 /// Synchronizes a region of memory with its physical storage.
@@ -2614,7 +2711,7 @@ pub unsafe fn mem_protect(mapping_: &mut [u8], prot_: mprot) -> errno {
 /// The method of synchronization.
 #[inline]
 pub unsafe fn mem_sync(mapping_: &mut [u8], flags_: msflags) -> errno {
-  cloudabi_sys_mem_sync(mapping_.as_mut_ptr() as *mut (), mapping_.len(), flags_)
+    cloudabi_sys_mem_sync(mapping_.as_mut_ptr() as *mut (), mapping_.len(), flags_)
 }
 
 /// Unmaps a region of memory.
@@ -2625,7 +2722,7 @@ pub unsafe fn mem_sync(mapping_: &mut [u8], flags_: msflags) -> errno {
 /// The pages that needs to be unmapped.
 #[inline]
 pub unsafe fn mem_unmap(mapping_: &mut [u8]) -> errno {
-  cloudabi_sys_mem_unmap(mapping_.as_mut_ptr() as *mut (), mapping_.len())
+    cloudabi_sys_mem_unmap(mapping_.as_mut_ptr() as *mut (), mapping_.len())
 }
 
 /// Concurrently polls for the occurrence of a set of events.
@@ -2644,8 +2741,13 @@ pub unsafe fn mem_unmap(mapping_: &mut [u8]) -> errno {
 /// **nevents**:
 /// The number of events stored.
 #[inline]
-pub unsafe fn poll(in_: *const subscription, out_: *mut event, nsubscriptions_: usize, nevents_: *mut usize) -> errno {
-  cloudabi_sys_poll(in_, out_, nsubscriptions_, nevents_)
+pub unsafe fn poll(
+    in_: *const subscription,
+    out_: *mut event,
+    nsubscriptions_: usize,
+    nevents_: *mut usize,
+) -> errno {
+    cloudabi_sys_poll(in_, out_, nsubscriptions_, nevents_)
 }
 
 /// Replaces the process by a new executable.
@@ -2683,7 +2785,7 @@ pub unsafe fn poll(in_: *const subscription, out_: *mut event, nsubscriptions_:
 /// execution.
 #[inline]
 pub unsafe fn proc_exec(fd_: fd, data_: &[u8], fds_: &[fd]) -> errno {
-  cloudabi_sys_proc_exec(fd_, data_.as_ptr() as *const (), data_.len(), fds_.as_ptr(), fds_.len())
+    cloudabi_sys_proc_exec(fd_, data_.as_ptr() as *const (), data_.len(), fds_.as_ptr(), fds_.len())
 }
 
 /// Terminates the process normally.
@@ -2696,7 +2798,7 @@ pub unsafe fn proc_exec(fd_: fd, data_: &[u8], fds_: &[fd]) -> errno {
 /// through [`event.union.proc_terminate.exitcode`](struct.event_proc_terminate.html#structfield.exitcode).
 #[inline]
 pub unsafe fn proc_exit(rval_: exitcode) -> ! {
-  cloudabi_sys_proc_exit(rval_)
+    cloudabi_sys_proc_exit(rval_)
 }
 
 /// Forks the process of the calling thread.
@@ -2721,7 +2823,7 @@ pub unsafe fn proc_exit(rval_: exitcode) -> ! {
 /// initial thread of the child process.
 #[inline]
 pub unsafe fn proc_fork(fd_: &mut fd, tid_: &mut tid) -> errno {
-  cloudabi_sys_proc_fork(fd_, tid_)
+    cloudabi_sys_proc_fork(fd_, tid_)
 }
 
 /// Sends a signal to the process of the calling thread.
@@ -2736,7 +2838,7 @@ pub unsafe fn proc_fork(fd_: &mut fd, tid_: &mut tid) -> errno {
 /// [`event.union.proc_terminate.signal`](struct.event_proc_terminate.html#structfield.signal).
 #[inline]
 pub unsafe fn proc_raise(sig_: signal) -> errno {
-  cloudabi_sys_proc_raise(sig_)
+    cloudabi_sys_proc_raise(sig_)
 }
 
 /// Obtains random data from the kernel random number generator.
@@ -2752,7 +2854,7 @@ pub unsafe fn proc_raise(sig_: signal) -> errno {
 /// data.
 #[inline]
 pub unsafe fn random_get(buf_: &mut [u8]) -> errno {
-  cloudabi_sys_random_get(buf_.as_mut_ptr() as *mut (), buf_.len())
+    cloudabi_sys_random_get(buf_.as_mut_ptr() as *mut (), buf_.len())
 }
 
 /// Receives a message on a socket.
@@ -2770,7 +2872,7 @@ pub unsafe fn random_get(buf_: &mut [u8]) -> errno {
 /// Output parameters.
 #[inline]
 pub unsafe fn sock_recv(sock_: fd, in_: *const recv_in, out_: *mut recv_out) -> errno {
-  cloudabi_sys_sock_recv(sock_, in_, out_)
+    cloudabi_sys_sock_recv(sock_, in_, out_)
 }
 
 /// Sends a message on a socket.
@@ -2787,7 +2889,7 @@ pub unsafe fn sock_recv(sock_: fd, in_: *const recv_in, out_: *mut recv_out) ->
 /// Output parameters.
 #[inline]
 pub unsafe fn sock_send(sock_: fd, in_: *const send_in, out_: *mut send_out) -> errno {
-  cloudabi_sys_sock_send(sock_, in_, out_)
+    cloudabi_sys_sock_send(sock_, in_, out_)
 }
 
 /// Shuts down socket send and receive channels.
@@ -2802,7 +2904,7 @@ pub unsafe fn sock_send(sock_: fd, in_: *const send_in, out_: *mut send_out) ->
 /// down.
 #[inline]
 pub unsafe fn sock_shutdown(sock_: fd, how_: sdflags) -> errno {
-  cloudabi_sys_sock_shutdown(sock_, how_)
+    cloudabi_sys_sock_shutdown(sock_, how_)
 }
 
 /// Creates a new thread within the current process.
@@ -2816,7 +2918,7 @@ pub unsafe fn sock_shutdown(sock_: fd, how_: sdflags) -> errno {
 /// The thread ID of the new thread.
 #[inline]
 pub unsafe fn thread_create(attr_: *mut threadattr, tid_: &mut tid) -> errno {
-  cloudabi_sys_thread_create(attr_, tid_)
+    cloudabi_sys_thread_create(attr_, tid_)
 }
 
 /// Terminates the calling thread.
@@ -2836,11 +2938,11 @@ pub unsafe fn thread_create(attr_: *mut threadattr, tid_: &mut tid) -> errno {
 /// shared memory.
 #[inline]
 pub unsafe fn thread_exit(lock_: *mut lock, scope_: scope) -> ! {
-  cloudabi_sys_thread_exit(lock_, scope_)
+    cloudabi_sys_thread_exit(lock_, scope_)
 }
 
 /// Temporarily yields execution of the calling thread.
 #[inline]
 pub unsafe fn thread_yield() -> errno {
-  cloudabi_sys_thread_yield()
+    cloudabi_sys_thread_yield()
 }
diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs
index ec1fca7805a..3ba51d77494 100644
--- a/src/libstd/sys/cloudabi/condvar.rs
+++ b/src/libstd/sys/cloudabi/condvar.rs
@@ -18,9 +18,8 @@ pub struct Condvar {
 unsafe impl Send for Condvar {}
 unsafe impl Sync for Condvar {}
 
-const NEW: Condvar = Condvar {
-    condvar: UnsafeCell::new(AtomicU32::new(abi::CONDVAR_HAS_NO_WAITERS.0)),
-};
+const NEW: Condvar =
+    Condvar { condvar: UnsafeCell::new(AtomicU32::new(abi::CONDVAR_HAS_NO_WAITERS.0)) };
 
 impl Condvar {
     pub const fn new() -> Condvar {
@@ -33,11 +32,7 @@ impl Condvar {
         let condvar = self.condvar.get();
         if (*condvar).load(Ordering::Relaxed) != abi::CONDVAR_HAS_NO_WAITERS.0 {
             let ret = abi::condvar_signal(condvar as *mut abi::condvar, abi::scope::PRIVATE, 1);
-            assert_eq!(
-                ret,
-                abi::errno::SUCCESS,
-                "Failed to signal on condition variable"
-            );
+            assert_eq!(ret, abi::errno::SUCCESS, "Failed to signal on condition variable");
         }
     }
 
@@ -49,11 +44,7 @@ impl Condvar {
                 abi::scope::PRIVATE,
                 abi::nthreads::max_value(),
             );
-            assert_eq!(
-                ret,
-                abi::errno::SUCCESS,
-                "Failed to broadcast on condition variable"
-            );
+            assert_eq!(ret, abi::errno::SUCCESS, "Failed to broadcast on condition variable");
         }
     }
 
@@ -81,17 +72,8 @@ impl Condvar {
         };
         let mut event: mem::MaybeUninit<abi::event> = mem::MaybeUninit::uninit();
         let mut nevents: mem::MaybeUninit<usize> = mem::MaybeUninit::uninit();
-        let ret = abi::poll(
-            &subscription,
-            event.as_mut_ptr(),
-            1,
-            nevents.as_mut_ptr()
-        );
-        assert_eq!(
-            ret,
-            abi::errno::SUCCESS,
-            "Failed to wait on condition variable"
-        );
+        let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
+        assert_eq!(ret, abi::errno::SUCCESS, "Failed to wait on condition variable");
         assert_eq!(
             event.assume_init().error,
             abi::errno::SUCCESS,
@@ -109,8 +91,8 @@ impl Condvar {
 
         // Call into the kernel to wait on the condition variable.
         let condvar = self.condvar.get();
-        let timeout = checked_dur2intervals(&dur)
-            .expect("overflow converting duration to nanoseconds");
+        let timeout =
+            checked_dur2intervals(&dur).expect("overflow converting duration to nanoseconds");
         let subscriptions = [
             abi::subscription {
                 type_: abi::eventtype::CONDVAR,
@@ -142,13 +124,9 @@ impl Condvar {
             subscriptions.as_ptr(),
             mem::MaybeUninit::first_ptr_mut(&mut events),
             2,
-            nevents.as_mut_ptr()
-        );
-        assert_eq!(
-            ret,
-            abi::errno::SUCCESS,
-            "Failed to wait on condition variable"
+            nevents.as_mut_ptr(),
         );
+        assert_eq!(ret, abi::errno::SUCCESS, "Failed to wait on condition variable");
         let nevents = nevents.assume_init();
         for i in 0..nevents {
             assert_eq!(
diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs
index 2fb10cc370a..e5f1dd98435 100644
--- a/src/libstd/sys/cloudabi/mod.rs
+++ b/src/libstd/sys/cloudabi/mod.rs
@@ -60,10 +60,7 @@ pub use libc::strlen;
 pub fn hashmap_random_keys() -> (u64, u64) {
     unsafe {
         let mut v: mem::MaybeUninit<(u64, u64)> = mem::MaybeUninit::uninit();
-        libc::arc4random_buf(
-            v.as_mut_ptr() as *mut libc::c_void,
-            mem::size_of_val(&v)
-        );
+        libc::arc4random_buf(v.as_mut_ptr() as *mut libc::c_void, mem::size_of_val(&v));
         v.assume_init()
     }
 }
diff --git a/src/libstd/sys/cloudabi/mutex.rs b/src/libstd/sys/cloudabi/mutex.rs
index 0e30d3a1c6c..4aa25e25052 100644
--- a/src/libstd/sys/cloudabi/mutex.rs
+++ b/src/libstd/sys/cloudabi/mutex.rs
@@ -56,7 +56,7 @@ impl ReentrantMutex {
     pub unsafe fn uninitialized() -> ReentrantMutex {
         ReentrantMutex {
             lock: UnsafeCell::new(MaybeUninit::uninit()),
-            recursion: UnsafeCell::new(MaybeUninit::uninit())
+            recursion: UnsafeCell::new(MaybeUninit::uninit()),
         }
     }
 
diff --git a/src/libstd/sys/cloudabi/rwlock.rs b/src/libstd/sys/cloudabi/rwlock.rs
index 73499d65a06..b8af5af1d70 100644
--- a/src/libstd/sys/cloudabi/rwlock.rs
+++ b/src/libstd/sys/cloudabi/rwlock.rs
@@ -23,9 +23,7 @@ pub unsafe fn raw(r: &RWLock) -> *mut AtomicU32 {
 unsafe impl Send for RWLock {}
 unsafe impl Sync for RWLock {}
 
-const NEW: RWLock = RWLock {
-    lock: UnsafeCell::new(AtomicU32::new(abi::LOCK_UNLOCKED.0)),
-};
+const NEW: RWLock = RWLock { lock: UnsafeCell::new(AtomicU32::new(abi::LOCK_UNLOCKED.0)) };
 
 impl RWLock {
     pub const fn new() -> RWLock {
@@ -79,11 +77,7 @@ impl RWLock {
             let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
             assert_eq!(ret, abi::errno::SUCCESS, "Failed to acquire read lock");
             let event = event.assume_init();
-            assert_eq!(
-                event.error,
-                abi::errno::SUCCESS,
-                "Failed to acquire read lock"
-            );
+            assert_eq!(event.error, abi::errno::SUCCESS, "Failed to acquire read lock");
 
             RDLOCKS_ACQUIRED += 1;
         }
@@ -122,11 +116,7 @@ impl RWLock {
             } else {
                 // No threads waiting or not the last read lock. Just decrement
                 // the read lock count.
-                assert_ne!(
-                    old & !abi::LOCK_KERNEL_MANAGED.0,
-                    0,
-                    "This rwlock is not locked"
-                );
+                assert_ne!(old & !abi::LOCK_KERNEL_MANAGED.0, 0, "This rwlock is not locked");
                 assert_eq!(
                     old & abi::LOCK_WRLOCKED.0,
                     0,
@@ -189,11 +179,7 @@ impl RWLock {
             let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
             assert_eq!(ret, abi::errno::SUCCESS, "Failed to acquire write lock");
             let event = event.assume_init();
-            assert_eq!(
-                event.error,
-                abi::errno::SUCCESS,
-                "Failed to acquire write lock"
-            );
+            assert_eq!(event.error, abi::errno::SUCCESS, "Failed to acquire write lock");
         }
     }