OLD | NEW |
1 #include <string.h> | 1 #include <string.h> |
2 #include <sys/stat.h> | 2 #include <sys/stat.h> |
3 #include <time.h> | 3 #include <time.h> |
4 #include <nacl_stat.h> | 4 #include <nacl_stat.h> |
5 #include <nacl_syscalls.h> | 5 #include <nacl_syscalls.h> |
6 #define stat nacl_abi_stat | 6 #define stat nacl_abi_stat |
7 #include <irt.h> | 7 #include <irt.h> |
8 #undef stat | 8 #undef stat |
9 #include <irt_syscalls.h> | 9 #include <irt_syscalls.h> |
10 #ifdef IS_IN_rtld | 10 #ifdef IS_IN_rtld |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 static int not_implemented() { | 277 static int not_implemented() { |
278 return (12 /* ENOSYS */); | 278 return (12 /* ENOSYS */); |
279 } | 279 } |
280 | 280 |
281 size_t (*__nacl_irt_query) (const char *interface_ident, | 281 size_t (*__nacl_irt_query) (const char *interface_ident, |
282 void *table, size_t tablesize); | 282 void *table, size_t tablesize); |
283 | 283 |
284 int (*__nacl_irt_mkdir) (const char* pathname, mode_t mode); | 284 int (*__nacl_irt_mkdir) (const char* pathname, mode_t mode); |
285 int (*__nacl_irt_rmdir) (const char* pathname); | 285 int (*__nacl_irt_rmdir) (const char* pathname); |
286 int (*__nacl_irt_chdir) (const char* pathname); | 286 int (*__nacl_irt_chdir) (const char* pathname); |
287 int (*__nacl_irt_getcwd) (char* buf, size_t size, int* ret); | 287 int (*__nacl_irt_getcwd) (char* buf, size_t size, int *len); |
288 | 288 |
289 void (*__nacl_irt_exit) (int status); | 289 void (*__nacl_irt_exit) (int status); |
290 int (*__nacl_irt_gettod) (struct timeval *tv); | 290 int (*__nacl_irt_gettod) (struct timeval *tv); |
291 int (*__nacl_irt_clock) (clock_t *ticks); | 291 int (*__nacl_irt_clock) (clock_t *ticks); |
292 int (*__nacl_irt_nanosleep) (const struct timespec *req, struct timespec *rem); | 292 int (*__nacl_irt_nanosleep) (const struct timespec *req, struct timespec *rem); |
293 int (*__nacl_irt_sched_yield) (void); | 293 int (*__nacl_irt_sched_yield) (void); |
294 int (*__nacl_irt_sysconf) (int name, int *value); | 294 int (*__nacl_irt_sysconf) (int name, int *value); |
295 | 295 |
296 int (*__nacl_irt_open) (const char *pathname, int oflag, mode_t cmode, | 296 int (*__nacl_irt_open) (const char *pathname, int oflag, mode_t cmode, |
297 int *newfd); | 297 int *newfd); |
298 int (*__nacl_irt_close) (int fd); | 298 int (*__nacl_irt_close) (int fd); |
299 int (*__nacl_irt_read) (int fd, void *buf, size_t count, size_t *nread); | 299 int (*__nacl_irt_read) (int fd, void *buf, size_t count, size_t *nread); |
300 int (*__nacl_irt_write) (int fd, const void *buf, size_t count, size_t *nwrote); | 300 int (*__nacl_irt_write) (int fd, const void *buf, size_t count, size_t *nwrote); |
301 int (*__nacl_irt_seek) (int fd, off_t offset, int whence, off_t *new_offset); | 301 int (*__nacl_irt_seek) (int fd, off_t offset, int whence, off_t *new_offset); |
302 int (*__nacl_irt_dup) (int fd, int *newfd); | 302 int (*__nacl_irt_dup) (int fd, int *newfd); |
303 int (*__nacl_irt_dup2) (int fd, int newfd); | 303 int (*__nacl_irt_dup2) (int fd, int newfd); |
304 int (*__nacl_irt_fstat) (int fd, struct nacl_abi_stat *); | 304 int (*__nacl_irt_fstat) (int fd, struct nacl_abi_stat *); |
305 int (*__nacl_irt_stat) (const char *pathname, struct nacl_abi_stat *); | 305 int (*__nacl_irt_stat) (const char *pathname, struct nacl_abi_stat *); |
306 int (*__nacl_irt_getdents) (int fd, struct dirent *, size_t count, | 306 int (*__nacl_irt_getdents) (int fd, struct dirent *, size_t count, |
307 size_t *nread); | 307 size_t *nread); |
308 int (*__nacl_irt_socket) (int domain, int type, int protocol); | 308 int (*__nacl_irt_socket) (int domain, int type, int protocol, int *sd); |
309 int (*__nacl_irt_accept) (int sockfd, struct sockaddr *addr, | 309 int (*__nacl_irt_accept) (int sockfd, struct sockaddr *addr, |
310 socklen_t *addrlen); | 310 socklen_t *addrlen, int *sd); |
311 int (*__nacl_irt_bind) (int sockfd, const struct sockaddr *addr, socklen_t addrl
en); | 311 int (*__nacl_irt_bind) (int sockfd, const struct sockaddr *addr, socklen_t addrl
en); |
312 int (*__nacl_irt_listen) (int sockfd, int backlog); | 312 int (*__nacl_irt_listen) (int sockfd, int backlog); |
313 int (*__nacl_irt_connect) (int sockfd, const struct sockaddr *addr, | 313 int (*__nacl_irt_connect) (int sockfd, const struct sockaddr *addr, |
314 socklen_t addrlen); | 314 socklen_t addrlen); |
315 int (*__nacl_irt_send) (int sockfd, const void *buf, size_t len, int flags, | 315 int (*__nacl_irt_send) (int sockfd, const void *buf, size_t len, int flags, |
316 int* ret); | 316 int *count); |
317 int (*__nacl_irt_sendmsg) (int sockfd, const struct msghdr *msg, int flags, | 317 int (*__nacl_irt_sendmsg) (int sockfd, const struct msghdr *msg, int flags, |
318 int* ret); | 318 int *count); |
319 int (*__nacl_irt_sendto) (int sockfd, const void *buf, size_t len, int flags, | 319 int (*__nacl_irt_sendto) (int sockfd, const void *buf, size_t len, int flags, |
320 const struct sockaddr *dest_addr, socklen_t addrlen, | 320 const struct sockaddr *dest_addr, socklen_t addrlen, |
321 » » » » » » int* ret); | 321 » » » » » » int *count); |
322 int (*__nacl_irt_recv) (int sockfd, void *buf, size_t len, int flags, int* ret); | 322 int (*__nacl_irt_recv) (int sockfd, void *buf, size_t len, int flags, int *count
); |
323 int (*__nacl_irt_recvmsg) (int sockfd, struct msghdr *msg, int flags, int* ret); | 323 int (*__nacl_irt_recvmsg) (int sockfd, struct msghdr *msg, int flags, int *count
); |
324 int (*__nacl_irt_recvfrom) (int sockfd, void *buf, size_t len, int flags, | 324 int (*__nacl_irt_recvfrom) (int sockfd, void *buf, size_t len, int flags, |
325 struct sockaddr *dest_addr, socklen_t* addrlen, int*
ret); | 325 struct sockaddr *dest_addr, socklen_t* addrlen, int
*count); |
326 | 326 |
327 int (*__nacl_irt_epoll_create) (int size); | 327 int (*__nacl_irt_epoll_create) (int size, int *fd); |
| 328 int (*__nacl_irt_epoll_create1) (int flags, int *fd); |
328 int (*__nacl_irt_epoll_ctl) (int epfd, int op, int fd, | 329 int (*__nacl_irt_epoll_ctl) (int epfd, int op, int fd, |
329 struct epoll_event *event); | 330 struct epoll_event *event); |
330 int (*__nacl_irt_epoll_pwait) (int epfd, struct epoll_event *events, | 331 int (*__nacl_irt_epoll_pwait) (int epfd, struct epoll_event *events, |
331 int maxevents, int timeout, | 332 int maxevents, int timeout, const sigset_t *sigmask, size_t sigset_size, |
332 const sigset_t *sigmask, size_t sigset_size); | 333 » int *count); |
333 int (*__nacl_irt_epoll_wait) (int epfd, struct epoll_event *events, | 334 int (*__nacl_irt_epoll_wait) (int epfd, struct epoll_event *events, |
334 int maxevents, int timeout); | 335 int maxevents, int timeout, int *count); |
335 int (*__nacl_irt_poll) (struct pollfd *fds, nfds_t nfds, | 336 int (*__nacl_irt_poll) (struct pollfd *fds, nfds_t nfds, |
336 int timeout); | 337 int timeout, int *count); |
337 int (*__nacl_irt_ppoll) (struct pollfd *fds, nfds_t nfds, | 338 int (*__nacl_irt_ppoll) (struct pollfd *fds, nfds_t nfds, |
338 const struct timespec *timeout, | 339 const struct timespec *timeout, const sigset_t *sigmask, |
339 const sigset_t *sigmask, size_t sigset_size); | 340 » size_t sigset_size, int *count); |
340 int (*__nacl_irt_select) (int nfds, fd_set *readfds, | 341 int (*__nacl_irt_select) (int nfds, fd_set *readfds, |
341 fd_set *writefds, fd_set *exceptfds, | 342 fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, |
342 const struct timeval *timeout); | 343 » int *count); |
343 int (*__nacl_irt_pselect) (int nfds, fd_set *readfds, | 344 int (*__nacl_irt_pselect) (int nfds, fd_set *readfds, |
344 fd_set *writefds, fd_set *exceptfds, | 345 fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, |
345 const struct timeval *timeout, void* sigmask); | 346 » void* sigmask, int *count); |
346 int (*__nacl_irt_getpeername) (int sockfd, struct sockaddr *addr, | 347 int (*__nacl_irt_getpeername) (int sockfd, struct sockaddr *addr, |
347 socklen_t *addrlen); | 348 socklen_t *addrlen); |
348 int (*__nacl_irt_getsockname) (int sockfd, struct sockaddr *addr, | 349 int (*__nacl_irt_getsockname) (int sockfd, struct sockaddr *addr, |
349 socklen_t *addrlen); | 350 socklen_t *addrlen); |
350 int (*__nacl_irt_getsockopt) (int sockfd, int level, int optname, | 351 int (*__nacl_irt_getsockopt) (int sockfd, int level, int optname, |
351 void *optval, socklen_t *optlen); | 352 void *optval, socklen_t *optlen); |
352 int (*__nacl_irt_setsockopt) (int sockfd, int level, int optname, | 353 int (*__nacl_irt_setsockopt) (int sockfd, int level, int optname, |
353 const void *optval, socklen_t optlen); | 354 const void *optval, socklen_t optlen); |
354 int (*__nacl_irt_socketpair) (int domain, int type, int protocol, int sv[2]); | 355 int (*__nacl_irt_socketpair) (int domain, int type, int protocol, int sv[2]); |
355 int (*__nacl_irt_shutdown) (int sockfd, int how); | 356 int (*__nacl_irt_shutdown) (int sockfd, int how); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 604 |
604 if (!__nacl_irt_query) | 605 if (!__nacl_irt_query) |
605 __nacl_irt_query = no_interface; | 606 __nacl_irt_query = no_interface; |
606 | 607 |
607 __nacl_irt_mkdir = not_implemented; | 608 __nacl_irt_mkdir = not_implemented; |
608 __nacl_irt_chdir = not_implemented; | 609 __nacl_irt_chdir = not_implemented; |
609 __nacl_irt_rmdir = not_implemented; | 610 __nacl_irt_rmdir = not_implemented; |
610 __nacl_irt_getcwd = not_implemented; | 611 __nacl_irt_getcwd = not_implemented; |
611 | 612 |
612 __nacl_irt_epoll_create = not_implemented; | 613 __nacl_irt_epoll_create = not_implemented; |
| 614 __nacl_irt_epoll_create1 = not_implemented; |
613 __nacl_irt_epoll_ctl = not_implemented; | 615 __nacl_irt_epoll_ctl = not_implemented; |
614 __nacl_irt_epoll_pwait = not_implemented; | 616 __nacl_irt_epoll_pwait = not_implemented; |
615 __nacl_irt_epoll_wait = not_implemented; | 617 __nacl_irt_epoll_wait = not_implemented; |
616 __nacl_irt_poll = not_implemented; | 618 __nacl_irt_poll = not_implemented; |
617 __nacl_irt_ppoll = not_implemented; | 619 __nacl_irt_ppoll = not_implemented; |
618 __nacl_irt_socket = not_implemented; | 620 __nacl_irt_socket = not_implemented; |
619 __nacl_irt_accept = not_implemented; | 621 __nacl_irt_accept = not_implemented; |
620 __nacl_irt_bind = not_implemented; | 622 __nacl_irt_bind = not_implemented; |
621 __nacl_irt_listen = not_implemented; | 623 __nacl_irt_listen = not_implemented; |
622 __nacl_irt_connect = not_implemented; | 624 __nacl_irt_connect = not_implemented; |
(...skipping 10 matching lines...) Expand all Loading... |
633 __nacl_irt_getsockopt = not_implemented; | 635 __nacl_irt_getsockopt = not_implemented; |
634 __nacl_irt_setsockopt = not_implemented; | 636 __nacl_irt_setsockopt = not_implemented; |
635 __nacl_irt_socketpair = not_implemented; | 637 __nacl_irt_socketpair = not_implemented; |
636 __nacl_irt_shutdown = not_implemented; | 638 __nacl_irt_shutdown = not_implemented; |
637 } | 639 } |
638 | 640 |
639 size_t nacl_interface_query(const char *interface_ident, | 641 size_t nacl_interface_query(const char *interface_ident, |
640 void *table, size_t tablesize) { | 642 void *table, size_t tablesize) { |
641 return (*__nacl_irt_query)(interface_ident, table, tablesize); | 643 return (*__nacl_irt_query)(interface_ident, table, tablesize); |
642 } | 644 } |
OLD | NEW |