SYS_SOCKET
Create an endpoint for communication. Arguments:
`1st` | Protocol family which will be used for communication. The currently understood formats include: *should add more*
`PF_UNIX, PF_LOCAL` | `Local communication.`
`PF_INET` | `IPv4 Internet protocols.`
`PF_INET6` | `IPv6 Internet protocols.`
`PF_IPX` | `IPX - Novell protocols.`
`PF_NETLINK` | `Kernel user interface device.`
`PF_X25` | `ITU-T X.25 / ISO-8208 protocol.`
`PF_AX25` | `Amateur radio AX.25 protocol.`
`PF_ATMPVC` | `Access to raw ATM PVCs.`
`PF_APPLETALK` | `Appletalk.`
`PF_PACKET` | `Low level packet interface.`
`2nd` | Communication semantics. Currently defined types are:
`SOCK_STREAM` | `Provides sequenced, reliable, two-way, connection-based byte streams. An out-of-band data transmission mechanism may be supported. Such sockets types are full-duplex byte streams, similar to pipes. They do not preserve record boundaries. A stream socket must be in a connected state before any data may be sent or received on it. A connection to another socket is created with a SYS_CONNECT call. Once connected, data may be transferred using sys_read and sys_write calls or some variant of the SYS_SEND and SYS_RECV calls. When a session has been completed a sys_close may be performed. The communications protocols which implement a SOCK_STREAM ensure that data is not lost or duplicated. If a piece of data for which the peer protocol has buffer space cannot be successfully transmitted within a reasonable length of time, then the connection is considered to be dead. When SO_KEEPALIVE is enabled on the socket the protocol checks in a protocol-specific manner if the other end is still alive. A SIGPIPE signal is raised if a process sends or receives on a broken stream; this causes naive processes, which do not handle the signal, to exit.`
`SOCK_DGRAM` | `Supports datagrams (connectionless, unreliable messages of a fixed maximum length). Datagrams are sent to correspondents named in SYS_SENDTO calls. Datagrams are generally received with SYS_RECVFROM, which returns the next datagram along with the address of its sender.`
`SOCK_RAW` | `Provides raw network protocol access and allows sending of datagrams to correspondents named in SYS_SENDTO calls. Datagrams are generally received with SYS_RECVFROM, which returns the next datagram along with the address of its sender.`
`SOCK_RDM` | `Provides a reliable datagram layer that does not guarantee ordering.`
`SOCK_SEQPACKET` | `Provides a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each read system call. SOCK_SEQPACKET sockets employ the same system calls as SOCK_STREAM sockets. The only difference is that sys_read calls will return only the amount of data requested, and any data remaining in the arriving packet will be discarded. Also all message boundaries in incoming datagrams are preserved.`
`SOCK_DCCP` | `*to be documented*`
`SOCK_PACKET` | `Obsolete and should not be used in new programs; see man 7 packet. SCOK_PACKET allowed to receive raw packets directly from the device driver.`
Some socket types may not be implemented by all protocol families; for example, SOCK_SEQPACKET is not implemented for AF_INET.
`3rd` | Protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family, in which case this argument can be specified as 0. However, it is possible that many protocols may exist, in which case a particular protocol must be specified in this manner. The protocol number to use is specific to the "communication domain" in which communication is to take place. See /etc/protocols for a list of available protocols.
Return values If the system call succeeds the return value is a file descriptor for the new socket. If the system call fails the return value is one of the following errno values (other errors may be generated by the underlying protocol modules.):
`-EACCES` | `Permission to create a socket of the specified type and/or protocol is denied.`
`-EAFNOSUPPORT` | `The implementation does not support the specified address family.`
`-EINVAL` | `Unknown protocol, or protocol family not available.`
`-EMFILE` | `Process file table overflow.`
`-ENFILE` | `The system limit on the total number of open files has been reached.`
`-ENOBUFS, -ENOMEM` | `Insufficient memory is available. The socket cannot be created until sufficient resources are freed.`
`-EPROTONOSUPPORT` | `The protocol type or the specified protocol is not supported within this domain.`
Remarks An sys_fcntl F_SETOWN operation can be used to specify a process or process group to receive a SIGURG signal when the out-of-band data arrives or SIGPIPE signal when a SOCK_STREAM connection breaks unexpectedly. This operation may also be used to set the process or process group that receives the I/O and asynchronous notification of I/O events via SIGIO. Using F_SETOWN is equivalent to an sys_ioctl call with the FIOSETOWN or SIOCSPGRP argument. When the network signals an error condition to the protocol module (e.g., using a ICMP message for IP) the pending error flag is set for the socket. The next operation on this socket will return the error code of the pending error. For some protocols it is possible to enable a per-socket error queue to retrieve detailed information about the error; see IP_RECVERR in man 7 ip. See /samples/basic/socket/icmp.asm for an example. Compatibility n/a