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