date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libc / sys / getsockname.2
CommitLineData
da268306
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
b17ac36d 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
da268306 5.\"
91cff1e1 6.\" @(#)getsockname.2 6.3 (Berkeley) %G%
b17ac36d 7.\"
063dabfb 8.TH GETSOCKNAME 2 ""
b17ac36d
KM
9.UC 5
10.SH NAME
11getsockname \- get socket name
12.SH SYNOPSIS
13.nf
14.PP
15.ft B
16getsockname(s, name, namelen)
17int s;
18struct sockaddr *name;
19int *namelen;
20.fi
21.SH DESCRIPTION
22.I Getsockname
23returns the current
24.I name
25for the specified socket. The
26.I namelen
27parameter should be initialized to indicate
28the amount of space pointed to by
29.IR name .
30On return it contains the actual size of the name
31returned (in bytes).
32.SH DIAGNOSTICS
33A 0 is returned if the call succeeds, \-1 if it fails.
34.SH ERRORS
35The call succeeds unless:
36.TP 15
37[EBADF]
38The argument \fIs\fP is not a valid descriptor.
39.TP 15
40[ENOTSOCK]
41The argument \fIs\fP is a file, not a socket.
42.TP 15
43[ENOBUFS]
44Insufficient resources were available in the system
45to perform the operation.
46.TP 15
47[EFAULT]
48The
49.I name
50parameter points to memory not in a valid part of the
51process address space.
52.SH "SEE ALSO"
53bind(2), socket(2)
54.SH BUGS
55Names bound to sockets in the UNIX domain are inaccessible;
56.I getsockname
57returns a zero length name.