socketpair.c 325 B

123456789101112131415161718192021
  1. /* posix */
  2. #include <sys/types.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <errno.h>
  6. /* bsd extensions */
  7. #include <sys/uio.h>
  8. #include <sys/socket.h>
  9. int
  10. socketpair(int domain, int type, int protocol, int *sv)
  11. {
  12. switch(domain){
  13. case PF_UNIX:
  14. return pipe(sv);
  15. default:
  16. errno = EOPNOTSUPP;
  17. return -1;
  18. }
  19. }