X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/91447636331957f3d9b5ca5b508f07c526b0074d..eee3565979933af707c711411001ba11fe406a3c:/bsd/man/man2/getsockname.2 diff --git a/bsd/man/man2/getsockname.2 b/bsd/man/man2/getsockname.2 index 2d63acb38..58950e7df 100644 --- a/bsd/man/man2/getsockname.2 +++ b/bsd/man/man2/getsockname.2 @@ -42,49 +42,73 @@ .Sh SYNOPSIS .Fd #include .Ft int -.Fn getsockname "int s" "struct sockaddr *name" "socklen_t *namelen" +.Fo getsockname +.Fa "int socket" +.Fa "struct sockaddr *restrict address" +.Fa "socklen_t *restrict address_len" +.Fc .Sh DESCRIPTION -.Fn Getsockname -returns the current -.Fa name -for the specified socket. The -.Fa namelen +The +.Fn getsockname +function returns the current +.Fa address +for the specified socket. +.Pp +The +.Fa address_len parameter should be initialized to indicate the amount of space pointed to by -.Fa name . -On return it contains the actual size of the name +.Fa address . +On return it contains the actual size of the address returned (in bytes). -.Sh DIAGNOSTICS -A 0 is returned if the call succeeds, -1 if it fails. +.Pp +The address is truncated if the buffer provided is too small. +.Sh RETURN VALUES +.Rv -std getsockname .Sh ERRORS -The call succeeds unless: +The +.Fn getsockname +system call will succeed unless: .Bl -tag -width Er +.\" ========== .It Bq Er EBADF The argument -.Fa s -is not a valid descriptor. -.It Bq Er ENOTSOCK -The argument -.Fa s -is a file, not a socket. -.It Bq Er ENOBUFS -Insufficient resources were available in the system -to perform the operation. +.Fa socket +is not a valid file descriptor. +.\" ========== .It Bq Er EFAULT The -.Fa name +.Fa address parameter points to memory not in a valid part of the process address space. +.\" ========== +.It Bq Er EINVAL +.Fa socket +has been shut down. +.\" ========== +.It Bq Er ENOBUFS +Insufficient resources were available in the system +to perform the operation. +.\" ========== +.It Bq Er ENOTSOCK +The argument +.Fa socket +is not a socket (e.g., a plain file). +.\" ========== +.It Bq Er EOPNOTSUPP +.Fn getsockname +is not supported for the protocol in use by +.Fa socket . .El .Sh SEE ALSO .Xr bind 2 , .Xr socket 2 .Sh BUGS Names bound to sockets in the UNIX domain are inaccessible; -.Xr getsockname -returns a zero length name. +.Fn getsockname +returns a zero-length address. .Sh HISTORY The .Fn getsockname -function call appeared in +call appeared in .Bx 4.2 .