1 SOCKETPAIR(3C)           Standard C Library Functions           SOCKETPAIR(3C)
   2 
   3 NAME
   4      socketpair - create a pair of connected sockets
   5 
   6 LIBRARY
   7      Standard C Library (libc, -lc)
   8 
   9 SYNOPSIS
  10      #include <sys/types.h>
  11      #include <sys/socket.h>
  12 
  13      int
  14      socketpair(int domain, int type, int protocol, int sv[2]);
  15 
  16 DESCRIPTION
  17      The socketpair() library call creates an unnamed pair of connected
  18      sockets in the specified address family domain, of the specified type,
  19      that uses the optionally specified protocol.  The descriptors that are
  20      used in referencing the new sockets are returned in sv[0] and sv[1].  The
  21      two sockets are indistinguishable.
  22 
  23 RETURN VALUES
  24      socketpair() returns -1 on failure and 0 on success.
  25 
  26 ERRORS
  27      The call succeeds unless:
  28 
  29      [EAFNOSUPPORT]     The specified address family is not supported on this
  30                         machine.
  31 
  32      [EMFILE]           Too many descriptors are in use by this process.
  33 
  34      [ENOMEM]           There was insufficient user memory for the operation
  35                         to complete.
  36 
  37      [ENOSR]            There were insufficient STREAMS resources for the
  38                         operation to complete.
  39 
  40      [EOPNOTSUPP]       The specified protocol does not support creation of
  41                         socket pairs.
  42 
  43      [EPROTONOSUPPORT]  The specified protocol is not supported on this
  44                         machine.
  45 
  46      [EACCES]           The process does not have appropriate privileges.
  47 
  48 MT-LEVEL
  49      Safe
  50 
  51 SEE ALSO
  52      pipe(2), read(2), write(2), socket.h(3HEAD), attributes(5)
  53 
  54 NOTES
  55      This call is currently implemented only for the AF_UNIX address family.
  56 
  57 illumos                         August 2, 2018                         illumos