sockaddr's now require length (K. Sklower);
[unix-history] / usr / src / lib / libc / sys / socketpair.2
CommitLineData
2a693a1d
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.\"
bce6b55f 5.\" @(#)socketpair.2 6.1 (Berkeley) %G%
2a693a1d 6.\"
bce6b55f 7.TH SOCKETPAIR 2 ""
2a693a1d
KM
8.UC 5
9.SH NAME
10socketpair \- create a pair of connected sockets
11.SH SYNOPSIS
12.nf
13.ft B
14#include <sys/types.h>
15#include <sys/socket.h>
16.PP
17.ft B
18socketpair(d, type, protocol, sv)
19int d, type, protocol;
20int sv[2];
21.fi
22.SH DESCRIPTION
23The
24.I socketpair
25call creates an unnamed pair of connected sockets in
26the specified domain
27.IR d ,
28of the specified
29.IR type ,
30and using the optionally specified
31.IR protocol .
32The descriptors used in referencing the new sockets
33are returned in
34.IR sv [0]
35and
36.IR sv [1].
37The two sockets are indistinguishable.
38.SH DIAGNOSTICS
39A 0 is returned if the call succeeds, \-1 if it fails.
40.SH ERRORS
41The call succeeds unless:
42.TP 20
43[EMFILE]
44Too many descriptors are in use by this process.
45.TP 20
46[EAFNOSUPPORT]
47The specified address family is not supported on this machine.
48.TP 20
49[EPROTONOSUPPORT]
50The specified protocol is not supported on this machine.
51.TP 20
52[EOPNOSUPPORT]
53The specified protocol does not support creation of socket pairs.
54.TP 20
55[EFAULT]
56The address \fIsv\fP does not specify a valid part of the
57process address space.
58.SH "SEE ALSO"
59read(2), write(2), pipe(2)
60.SH BUGS
61This call is currently implemented only for the UNIX domain.