Expand description
hermit-abi
is small interface to call functions from the
Hermit unikernel.
Re-exports§
pub use self::errno::*;
Modules§
Structs§
- Priority
- Priority of a thread
- addrinfo
- dirent64
- in6_
addr - in_addr
- iovec
- Describes a region of memory, beginning at
iov_base
address and with the size ofiov_len
bytes. - ip_mreq
- ipv6_
mreq - linger
- pollfd
- sockaddr
- sockaddr_
in - sockaddr_
in6 - sockaddr_
storage - stat
- timespec
timespec
is used byclock_gettime
to retrieve the current time- timeval
Enums§
Constants§
- AF_INET
- AF_
INET6 - CLOCK_
MONOTONIC - CLOCK_
REALTIME - DT_BLK
- DT_CHR
- DT_DIR
- DT_FIFO
- DT_LNK
- DT_REG
- DT_SOCK
- DT_
UNKNOWN - DT_WHT
- EAI_
AGAIN - EAI_
BADFLAGS - EAI_
FAIL - EAI_
FAMILY - EAI_
MEMORY - EAI_
NODATA - EAI_
NONAME - EAI_
OVERFLOW - EAI_
SERVICE - EAI_
SOCKTYPE - EAI_
SYSTEM - EFD_
CLOEXEC - EFD_
NONBLOCK - EFD_
SEMAPHORE - FD_
CLOEXEC - FIONBIO
- FUTEX_
RELATIVE_ TIMEOUT - F_DUPFD
- F_GETFD
- F_GETFL
- F_SETFD
- F_SETFL
- HIGH_
PRIO - IOV_MAX
- IPPROTO_
IP - IPPROTO_
IPV6 - IPPROTO_
TCP - IPPROTO_
UDP - IPV6_
ADD_ MEMBERSHIP - IPV6_
DROP_ MEMBERSHIP - IPV6_
MULTICAST_ LOOP - IPV6_
V6ONLY - IP_
ADD_ MEMBERSHIP - IP_
DROP_ MEMBERSHIP - IP_
MULTICAST_ LOOP - IP_
MULTICAST_ TTL - IP_TOS
- IP_TTL
- LOW_
PRIO - MSG_
PEEK - NORMAL_
PRIO - NO_
PRIORITIES - Maximum number of priorities
- O_
APPEND - O_CREAT
- O_
DIRECTORY - O_EXCL
- O_
NONBLOCK - O_
RDONLY - O_RDWR
- O_TRUNC
- O_
WRONLY - POLLERR
- POLLHUP
- POLLIN
- POLLNVAL
- POLLOUT
- POLLPRI
- POLLRDBAND
- POLLRDHUP
- POLLRDNORM
- POLLWRBAND
- POLLWRNORM
- RAND_
MAX - The largest number
rand
will return - SHUT_RD
- SHUT_
RDWR - SHUT_WR
- SOCK_
CLOEXEC - SOCK_
DGRAM - SOCK_
NONBLOCK - SOCK_
STREAM - SOL_
SOCKET - SO_
BROADCAST - SO_
ERROR - SO_
KEEPALIVE - SO_
LINGER - SO_
RCVBUF - SO_
RCVTIMEO - SO_
REUSEADDR - SO_
SNDBUF - SO_
SNDTIMEO - STDERR_
FILENO - STDIN_
FILENO - STDOUT_
FILENO - S_IFBLK
- S_IFCHR
- S_IFDIR
- S_IFIFO
- S_IFLNK
- S_IFMT
- S_IFREG
- S_
IFSOCK - TCP_
NODELAY
Functions§
- abort⚠
- cause abnormal termination
- accept⚠
- alloc⚠
- alloc_
zeroed ⚠ - available_
parallelism ⚠ - Returns an estimate of the default amount of parallelism a program should use. This number often corresponds to the amount of CPUs a computer has, but it may diverge in various cases.
- bind⚠
- bind a name to a socket
- block_
current_ ⚠task - Add current task to the queue of blocked tasks. After calling
block_current_task
, callyield_now
to switch to another task. - block_
current_ ⚠task_ with_ timeout - Add current task to the queue of blocked tasks, but wake it when
timeout
milliseconds have elapsed. - clock_
gettime ⚠ - get current time
- close⚠
- close a file descriptor
- connect⚠
- dealloc⚠
- dup⚠
- duplicate an existing file descriptor
- errno⚠
- Get the last error number from the thread local storage
- eventfd⚠
eventfd
creates an linux-like “eventfd object” that can be used as an event wait/notify mechanism by user-space applications, and by the kernel to notify user-space applications of events. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This counter is initialized with the value specified in the argumentinitval
.- exit⚠
- cause normal termination and return
status
to the host system - fcntl⚠
- free⚠
- freeaddrinfo⚠
- fstat⚠
- fstat
- futex_
wait ⚠ - If the value at address matches the expected value, park the current thread until it is either
woken up with
futex_wake
(returns 0) or an optional timeout elapses (returns -ETIMEDOUT). - futex_
wake ⚠ - Wake
count
threads waiting on the futex ataddress
. Returns the number of threads woken up (saturates toi32::MAX
). Ifcount
isi32::MAX
, wake up all matching waiting threads. Ifcount
is negative oraddress
is null, returns -EINVAL. - get_
errno ⚠ - Get the last error number from the thread local storage
- get_
priority ⚠ - Determine the priority of the current thread
- get_
processor_ ⚠count Deprecated - determines the number of activated processors
- getaddrbyname⚠
- The system call
getaddrbyname
determine the network host entry. It expects an array of u8 with a size of in_addr or of in6_addr. The result of the DNS request will be stored in this array. - getaddrinfo⚠
- getdents64⚠
getdents64
reads directory entries from the directory referenced by the file descriptorfd
into the buffer pointed to bybuf
.- getpeername⚠
- getpid⚠
- Determines the id of the current thread
- getsockname⚠
- getsockopt⚠
- ioctl⚠
- isatty
- returns true if file descriptor
fd
is a tty - join⚠
- join with a terminated thread
- listen⚠
- listen for connections on a socket
- lstat⚠
- lstat
- malloc⚠
- mkdir⚠
- ‘mkdir’ attempts to create a directory, it returns 0 on success and -1 on error
- nanosleep⚠
- suspend thread execution for an interval measured in nanoseconds
- network_
init ⚠ - initialize the network stack
- notify⚠
- open⚠
- open and possibly create a file
- opendir⚠
Deprecated - open a directory
- poll⚠
- The unix-like
poll
waits for one of a set of file descriptors to become ready to perform I/O. The set of file descriptors to be monitored is specified in thefds
argument, which is an array of structures ofpollfd
. - read⚠
- read from a file descriptor
- read_
entropy ⚠ - Fill
len
bytes inbuf
with cryptographically secure random data. - readv⚠
read()
attempts to readnbyte
of data to the object referenced by the descriptorfd
from a buffer.read()
performs the same action, but scatters the input data from theiovcnt
buffers specified by the members of the iov array:iov[0], iov[1], ..., iov[iovcnt-1]
.- realloc⚠
- recv⚠
- receive() a message from a socket
- recvfrom⚠
- receive() a message from a socket
- rmdir⚠
- remove directory it refers to
name
- sem_
destroy ⚠ - sem_destroy() frees the unnamed semaphore at the address
pointed to by
sem
. - sem_
init ⚠ - sem_init() initializes the unnamed semaphore at the address
pointed to by
sem
. Thevalue
argument specifies the initial value for the semaphore. Ifpshared
is nonzero, then the semaphore is shared between processes (currently not supported). - sem_
post ⚠ - sem_post() increments the semaphore pointed to by
sem
. If the semaphore’s value consequently becomes greater than zero, then another thread blocked in a sem_wait call will be woken up and proceed to lock the semaphore. - sem_
timedwait ⚠ - decrement a semaphore
- sem_
trywait ⚠ - try to decrement a semaphore
- send⚠
- sendto⚠
- set_
priority ⚠ - Determine the priority of the current thread
- setsockopt⚠
- shutdown⚠
- shut down part of a full-duplex connection
- shutdown_
socket ⚠Deprecated - socket⚠
- spawn⚠
- spawn a new thread
- spawn2⚠
- spawn a new thread with user-specified stack size
- stat⚠
- stat
- unlink⚠
- delete the file it refers to
name
- usleep⚠
- suspend execution for microsecond intervals
- wakeup_
task ⚠ - Wakeup task with the thread id
tid
- write⚠
- write to a file descriptor
- writev⚠
write()
attempts to writenbyte
of data to the object referenced by the descriptorfd
from a buffer.writev()
performs the same action, but gathers the output data from theiovcnt
buffers specified by the members of the iov array:iov[0], iov[1], ..., iov[iovcnt-1]
.- yield_
now ⚠ - yield the processor
Type Aliases§
- Tid
- A thread handle type
- c_int
- Equivalent to C’s
signed int
(int
) type. - c_short
- Equivalent to C’s
signed short
(short
) type. - clockid_
t - in_
addr_ t - in_
port_ t - nfds_t
- pid_t
- sa_
family_ t - sem_t
- socklen_
t - suseconds_
t - time_t
- useconds_
t