Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: fusl/src/network/socketpair.c

Issue 1730723002: [fusl] Remove socketcall abstraction (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/network/socket.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <sys/socket.h> 1 #include <sys/socket.h>
2 #include <fcntl.h> 2 #include <fcntl.h>
3 #include <errno.h> 3 #include <errno.h>
4 #include "syscall.h" 4 #include "syscall.h"
5 5
6 int socketpair(int domain, int type, int protocol, int fd[2]) { 6 int socketpair(int domain, int type, int protocol, int fd[2]) {
7 int r = socketcall(socketpair, domain, type, protocol, fd, 0, 0); 7 int r = syscall(SYS_socketpair, domain, type, protocol, fd, 0, 0);
8 if (r < 0 && (errno == EINVAL || errno == EPROTONOSUPPORT) && 8 if (r < 0 && (errno == EINVAL || errno == EPROTONOSUPPORT) &&
9 (type & (SOCK_CLOEXEC | SOCK_NONBLOCK))) { 9 (type & (SOCK_CLOEXEC | SOCK_NONBLOCK))) {
10 r = socketcall(socketpair, domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), 10 r = syscall(SYS_socketpair, domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK),
11 protocol, fd, 0, 0); 11 protocol, fd, 0, 0);
12 if (r < 0) 12 if (r < 0)
13 return r; 13 return r;
14 if (type & SOCK_CLOEXEC) { 14 if (type & SOCK_CLOEXEC) {
15 __syscall(SYS_fcntl, fd[0], F_SETFD, FD_CLOEXEC); 15 __syscall(SYS_fcntl, fd[0], F_SETFD, FD_CLOEXEC);
16 __syscall(SYS_fcntl, fd[1], F_SETFD, FD_CLOEXEC); 16 __syscall(SYS_fcntl, fd[1], F_SETFD, FD_CLOEXEC);
17 } 17 }
18 if (type & SOCK_NONBLOCK) { 18 if (type & SOCK_NONBLOCK) {
19 __syscall(SYS_fcntl, fd[0], F_SETFL, O_NONBLOCK); 19 __syscall(SYS_fcntl, fd[0], F_SETFL, O_NONBLOCK);
20 __syscall(SYS_fcntl, fd[1], F_SETFL, O_NONBLOCK); 20 __syscall(SYS_fcntl, fd[1], F_SETFL, O_NONBLOCK);
21 } 21 }
22 } 22 }
23 return r; 23 return r;
24 } 24 }
OLDNEW
« no previous file with comments | « fusl/src/network/socket.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698