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

Side by Side Diff: libraries/nacl-mounts/base/Entry.cc

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 #include <errno.h> 6 #include <errno.h>
7 #include <irt.h> 7 #include <irt.h>
8 #ifdef __GLIBC__ 8 #ifdef __GLIBC__
9 #include <irt_syscalls.h> 9 #include <irt_syscalls.h>
10 #endif 10 #endif
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 int symlink(const char *path1, const char *path2) { 164 int symlink(const char *path1, const char *path2) {
165 return kp->symlink(path1, path2); 165 return kp->symlink(path1, path2);
166 } 166 }
167 167
168 int kill(pid_t pid, int sig) { 168 int kill(pid_t pid, int sig) {
169 return kp->kill(pid, sig); 169 return kp->kill(pid, sig);
170 } 170 }
171 171
172 #if __GLIBC__
173 struct hostent* gethostbyname(const char* name) {
174 return kp->gethostbyname(name);
175 }
176 #endif
177
172 int unlink(const char *path) { 178 int unlink(const char *path) {
173 return kp->unlink(path); 179 return kp->unlink(path);
174 } 180 }
175 181
176 ssize_t __real_read(int fd, void *buf, size_t count) { 182 ssize_t __real_read(int fd, void *buf, size_t count) {
177 if (REAL(read)) { 183 if (REAL(read)) {
178 size_t nread; 184 size_t nread;
179 int error = REAL(read)(fd, buf, count, &nread); 185 int error = REAL(read)(fd, buf, count, &nread);
180 if (error) { 186 if (error) {
181 errno = error; 187 errno = error;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 struct sockaddr *src_addr, socklen_t *addrlen, int* ret) { 403 struct sockaddr *src_addr, socklen_t *addrlen, int* ret) {
398 *ret = kp->recvfrom(sockfd, buf, len, flags, src_addr, addrlen); 404 *ret = kp->recvfrom(sockfd, buf, len, flags, src_addr, addrlen);
399 return (*ret < 0) ? errno : 0; 405 return (*ret < 0) ? errno : 0;
400 } 406 }
401 407
402 int WRAP(recvmsg) (int sockfd, struct msghdr *msg, int flags, int* ret) { 408 int WRAP(recvmsg) (int sockfd, struct msghdr *msg, int flags, int* ret) {
403 *ret = kp->recvmsg(sockfd, msg, flags); 409 *ret = kp->recvmsg(sockfd, msg, flags);
404 return (*ret < 0) ? errno : 0; 410 return (*ret < 0) ? errno : 0;
405 } 411 }
406 412
413 struct hostent* WRAP(gethostbyname) (const char* name) {
414 return kp->gethostbyname(name);
415 }
416
417
407 int WRAP(getsockname) (int sockfd, struct sockaddr* addr, 418 int WRAP(getsockname) (int sockfd, struct sockaddr* addr,
408 socklen_t* addrlen) { 419 socklen_t* addrlen) {
409 return (kp->getsockname(sockfd, addr, addrlen)) < 0 ? errno : 0; 420 return (kp->getsockname(sockfd, addr, addrlen)) < 0 ? errno : 0;
410 } 421 }
411 422
412 int WRAP(getpeername) (int sockfd, struct sockaddr* addr, 423 int WRAP(getpeername) (int sockfd, struct sockaddr* addr,
413 socklen_t* addrlen) { 424 socklen_t* addrlen) {
414 return (kp->getpeername(sockfd, addr, addrlen) < 0) ? errno : 0; 425 return (kp->getpeername(sockfd, addr, addrlen) < 0) ? errno : 0;
415 } 426 }
416 427
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return 0; 579 return 0;
569 } 580 }
570 581
571 void (*signal(int sig, void (*func)(int)))(int) { 582 void (*signal(int sig, void (*func)(int)))(int) {
572 return reinterpret_cast<void(*)(int)>(-1); 583 return reinterpret_cast<void(*)(int)>(-1);
573 } 584 }
574 585
575 }; 586 };
576 587
577 #endif // !__GLIBC__ 588 #endif // !__GLIBC__
OLDNEW
« no previous file with comments | « no previous file | libraries/nacl-mounts/base/KernelProxy.h » ('j') | libraries/nacl-mounts/base/KernelProxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698