'\"macro stdmacro
.if n .pH g3n.getsockname @(#)getsockname	40.9 of 1/29/90
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} getsockname 3N "" "\&"
.if \nX=1 .ds x} getsockname 3N ""
.if \nX=2 .ds x} getsockname 3N "" "\&"
.if \nX=3 .ds x} getsockname "" "" "\&"
.TH \*(x}
.SH NAME
\f4getsockname\fP \- get socket name
.SH SYNOPSIS
.nf
.LP
.ft 4
getsockname(s, name, namelen)
int s;
struct sockaddr *name;
int *namelen;
.fi
.SH DESCRIPTION
.LP
\f4getsockname\fP(\|)
returns the current
.I name
for socket \f2s\fP.
The
.I namelen
parameter should be initialized to indicate
the amount of space pointed to by
.IR name .
On return it contains the actual size of the name
returned\fP(in bytes).
.SH RETURN VALUE
.LP
\f40\f1 is returned if the call succeeds; \f4-1\fP if it fails.
.SH ERRORS
.LP
The call succeeds unless:
.TP 20
\f4EBADF\f1
The argument
.I s
is not a valid descriptor.
.TP
\f4ENOTSOCK\f1
The argument
.I s
is a file, not a socket.
.TP
\f4ENOMEM\f1
There was insufficient user memory for the operation to complete.
.TP
\f4ENOSR\f1
There were insufficient 
.SM STREAMS
resources available for the operation
to complete.
.SH "SEE ALSO"
\f4bind\fP(3N),
\f4getpeername\fP(3N),
\f4socket\fP(3N)
