9.14 socket

#define AF_INET   1
#define AF_INET6  2
#define AF_UNIX   3

#define SOCK_DGRAM     0b000000000000000001
#define SOCK_RAW       0b000000000000000010
#define SOCK_STREAM    0b000000000000000100
#define SOCK_SEQPACKET 0b000000000000001000
#define SOCK_NONBLOCK  0b001000000000000000
#define SOCK_CLOEXEC   0b010000000000000000
#define SOCK_CLOFORK   0b100000000000000000
int socket(int domain, int type);

This syscall for creating sockets, the passed fields can be used for selecting the type of socket to create. The available sockets type are:

type can be one of:

Any socket type may have type be OR’ed with SOCK_NONBLOCK or SOCK_CLOEXEC for setting the created socket nonblock or cloese on exec respectively.

The syscall returns the resulting FD or -1 on failure, with the following errno: