xref: /csrg-svn/lib/libc/sys/getsockname.2 (revision 61181)
1*61181Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61181Sbostic.\"	The Regents of the University of California.  All rights reserved.
320237Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520237Smckusick.\"
6*61181Sbostic.\"     @(#)getsockname.2	8.1 (Berkeley) 06/04/93
736759Sbostic.\"
847208Scael.Dd
947208Scael.Dt GETSOCKNAME 2
1047208Scael.Os BSD 4.2
1147208Scael.Sh NAME
1247208Scael.Nm getsockname
1347208Scael.Nd get socket name
1447208Scael.Sh SYNOPSIS
1547208Scael.Ft int
1647208Scael.Fn getsockname "int s" "struct sockaddr *name" "int *namelen"
1747208Scael.Sh DESCRIPTION
1847208Scael.Fn Getsockname
1920237Smckusickreturns the current
2047208Scael.Fa name
2120237Smckusickfor the specified socket.  The
2247208Scael.Fa namelen
2320237Smckusickparameter should be initialized to indicate
2420237Smckusickthe amount of space pointed to by
2547208Scael.Fa name .
2620237SmckusickOn return it contains the actual size of the name
2720237Smckusickreturned (in bytes).
2847208Scael.Sh DIAGNOSTICS
2947208ScaelA 0 is returned if the call succeeds, -1 if it fails.
3047208Scael.Sh ERRORS
3120237SmckusickThe call succeeds unless:
3247208Scael.Bl -tag -width ENOTSOCKAA
3347208Scael.It Bq Er EBADF
3447208ScaelThe argument
3547208Scael.Fa s
3647208Scaelis not a valid descriptor.
3747208Scael.It Bq Er ENOTSOCK
3847208ScaelThe argument
3947208Scael.Fa s
4047208Scaelis a file, not a socket.
4147208Scael.It Bq Er ENOBUFS
4220237SmckusickInsufficient resources were available in the system
4320237Smckusickto perform the operation.
4447208Scael.It Bq Er EFAULT
4520237SmckusickThe
4647208Scael.Fa name
4720237Smckusickparameter points to memory not in a valid part of the
4820237Smckusickprocess address space.
4947208Scael.El
5047208Scael.Sh SEE ALSO
5147208Scael.Xr bind 2 ,
5247208Scael.Xr socket 2
5347208Scael.Sh BUGS
5420237SmckusickNames bound to sockets in the UNIX domain are inaccessible;
5547208Scael.Xr getsockname
5620237Smckusickreturns a zero length name.
5747208Scael.Sh HISTORY
5847208ScaelThe
5947208Scael.Nm
6047208Scaelfunction call appeared in
6147208Scael.Bx 4.2 .
62