Crate hermit_abi

Source
Expand description

hermit-abi is small interface to call functions from the Hermit unikernel.

Re-exports§

pub use self::errno::*;

Modules§

errno

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 of iov_len bytes.
ip_mreq
ipv6_mreq
linger
pollfd
sockaddr
sockaddr_in
sockaddr_in6
sockaddr_storage
sockaddr_vm
stat
timespec
timespec is used by clock_gettime to retrieve the current time
timeval

Enums§

c_void
Equivalent to C’s void type when used as a pointer.

Constants§

AF_INET
Socket address family: IPv4
AF_INET6
Socket address family: IPv6
AF_VSOCK
Socket address family: VSOCK protocol for hypervisor-guest communication
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
PROT_EXEC
Indicates that the memory region should be executable.
PROT_NONE
Pages may not be accessed.
PROT_READ
Indicates that the memory region should be readable.
PROT_WRITE
Indicates that the memory region should be writable.
RAND_MAX
The largest number rand will return
SEEK_CUR
The file offset is set to its current location plus offset bytes.
SEEK_END
The file offset is set to the size of the file plus offset bytes.
SEEK_SET
The file offset is set to offset bytes.
SHUT_RD
SHUT_RDWR
SHUT_WR
SOCK_CLOEXEC
Set the close-on-exec flag on the new socket
SOCK_DGRAM
Socket supports datagrams (connectionless, unreliable messages of a fixed maximum length)
SOCK_NONBLOCK
Set the O_NONBLOCK file status flag on the open socket
SOCK_STREAM
Socket provides sequenced, reliable, two-way, connection-based byte streams.
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
VMADDR_CID_ANY
VMADDR_CID_ANY means that any address is possible for binding
VMADDR_CID_HOST
VMADDR_CID_HYPERVISOR
VMADDR_CID_LOCAL

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, call yield_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 argument initval.
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 at address. Returns the number of threads woken up (saturates to i32::MAX). If count is i32::MAX, wake up all matching waiting threads. If count is negative or address 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_countDeprecated
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 descriptor fd into the buffer pointed to by buf.
getpagesize
Get memory page size
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
lseek
The fseek() function sets the file position indicator for the stream pointed to by stream. The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively.
lstat
lstat
malloc
mkdir
‘mkdir’ attempts to create a directory, it returns 0 on success and -1 on error
mmap
Creates a new virtual memory mapping of the size specified with protection bits specified in prot_flags.
mprotect
Configures the protections associated with a region of virtual memory starting at ptr and going to size.
munmap
Unmaps memory at the specified ptr for size bytes.
nanosleep
suspend thread execution for an interval measured in nanoseconds
network_init
initialize the network stack
notify
open
open and possibly create a file
opendirDeprecated
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 the fds argument, which is an array of structures of pollfd.
read
read from a file descriptor
read_entropy
Fill len bytes in buf with cryptographically secure random data.
readv
read() attempts to read nbyte of data to the object referenced by the descriptor fd from a buffer. read() performs the same action, but scatters the input data from the iovcnt 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. The value argument specifies the initial value for the semaphore. If pshared 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_socketDeprecated
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 write nbyte of data to the object referenced by the descriptor fd from a buffer. writev() performs the same action, but gathers the output data from the iovcnt 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