Crate nix

Source
Expand description

Rust friendly bindings to the various *nix system functions.

Modules are structured according to the C header file that they would be defined in.

§Features

Nix uses the following Cargo features to enable optional functionality. They may be enabled in any combination.

  • acct - Process accounting
  • aio - POSIX AIO
  • dir - Stuff relating to directory iteration
  • env - Manipulate environment variables
  • event - Event-driven APIs, like kqueue and epoll
  • fanotify - Linux’s fanotify filesystem events monitoring API
  • feature - Query characteristics of the OS at runtime
  • fs - File system functionality
  • hostname - Get and set the system’s hostname
  • inotify - Linux’s inotify file system notification API
  • ioctl - The ioctl syscall, and wrappers for many specific instances
  • kmod - Load and unload kernel modules
  • mman - Stuff relating to memory management
  • mount - Mount and unmount file systems
  • mqueue - POSIX message queues
  • net - Networking-related functionality
  • personality - Set the process execution domain
  • poll - APIs like poll and select
  • process - Stuff relating to running processes
  • pthread - POSIX threads
  • ptrace - Process tracing and debugging
  • quota - File system quotas
  • reboot - Reboot the system
  • resource - Process resource limits
  • sched - Manipulate process’s scheduling
  • socket - Sockets, whether for networking or local use
  • signal - Send and receive signals to processes
  • syslog - System logging
  • term - Terminal control APIs
  • time - Query the operating system’s clocks
  • ucontext - User thread context
  • uio - Vectored I/O
  • user - Stuff relating to users and groups
  • zerocopy - APIs like sendfile and copy_file_range

Re-exports§

pub use libc;

Modules§

dirdir
List directory contents
envenv
Environment variables
errno
Safe wrappers around errno functions
fcntl
File control options
featuresfeature
Feature tests for OS functionality
ifaddrsnet
Query network interface addresses
kmodkmod
Load and unload kernel modules.
mountmount
Mount file systems
mqueuemqueue
Posix Message Queue functions
netnet
Functionality involving network interfaces
pollpoll
Wait for events to trigger on specific file descriptors
ptyterm
Create master and slave virtual pseudo-terminals (PTYs)
schedsched
Execution scheduling
spawnprocess
Safe wrappers around posix_spawn* functions found in the libc “spawn.h” header.
sys
Mostly platform-specific functionality
syslogsyslog
Interfaces for controlling system log.
timetime
Sleep, query system clocks, and set system clock
ucontextucontext
unistd
Safe wrappers around functions found in libc “unistd.h” header

Macros§

cmsg_spacesocket and uio
Create a buffer large enough for storing some control messages as returned by recvmsg.
getsockopt_implsocket
Helper for implementing GetSockOpt for a given socket option. See ::sys::socket::GetSockOpt.
ioctl_noneioctl
Generates a wrapper function for an ioctl that passes no data to the kernel.
ioctl_none_badioctl
Generates a wrapper function for a “bad” ioctl that passes no data to the kernel.
ioctl_readioctl
Generates a wrapper function for an ioctl that reads data from the kernel.
ioctl_read_badioctl
Generates a wrapper function for a “bad” ioctl that reads data from the kernel.
ioctl_read_bufioctl
Generates a wrapper function for an ioctl that reads an array of elements from the kernel.
ioctl_readwriteioctl
Generates a wrapper function for an ioctl that reads and writes data to the kernel.
ioctl_readwrite_badioctl
Generates a wrapper function for a “bad” ioctl that reads and writes data to the kernel.
ioctl_readwrite_bufioctl
Generates a wrapper function for an ioctl that reads and writes an array of elements to the kernel.
ioctl_write_bufioctl
Generates a wrapper function for an ioctl that writes an array of elements to the kernel.
ioctl_write_intioctl
Generates a wrapper function for a ioctl that writes an integer to the kernel.
ioctl_write_int_badioctl
Generates a wrapper function for a “bad” ioctl that writes an integer to the kernel.
ioctl_write_ptrioctl
Generates a wrapper function for an ioctl that writes data through a pointer to the kernel.
ioctl_write_ptr_badioctl
Generates a wrapper function for a “bad” ioctl that writes data through a pointer to the kernel.
request_code_noneioctl
Generate an ioctl request code for a command that passes no data.
request_code_readioctl
Generate an ioctl request code for a command that reads.
request_code_readwriteioctl
Generate an ioctl request code for a command that reads and writes.
request_code_writeioctl
Generate an ioctl request code for a command that writes.
setsockopt_implsocket
Helper for implementing SetSockOpt for a given socket option. See ::sys::socket::SetSockOpt.
sockopt_implsocket
Helper to generate the sockopt accessors. See ::sys::socket::GetSockOpt and ::sys::socket::SetSockOpt.

Traits§

NixPath
Common trait used to represent file system paths by many Nix functions.

Type Aliases§

Error
Nix’s main error type.
Result
Nix Result Type