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