Print this page
9704 move socket functions to libc

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libsocket/socket/socketpair.c
          +++ new/usr/src/lib/libc/port/socket/socketpair.c
↓ open down ↓ 29 lines elided ↑ open up ↑
  30   30  /*
  31   31   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   32   * The Regents of the University of California
  33   33   * All Rights Reserved
  34   34   *
  35   35   * University Acknowledgment- Portions of this document are derived from
  36   36   * software developed by the University of California, Berkeley, and its
  37   37   * contributors.
  38   38   */
  39   39  
  40      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  41      -
  42   40  #include <sys/types.h>
  43   41  #include <sys/socket.h>
  44   42  #include <sys/stropts.h>
  45   43  #include <sys/stream.h>
  46   44  #include <sys/socketvar.h>
  47   45  #include <errno.h>
  48   46  #include <unistd.h>
  49   47  #include <stdlib.h>
  50   48  
  51      -extern int _socket_create(int, int, int, int);
  52      -extern int _so_socketpair(int*);
       49 +extern int _so_socket(int, int, int, dev_t, int);
       50 +extern int _so_socketpair(int *);
  53   51  
  54   52  int _socketpair_create(int, int, int, int*, int);
  55   53  
  56   54  #pragma weak socketpair = _socketpair
  57   55  
  58   56  int
  59   57  _socketpair(int family, int type, int protocol, int sv[2])
  60   58  {
  61   59          return (_socketpair_create(family, type, protocol, sv, SOV_DEFAULT));
  62   60  }
↓ open down ↓ 24 lines elided ↑ open up ↑
  87   85  int
  88   86  _socketpair_create(int family, int type, int protocol, int sv[2], int version)
  89   87  {
  90   88          int res;
  91   89          int fd1, fd2;
  92   90  
  93   91          /*
  94   92           * Create the two sockets and pass them to _so_socketpair, which
  95   93           * will connect them together.
  96   94           */
  97      -        fd1 = _socket_create(family, type, protocol, version);
       95 +        fd1 = _so_socket(family, type, protocol, NULL, version);
  98   96          if (fd1 < 0)
  99   97                  return (-1);
 100      -        fd2 = _socket_create(family, type, protocol, version);
       98 +        fd2 = _so_socket(family, type, protocol, NULL, version);
 101   99          if (fd2 < 0) {
 102  100                  int error = errno;
 103  101  
 104  102                  (void) close(fd1);
 105  103                  errno = error;
 106  104                  return (-1);
 107  105          }
 108  106          sv[0] = fd1;
 109  107          sv[1] = fd2;
 110  108          res = _so_socketpair(sv);
↓ open down ↓ 20 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX