Last change
on this file was 389, checked in by coas-nagasima, 5 years ago |
ビルドが通るよう更新
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
585 bytes
|
Rev | Line | |
---|
[388] | 1 | #include <sys/socket.h>
|
---|
| 2 | #include <fcntl.h>
|
---|
| 3 | #include <errno.h>
|
---|
| 4 | #include "syscall.h"
|
---|
| 5 |
|
---|
| 6 | int socket(int domain, int type, int protocol)
|
---|
| 7 | {
|
---|
| 8 | int s = socketcall(socket, domain, type, protocol, 0, 0, 0);
|
---|
| 9 | if (s<0 && (errno==EINVAL || errno==EPROTONOSUPPORT)
|
---|
| 10 | && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
|
---|
| 11 | s = socketcall(socket, domain,
|
---|
| 12 | type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK),
|
---|
| 13 | protocol, 0, 0, 0);
|
---|
| 14 | if (s < 0) return s;
|
---|
| 15 | if (type & SOCK_CLOEXEC)
|
---|
| 16 | __syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC);
|
---|
| 17 | if (type & SOCK_NONBLOCK)
|
---|
| 18 | __syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK);
|
---|
| 19 | }
|
---|
| 20 | return s;
|
---|
| 21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.