Commit | Line | Data |
---|---|---|
931b8415 | 1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
da268306 | 2 | .\" All rights reserved. |
b17ac36d | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
da268306 | 5 | .\" |
931b8415 | 6 | .\" @(#)getsockname.2 6.4 (Berkeley) %G% |
b17ac36d | 7 | .\" |
931b8415 CL |
8 | .Dd |
9 | .Dt GETSOCKNAME 2 | |
10 | .Os BSD 4.2 | |
11 | .Sh NAME | |
12 | .Nm getsockname | |
13 | .Nd get socket name | |
14 | .Sh SYNOPSIS | |
15 | .Ft int | |
16 | .Fn getsockname "int s" "struct sockaddr *name" "int *namelen" | |
17 | .Sh DESCRIPTION | |
18 | .Fn Getsockname | |
b17ac36d | 19 | returns the current |
931b8415 | 20 | .Fa name |
b17ac36d | 21 | for the specified socket. The |
931b8415 | 22 | .Fa namelen |
b17ac36d KM |
23 | parameter should be initialized to indicate |
24 | the amount of space pointed to by | |
931b8415 | 25 | .Fa name . |
b17ac36d KM |
26 | On return it contains the actual size of the name |
27 | returned (in bytes). | |
931b8415 CL |
28 | .Sh DIAGNOSTICS |
29 | A 0 is returned if the call succeeds, -1 if it fails. | |
30 | .Sh ERRORS | |
b17ac36d | 31 | The call succeeds unless: |
931b8415 CL |
32 | .Bl -tag -width ENOTSOCKAA |
33 | .It Bq Er EBADF | |
34 | The argument | |
35 | .Fa s | |
36 | is not a valid descriptor. | |
37 | .It Bq Er ENOTSOCK | |
38 | The argument | |
39 | .Fa s | |
40 | is a file, not a socket. | |
41 | .It Bq Er ENOBUFS | |
b17ac36d KM |
42 | Insufficient resources were available in the system |
43 | to perform the operation. | |
931b8415 | 44 | .It Bq Er EFAULT |
b17ac36d | 45 | The |
931b8415 | 46 | .Fa name |
b17ac36d KM |
47 | parameter points to memory not in a valid part of the |
48 | process address space. | |
931b8415 CL |
49 | .El |
50 | .Sh SEE ALSO | |
51 | .Xr bind 2 , | |
52 | .Xr socket 2 | |
53 | .Sh BUGS | |
b17ac36d | 54 | Names bound to sockets in the UNIX domain are inaccessible; |
931b8415 | 55 | .Xr getsockname |
b17ac36d | 56 | returns a zero length name. |
931b8415 CL |
57 | .Sh HISTORY |
58 | The | |
59 | .Nm | |
60 | function call appeared in | |
61 | .Bx 4.2 . |