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

Side by Side Diff: fusl/src/network/sendmsg.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/recvmsg.c ('k') | fusl/src/network/sendto.c » ('j') | 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 <limits.h> 2 #include <limits.h>
3 #include <string.h> 3 #include <string.h>
4 #include <errno.h> 4 #include <errno.h>
5 #include "syscall.h" 5 #include "syscall.h"
6 #include "libc.h" 6 #include "libc.h"
7 7
8 ssize_t sendmsg(int fd, const struct msghdr* msg, int flags) { 8 ssize_t sendmsg(int fd, const struct msghdr* msg, int flags) {
9 #if LONG_MAX > INT_MAX 9 #if LONG_MAX > INT_MAX
10 struct msghdr h; 10 struct msghdr h;
11 struct cmsghdr chbuf[1024 / sizeof(struct cmsghdr) + 1], *c; 11 struct cmsghdr chbuf[1024 / sizeof(struct cmsghdr) + 1], *c;
12 if (msg) { 12 if (msg) {
13 h = *msg; 13 h = *msg;
14 h.__pad1 = h.__pad2 = 0; 14 h.__pad1 = h.__pad2 = 0;
15 msg = &h; 15 msg = &h;
16 if (h.msg_controllen) { 16 if (h.msg_controllen) {
17 if (h.msg_controllen > 1024) { 17 if (h.msg_controllen > 1024) {
18 errno = ENOMEM; 18 errno = ENOMEM;
19 return -1; 19 return -1;
20 } 20 }
21 memcpy(chbuf, h.msg_control, h.msg_controllen); 21 memcpy(chbuf, h.msg_control, h.msg_controllen);
22 h.msg_control = chbuf; 22 h.msg_control = chbuf;
23 for (c = CMSG_FIRSTHDR(&h); c; c = CMSG_NXTHDR(&h, c)) 23 for (c = CMSG_FIRSTHDR(&h); c; c = CMSG_NXTHDR(&h, c))
24 c->__pad1 = 0; 24 c->__pad1 = 0;
25 } 25 }
26 } 26 }
27 #endif 27 #endif
28 return socketcall_cp(sendmsg, fd, msg, flags, 0, 0, 0); 28 return syscall_cp(SYS_sendmsg, fd, msg, flags, 0, 0, 0);
29 } 29 }
OLDNEW
« no previous file with comments | « fusl/src/network/recvmsg.c ('k') | fusl/src/network/sendto.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698