add fchdir to synopsis line
[unix-history] / usr / src / lib / libc / sys / socketpair.2
CommitLineData
da268306
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
2a693a1d 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.\" @(#)socketpair.2 6.2 (Berkeley) %G%
2a693a1d 17.\"
bce6b55f 18.TH SOCKETPAIR 2 ""
2a693a1d
KM
19.UC 5
20.SH NAME
21socketpair \- create a pair of connected sockets
22.SH SYNOPSIS
23.nf
24.ft B
25#include <sys/types.h>
26#include <sys/socket.h>
27.PP
28.ft B
29socketpair(d, type, protocol, sv)
30int d, type, protocol;
31int sv[2];
32.fi
33.SH DESCRIPTION
34The
35.I socketpair
36call creates an unnamed pair of connected sockets in
37the specified domain
38.IR d ,
39of the specified
40.IR type ,
41and using the optionally specified
42.IR protocol .
43The descriptors used in referencing the new sockets
44are returned in
45.IR sv [0]
46and
47.IR sv [1].
48The two sockets are indistinguishable.
49.SH DIAGNOSTICS
50A 0 is returned if the call succeeds, \-1 if it fails.
51.SH ERRORS
52The call succeeds unless:
53.TP 20
54[EMFILE]
55Too many descriptors are in use by this process.
56.TP 20
57[EAFNOSUPPORT]
58The specified address family is not supported on this machine.
59.TP 20
60[EPROTONOSUPPORT]
61The specified protocol is not supported on this machine.
62.TP 20
63[EOPNOSUPPORT]
64The specified protocol does not support creation of socket pairs.
65.TP 20
66[EFAULT]
67The address \fIsv\fP does not specify a valid part of the
68process address space.
69.SH "SEE ALSO"
70read(2), write(2), pipe(2)
71.SH BUGS
72This call is currently implemented only for the UNIX domain.