source: asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/network/socketpair.c@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 736 bytes
Line 
1#include <sys/socket.h>
2#include <fcntl.h>
3#include <errno.h>
4#include "syscall.h"
5
6int socketpair(int domain, int type, int protocol, int fd[2])
7{
8 int r = socketcall(socketpair, domain, type, protocol, fd, 0, 0);
9 if (r<0 && (errno==EINVAL || errno==EPROTONOSUPPORT)
10 && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
11 r = socketcall(socketpair, domain,
12 type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK),
13 protocol, fd, 0, 0);
14 if (r < 0) return r;
15 if (type & SOCK_CLOEXEC) {
16 __syscall(SYS_fcntl, fd[0], F_SETFD, FD_CLOEXEC);
17 __syscall(SYS_fcntl, fd[1], F_SETFD, FD_CLOEXEC);
18 }
19 if (type & SOCK_NONBLOCK) {
20 __syscall(SYS_fcntl, fd[0], F_SETFL, O_NONBLOCK);
21 __syscall(SYS_fcntl, fd[1], F_SETFL, O_NONBLOCK);
22 }
23 }
24 return r;
25}
Note: See TracBrowser for help on using the repository browser.