Commit | Line | Data |
---|---|---|
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 | |
11 | getsockname \- get socket name | |
12 | .SH SYNOPSIS | |
13 | .nf | |
14 | .PP | |
15 | .ft B | |
16 | getsockname(s, name, namelen) | |
17 | int s; | |
18 | struct sockaddr *name; | |
19 | int *namelen; | |
20 | .fi | |
21 | .SH DESCRIPTION | |
22 | .I Getsockname | |
23 | returns the current | |
24 | .I name | |
25 | for the specified socket. The | |
26 | .I namelen | |
27 | parameter should be initialized to indicate | |
28 | the amount of space pointed to by | |
29 | .IR name . | |
30 | On return it contains the actual size of the name | |
31 | returned (in bytes). | |
32 | .SH DIAGNOSTICS | |
33 | A 0 is returned if the call succeeds, \-1 if it fails. | |
34 | .SH ERRORS | |
35 | The call succeeds unless: | |
36 | .TP 15 | |
37 | [EBADF] | |
38 | The argument \fIs\fP is not a valid descriptor. | |
39 | .TP 15 | |
40 | [ENOTSOCK] | |
41 | The argument \fIs\fP is a file, not a socket. | |
42 | .TP 15 | |
43 | [ENOBUFS] | |
44 | Insufficient resources were available in the system | |
45 | to perform the operation. | |
46 | .TP 15 | |
47 | [EFAULT] | |
48 | The | |
49 | .I name | |
50 | parameter points to memory not in a valid part of the | |
51 | process address space. | |
52 | .SH "SEE ALSO" | |
53 | bind(2), socket(2) | |
54 | .SH BUGS | |
55 | Names bound to sockets in the UNIX domain are inaccessible; | |
56 | .I getsockname | |
57 | returns a zero length name. |