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