Expand description
Socket, UNIX domain, and Virtio-Vsock syscall wrappers.
Structs§
- In6Addr
- IPv6 address (
struct in6_addr) in network byte order. - InAddr
- IPv4 address (
struct in_addr) in network byte order. - Sock
Addr In - Kernel
sockaddr_instructure forAF_INETsockets. - Sock
Addr In6 - Kernel
sockaddr_in6structure forAF_INET6sockets. - Sock
Addr Storage - Generic socket address storage (
struct sockaddr_storage, 128 bytes). - Sock
Addr Un - Kernel
sockaddr_unstructure for UNIX domain sockets. - Sock
Addr Vm - Kernel
sockaddr_vmstructure forAF_VSOCKsockets.
Constants§
- AF_INET
- IPv4 Internet protocols address family.
- AF_
INET6 - IPv6 Internet protocols address family.
- AF_UNIX
- Unix domain sockets address family.
- AF_
UNSPEC - Unspecified address family.
- AF_
VSOCK - Virtio vsock address family.
- IPPROTO_
ICMP - Internet Control Message Protocol.
- IPPROTO_
IP - Dummy protocol for TCP / IP level.
- IPPROTO_
IPV6 - IPv6 header protocol level.
- IPPROTO_
TCP - Transmission Control Protocol.
- IPPROTO_
UDP - User Datagram Protocol.
- IPV6_
V6ONLY - Restrict
AF_INET6socket to IPv6 communications only (IPPROTO_IPV6). - MSG_
DONTWAIT - Nonblocking I/O for a single send/recv call.
- MSG_
NOSIGNAL - Do not generate
SIGPIPEon peer close. - MSG_
WAITALL - Wait for full request or error.
- SHUT_RD
- Shut down the reading side of a socket.
- SHUT_
RDWR - Shut down both reading and writing sides of a socket.
- SHUT_WR
- Shut down the writing side of a socket.
- SOCK_
CLOEXEC - Set close-on-exec (
FD_CLOEXEC) on the new descriptor. - SOCK_
DGRAM - Connectionless, unreliable datagrams.
- SOCK_
NONBLOCK - Set
O_NONBLOCKon the new open file description. - SOCK_
STREAM - Sequenced, reliable, two-way connection-based byte streams.
- SOL_
SOCKET - Socket level for
getsockopt/setsockopt. - SO_
ERROR - Get and clear pending socket error.
- SO_
KEEPALIVE - Enable keep-alive messages on connection-oriented sockets.
- SO_
RCVBUF - Receive buffer size (
SOL_SOCKET). - SO_
RCVTIMEO - Receive timeout option.
- SO_
REUSEADDR - Allow reuse of local addresses.
- SO_
REUSEPORT - Allow multiple sockets to bind to the same port (
SOL_SOCKET). - SO_
SNDBUF - Send buffer size (
SOL_SOCKET). - SO_
SNDTIMEO - Send timeout option.
- TCP_
KEEPCNT - Number of keepalives before death (
IPPROTO_TCP). - TCP_
KEEPIDLE - Start keepalives after this period (
IPPROTO_TCP). - TCP_
KEEPINTVL - Interval between keepalives (
IPPROTO_TCP). - TCP_
NODELAY - Disable Nagle’s algorithm (
IPPROTO_TCP). - VMADDR_
CID_ ANY - Wildcard vsock context ID.
- VMADDR_
CID_ HOST - Host hypervisor vsock context ID.
- VMADDR_
CID_ LOCAL - Local loopback vsock context ID.
Functions§
- accept
- Accepts a connection on
fdwithout peer address capture. - accept4
- Accepts a connection on
fdwithflags(SOCK_NONBLOCK,SOCK_CLOEXEC) without peer address capture. - accept4_
raw ⚠ - Accepts a connection on
fdwithflags, optionally writing the peer address intoaddr. - accept_
in - Accepts an
AF_INETconnection onfdwithflags, returning(client_fd, peer_addr). - accept_
in6 - Accepts an
AF_INET6connection onfdwithflags, returning(client_fd, peer_addr). - bind_in
- Binds an
AF_INETsocketfdtoaddr. - bind_
in6 - Binds an
AF_INET6socketfdtoaddr. - bind_
raw ⚠ - Binds
fdto the raw socket address[addr..addr + addrlen]. - bind_
unix - Binds an
AF_UNIXsocketfdtopath. - bind_
vsock - Binds an
AF_VSOCKsocketfdtoaddr. - connect_
in - Connects an
AF_INETsocketfdtoaddr. - connect_
in6 - Connects an
AF_INET6socketfdtoaddr. - connect_
raw ⚠ - Connects
fdto the raw socket address[addr..addr + addrlen]. - connect_
unix - Connects an
AF_UNIXsocketfdtopath. - connect_
vsock - Connects an
AF_VSOCKsocketfdtoaddr. - get_
so_ error - Queries and clears any pending
SO_ERRORonfd. - getpeername_
raw ⚠ - Queries the peer address connected to
fd. - getsockname_
in - Queries the local
AF_INETaddress bound tofd. - getsockname_
in6 - Queries the local
AF_INET6address bound tofd. - getsockname_
raw ⚠ - Queries the local address bound to
fd. - getsockopt_
raw ⚠ - Gets a raw socket option from
fd. - listen
- Marks
fdas a passive socket with maximum pending connection queuebacklog. - recv
- Receives bytes into
buffrom socketfdwithflags. - recv_
raw ⚠ - Receives up to
lenbytes intobuffrom socketfdwithflags. - recvfrom_
in - Receives a datagram into
bufonAF_INETsocketfdwithflags, returning(bytes_read, src_addr). - recvfrom_
in6 - Receives a datagram into
bufonAF_INET6socketfdwithflags, returning(bytes_read, src_addr). - send
- Sends
bufon connected socketfdwithflags. - send_
raw ⚠ - Sends
lenbytes frombufon connected socketfdwithflags. - sendto_
in - Sends
bufto anAF_INETdestinationaddron socketfdwithflags. - sendto_
in6 - Sends
bufto anAF_INET6destinationaddron socketfdwithflags. - set_
tcp_ nodelay - Enables or disables
TCP_NODELAYonfd. - setsockopt_
raw ⚠ - Sets a raw socket option on
fd. - shutdown
- Shuts down part or all of a full-duplex connection on
fd. - socket
- Creates an endpoint for communication and returns its file descriptor.
- socketpair
- Creates an unnamed pair of connected sockets.