xref: /csrg-svn/lib/libc/sys/socketpair.2 (revision 61185)
1*61185Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61185Sbostic.\"	The Regents of the University of California.  All rights reserved.
320273Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520273Smckusick.\"
6*61185Sbostic.\"     @(#)socketpair.2	8.1 (Berkeley) 06/04/93
736759Sbostic.\"
847208Scael.Dd
947208Scael.Dt SOCKETPAIR 2
1047208Scael.Os BSD 4.2
1147208Scael.Sh NAME
1247208Scael.Nm socketpair
1347208Scael.Nd create a pair of connected sockets
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <sys/types.h>
1647208Scael.Fd #include <sys/socket.h>
1747208Scael.Ft int
1847208Scael.Fn socketpair "int d" "int type" "int protocol" "int *sv"
1947208Scael.Sh DESCRIPTION
2020273SmckusickThe
2147208Scael.Fn socketpair
2220273Smckusickcall creates an unnamed pair of connected sockets in
2320273Smckusickthe specified domain
2447208Scael.Fa d ,
2520273Smckusickof the specified
2647208Scael.Fa type ,
2720273Smckusickand using the optionally specified
2847208Scael.Fa protocol .
2920273SmckusickThe descriptors used in referencing the new sockets
3020273Smckusickare returned in
3147208Scael.Fa sv Ns [0]
3220273Smckusickand
3347208Scael.Fa sv Ns [1] .
3420273SmckusickThe two sockets are indistinguishable.
3547208Scael.Sh DIAGNOSTICS
3647208ScaelA 0 is returned if the call succeeds, -1 if it fails.
3747208Scael.Sh ERRORS
3820273SmckusickThe call succeeds unless:
3947208Scael.Bl -tag -width EPROTONOSUPPORTA
4047208Scael.It Bq Er EMFILE
4120273SmckusickToo many descriptors are in use by this process.
4247208Scael.It Bq Er EAFNOSUPPORT
4320273SmckusickThe specified address family is not supported on this machine.
4447208Scael.It Bq Er EPROTONOSUPPORT
4520273SmckusickThe specified protocol is not supported on this machine.
4647208Scael.It Bq Er EOPNOSUPPORT
4720273SmckusickThe specified protocol does not support creation of socket pairs.
4847208Scael.It Bq Er EFAULT
4947208ScaelThe address
5047208Scael.Fa sv
5147208Scaeldoes not specify a valid part of the
5220273Smckusickprocess address space.
5347208Scael.Sh SEE ALSO
5447208Scael.Xr read 2 ,
5547208Scael.Xr write 2 ,
5647208Scael.Xr pipe 2
5747208Scael.Sh BUGS
5847208ScaelThis call is currently implemented only for the
5947208Scael.Tn UNIX
6047208Scaeldomain.
6147208Scael.Sh HISTORY
6247208ScaelThe
6347208Scael.Nm
6447208Scaelfunction call appeared in
6547208Scael.Bx 4.2 .
66