Commit | Line | Data |
---|---|---|
da268306 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
b17ac36d | 3 | .\" |
da268306 KB |
4 | .\" Redistribution and use in source and binary forms are permitted |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
16 | .\" @(#)getsockname.2 6.2 (Berkeley) %G% | |
b17ac36d | 17 | .\" |
063dabfb | 18 | .TH GETSOCKNAME 2 "" |
b17ac36d KM |
19 | .UC 5 |
20 | .SH NAME | |
21 | getsockname \- get socket name | |
22 | .SH SYNOPSIS | |
23 | .nf | |
24 | .PP | |
25 | .ft B | |
26 | getsockname(s, name, namelen) | |
27 | int s; | |
28 | struct sockaddr *name; | |
29 | int *namelen; | |
30 | .fi | |
31 | .SH DESCRIPTION | |
32 | .I Getsockname | |
33 | returns the current | |
34 | .I name | |
35 | for the specified socket. The | |
36 | .I namelen | |
37 | parameter should be initialized to indicate | |
38 | the amount of space pointed to by | |
39 | .IR name . | |
40 | On return it contains the actual size of the name | |
41 | returned (in bytes). | |
42 | .SH DIAGNOSTICS | |
43 | A 0 is returned if the call succeeds, \-1 if it fails. | |
44 | .SH ERRORS | |
45 | The call succeeds unless: | |
46 | .TP 15 | |
47 | [EBADF] | |
48 | The argument \fIs\fP is not a valid descriptor. | |
49 | .TP 15 | |
50 | [ENOTSOCK] | |
51 | The argument \fIs\fP is a file, not a socket. | |
52 | .TP 15 | |
53 | [ENOBUFS] | |
54 | Insufficient resources were available in the system | |
55 | to perform the operation. | |
56 | .TP 15 | |
57 | [EFAULT] | |
58 | The | |
59 | .I name | |
60 | parameter points to memory not in a valid part of the | |
61 | process address space. | |
62 | .SH "SEE ALSO" | |
63 | bind(2), socket(2) | |
64 | .SH BUGS | |
65 | Names bound to sockets in the UNIX domain are inaccessible; | |
66 | .I getsockname | |
67 | returns a zero length name. |