X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/55e303ae13a4cf49d70f2294092726f2fffb9ef2..bb59bff194111743b33cc36712410b5656329d3c:/bsd/man/man2/socket.2?ds=sidebyside diff --git a/bsd/man/man2/socket.2 b/bsd/man/man2/socket.2 index 3083d3983..c19161723 100644 --- a/bsd/man/man2/socket.2 +++ b/bsd/man/man2/socket.2 @@ -35,15 +35,18 @@ .\" .Dd June 4, 1993 .Dt SOCKET 2 -.Os BSD 4.2 +.Os .Sh NAME .Nm socket .Nd create an endpoint for communication .Sh SYNOPSIS -.Fd #include .Fd #include .Ft int -.Fn socket "int domain" "int type" "int protocol" +.Fo socket +.Fa "int domain" +.Fa "int type" +.Fa "int protocol" +.Fc .Sh DESCRIPTION .Fn Socket creates an endpoint for communication and returns a descriptor. @@ -58,11 +61,14 @@ These families are defined in the include file The currently understood formats are .Pp .Bd -literal -offset indent -compact -AF_UNIX (UNIX internal protocols), -AF_INET (ARPA Internet protocols), -AF_ISO (ISO protocols), -AF_NS (Xerox Network Systems protocols), and -AF_IMPLINK (IMP \*(lqhost at IMP\*(rq link layer). +PF_LOCAL Host-internal protocols, formerly called PF_UNIX, +PF_UNIX Host-internal protocols, deprecated, use PF_LOCAL, +PF_INET Internet version 4 protocols, +PF_ROUTE Internal Routing protocol, +PF_KEY Internal key-management function, +PF_INET6 Internet version 6 protocols, +PF_SYSTEM System domain, +PF_NDRV Raw access to network device .Ed .Pp The socket has the indicated @@ -212,27 +218,54 @@ value is a descriptor referencing the socket. .Sh ERRORS The .Fn socket -call fails if: +system call fails if: .Bl -tag -width Er -.It Bq Er EPROTONOSUPPORT -The protocol type or the specified protocol is not supported -within this domain. +.\" =========== +.It Bq Er EACCES +Permission to create a socket of the specified type and/or protocol +is denied. +.\" =========== +.It Bq Er EAFNOSUPPORT +The specified address family is not supported. +.\" =========== .It Bq Er EMFILE The per-process descriptor table is full. +.\" =========== .It Bq Er ENFILE The system file table is full. -.It Bq Er EACCES -Permission to create a socket of the specified type and/or protocol -is denied. +.\" =========== .It Bq Er ENOBUFS Insufficient buffer space is available. The socket cannot be created until sufficient resources are freed. +.\" =========== +.It Bq Er ENOMEM +Insufficient memory was available to fulfill the request. +.\" =========== +.It Bq Er EPROTONOSUPPORT +The protocol type or the specified protocol is not supported +within this domain. +.\" =========== +.It Bq Er EPROTOTYPE +The socket type is not supported by the protocol. .El +.Pp +If a new protocol family is defined, +the socreate process is free to return any desired error code. +The +.Fn socket +system call will pass this error code along +(even if it is undefined). +.Sh LEGACY SYNOPSIS +.Fd #include +.Fd #include +.Pp +The include file +.In sys/types.h +is necessary. .Sh SEE ALSO .Xr accept 2 , .Xr bind 2 , .Xr connect 2 , -.Xr getprotoent 3 , .Xr getsockname 2 , .Xr getsockopt 2 , .Xr ioctl 2 , @@ -243,7 +276,12 @@ The socket cannot be created until sufficient resources are freed. .Xr send 2 , .Xr shutdown 2 , .Xr socketpair 2 , -.Xr write 2 +.Xr write 2 , +.Xr getprotoent 3 , +.Xr inet 4 , +.Xr inet6 4 , +.Xr unix 4 , +.Xr compat 5 .Rs .%T "An Introductory 4.3 BSD Interprocess Communication Tutorial" .%O "reprinted in UNIX Programmer's Supplementary Documents Volume 1"