Index: sysdeps/nacl/irt_syscalls.c |
diff --git a/sysdeps/nacl/irt_syscalls.c b/sysdeps/nacl/irt_syscalls.c |
index ac4a9c2d69b552f363bf4e740f48e98006fda33e..635b1f2caf4309ed0819ac075174e705fa50b3a0 100644 |
--- a/sysdeps/nacl/irt_syscalls.c |
+++ b/sysdeps/nacl/irt_syscalls.c |
@@ -162,7 +162,8 @@ static int nacl_irt_dyncode_delete(void *dest, size_t size) { |
return -NACL_SYSCALL(dyncode_delete)(dest, size); |
} |
-static int nacl_irt_thread_create (void *start_user_address, void *stack, |
+static int nacl_irt_thread_create (void (*start_user_address)(void), |
+ void *stack, |
void *thread_ptr) { |
return -NACL_SYSCALL (thread_create) (start_user_address, stack, |
thread_ptr, 0); |
@@ -261,7 +262,7 @@ static int nacl_irt_open_resource (const char *pathname, int *newfd) { |
return __nacl_irt_open (pathname, O_RDONLY, 0, newfd); |
else |
return ___nacl_irt_open_resource (pathname + sizeof (DL_DST_LIB) - 1, |
- newfd); |
+ newfd); |
} |
static int nacl_irt_clock_getres(clockid_t clk_id, |
@@ -284,7 +285,7 @@ static int not_implemented() { |
} |
size_t (*__nacl_irt_query) (const char *interface_ident, |
- void *table, size_t tablesize); |
+ void *table, size_t tablesize); |
int (*__nacl_irt_mkdir) (const char* pathname, mode_t mode); |
int (*__nacl_irt_rmdir) (const char* pathname); |
@@ -299,21 +300,23 @@ int (*__nacl_irt_sched_yield) (void); |
int (*__nacl_irt_sysconf) (int name, int *value); |
int (*__nacl_irt_open) (const char *pathname, int oflag, mode_t cmode, |
- int *newfd); |
+ int *newfd); |
int (*__nacl_irt_close) (int fd); |
int (*__nacl_irt_read) (int fd, void *buf, size_t count, size_t *nread); |
-int (*__nacl_irt_write) (int fd, const void *buf, size_t count, size_t *nwrote); |
+int (*__nacl_irt_write) (int fd, const void *buf, size_t count, |
+ size_t *nwrote); |
int (*__nacl_irt_seek) (int fd, off_t offset, int whence, off_t *new_offset); |
int (*__nacl_irt_dup) (int fd, int *newfd); |
int (*__nacl_irt_dup2) (int fd, int newfd); |
int (*__nacl_irt_fstat) (int fd, struct nacl_abi_stat *); |
int (*__nacl_irt_stat) (const char *pathname, struct nacl_abi_stat *); |
int (*__nacl_irt_getdents) (int fd, struct dirent *, size_t count, |
- size_t *nread); |
+ size_t *nread); |
int (*__nacl_irt_socket) (int domain, int type, int protocol, int *sd); |
int (*__nacl_irt_accept) (int sockfd, struct sockaddr *addr, |
socklen_t *addrlen, int *sd); |
-int (*__nacl_irt_bind) (int sockfd, const struct sockaddr *addr, socklen_t addrlen); |
+int (*__nacl_irt_bind) (int sockfd, const struct sockaddr *addr, |
+ socklen_t addrlen); |
int (*__nacl_irt_listen) (int sockfd, int backlog); |
int (*__nacl_irt_connect) (int sockfd, const struct sockaddr *addr, |
socklen_t addrlen); |
@@ -323,47 +326,54 @@ int (*__nacl_irt_sendmsg) (int sockfd, const struct msghdr *msg, int flags, |
int *count); |
int (*__nacl_irt_sendto) (int sockfd, const void *buf, size_t len, int flags, |
const struct sockaddr *dest_addr, socklen_t addrlen, |
- int *count); |
-int (*__nacl_irt_recv) (int sockfd, void *buf, size_t len, int flags, int *count); |
-int (*__nacl_irt_recvmsg) (int sockfd, struct msghdr *msg, int flags, int *count); |
+ int *count); |
+int (*__nacl_irt_recv) (int sockfd, void *buf, size_t len, int flags, |
+ int *count); |
+int (*__nacl_irt_recvmsg) (int sockfd, struct msghdr *msg, int flags, |
+ int *count); |
int (*__nacl_irt_recvfrom) (int sockfd, void *buf, size_t len, int flags, |
- struct sockaddr *dest_addr, socklen_t* addrlen, int *count); |
+ struct sockaddr *dest_addr, socklen_t* addrlen, |
+ int *count); |
int (*__nacl_irt_epoll_create) (int size, int *fd); |
int (*__nacl_irt_epoll_create1) (int flags, int *fd); |
int (*__nacl_irt_epoll_ctl) (int epfd, int op, int fd, |
struct epoll_event *event); |
int (*__nacl_irt_epoll_pwait) (int epfd, struct epoll_event *events, |
- int maxevents, int timeout, const sigset_t *sigmask, size_t sigset_size, |
- int *count); |
+ int maxevents, int timeout, |
+ const sigset_t *sigmask, size_t sigset_size, |
+ int *count); |
int (*__nacl_irt_epoll_wait) (int epfd, struct epoll_event *events, |
- int maxevents, int timeout, int *count); |
+ int maxevents, int timeout, int *count); |
int (*__nacl_irt_poll) (struct pollfd *fds, nfds_t nfds, |
- int timeout, int *count); |
+ int timeout, int *count); |
int (*__nacl_irt_ppoll) (struct pollfd *fds, nfds_t nfds, |
- const struct timespec *timeout, const sigset_t *sigmask, |
- size_t sigset_size, int *count); |
+ const struct timespec *timeout, |
+ const sigset_t *sigmask, |
+ size_t sigset_size, int *count); |
int (*__nacl_irt_select) (int nfds, fd_set *readfds, |
- fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, |
- int *count); |
+ fd_set *writefds, fd_set *exceptfds, |
+ const struct timeval *timeout, |
+ int *count); |
int (*__nacl_irt_pselect) (int nfds, fd_set *readfds, |
- fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, |
- void* sigmask, int *count); |
+ fd_set *writefds, fd_set *exceptfds, |
+ const struct timeval *timeout, |
+ void* sigmask, int *count); |
int (*__nacl_irt_getpeername) (int sockfd, struct sockaddr *addr, |
socklen_t *addrlen); |
int (*__nacl_irt_getsockname) (int sockfd, struct sockaddr *addr, |
socklen_t *addrlen); |
int (*__nacl_irt_getsockopt) (int sockfd, int level, int optname, |
- void *optval, socklen_t *optlen); |
+ void *optval, socklen_t *optlen); |
int (*__nacl_irt_setsockopt) (int sockfd, int level, int optname, |
- const void *optval, socklen_t optlen); |
+ const void *optval, socklen_t optlen); |
int (*__nacl_irt_socketpair) (int domain, int type, int protocol, int sv[2]); |
int (*__nacl_irt_shutdown) (int sockfd, int how); |
int (*__nacl_irt_sysbrk) (void **newbrk); |
int (*__nacl_irt_mmap) (void **addr, size_t len, int prot, int flags, |
- int fd, off_t off); |
+ int fd, off_t off); |
int (*__nacl_irt_munmap) (void *addr, size_t len); |
int (*__nacl_irt_mprotect) (void *addr, size_t len, int prot); |
@@ -371,8 +381,9 @@ int (*__nacl_irt_dyncode_create) (void *dest, const void *src, size_t size); |
int (*__nacl_irt_dyncode_modify) (void *dest, const void *src, size_t size); |
int (*__nacl_irt_dyncode_delete) (void *dest, size_t size); |
-int (*__nacl_irt_thread_create) (void *start_user_address, void *stack, |
- void *thread_ptr); |
+int (*__nacl_irt_thread_create) (void (*start_user_address)(void), |
+ void *stack, |
+ void *thread_ptr); |
void (*__nacl_irt_thread_exit) (int32_t *stack_flag); |
int (*__nacl_irt_thread_nice) (const int nice); |
@@ -388,7 +399,7 @@ int (*__nacl_irt_cond_signal) (int cond_handle); |
int (*__nacl_irt_cond_broadcast) (int cond_handle); |
int (*__nacl_irt_cond_wait) (int cond_handle, int mutex_handle); |
int (*__nacl_irt_cond_timed_wait_abs) (int cond_handle, int mutex_handle, |
- const struct timespec *abstime); |
+ const struct timespec *abstime); |
int (*__nacl_irt_tls_init) (void *tdb); |
void *(*__nacl_irt_tls_get) (void); |
@@ -443,7 +454,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_BASIC_v0_1, &u.nacl_irt_basic, |
- sizeof(u.nacl_irt_basic)) == sizeof(u.nacl_irt_basic)) |
+ sizeof(u.nacl_irt_basic)) == sizeof(u.nacl_irt_basic)) |
{ |
__nacl_irt_exit = u.nacl_irt_basic.exit; |
__nacl_irt_gettod = u.nacl_irt_basic.gettod; |
@@ -464,7 +475,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_FDIO_v0_1, &u.nacl_irt_fdio, |
- sizeof(u.nacl_irt_fdio)) == sizeof(u.nacl_irt_fdio)) |
+ sizeof(u.nacl_irt_fdio)) == sizeof(u.nacl_irt_fdio)) |
{ |
__nacl_irt_close = u.nacl_irt_fdio.close; |
__nacl_irt_dup = u.nacl_irt_fdio.dup; |
@@ -489,7 +500,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_FILENAME_v0_1, &u.nacl_irt_filename, |
- sizeof(u.nacl_irt_filename)) == sizeof(u.nacl_irt_filename)) |
+ sizeof(u.nacl_irt_filename)) == |
+ sizeof(u.nacl_irt_filename)) |
{ |
__nacl_irt_open = u.nacl_irt_filename.open; |
__nacl_irt_stat = u.nacl_irt_filename.nacl_abi_stat; |
@@ -502,7 +514,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_MEMORY_v0_2, &u.nacl_irt_memory, |
- sizeof(u.nacl_irt_memory)) == sizeof(u.nacl_irt_memory)) |
+ sizeof(u.nacl_irt_memory)) == |
+ sizeof(u.nacl_irt_memory)) |
{ |
__nacl_irt_sysbrk = u.nacl_irt_memory.sysbrk; |
__nacl_irt_mmap = u.nacl_irt_memory.mmap; |
@@ -512,7 +525,7 @@ init_irt_table (void) |
else if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_MEMORY_v0_1, &u.nacl_irt_memory, |
sizeof(struct nacl_irt_memory_v0_1)) == |
- sizeof(struct nacl_irt_memory_v0_1)) |
+ sizeof(struct nacl_irt_memory_v0_1)) |
{ |
__nacl_irt_sysbrk = u.nacl_irt_memory.sysbrk; |
__nacl_irt_mmap = u.nacl_irt_memory.mmap; |
@@ -529,7 +542,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_DYNCODE_v0_1, &u.nacl_irt_dyncode, |
- sizeof(u.nacl_irt_dyncode)) == sizeof(u.nacl_irt_dyncode)) |
+ sizeof(u.nacl_irt_dyncode)) == |
+ sizeof(u.nacl_irt_dyncode)) |
{ |
__nacl_irt_dyncode_create = u.nacl_irt_dyncode.dyncode_create; |
__nacl_irt_dyncode_modify = u.nacl_irt_dyncode.dyncode_modify; |
@@ -544,7 +558,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_THREAD_v0_1, &u.nacl_irt_thread, |
- sizeof(u.nacl_irt_thread)) == sizeof(u.nacl_irt_thread)) |
+ sizeof(u.nacl_irt_thread)) == |
+ sizeof(u.nacl_irt_thread)) |
{ |
__nacl_irt_thread_create = u.nacl_irt_thread.thread_create; |
__nacl_irt_thread_exit = u.nacl_irt_thread.thread_exit; |
@@ -559,7 +574,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_MUTEX_v0_1, &u.nacl_irt_mutex, |
- sizeof(u.nacl_irt_mutex)) == sizeof(u.nacl_irt_mutex)) |
+ sizeof(u.nacl_irt_mutex)) == sizeof(u.nacl_irt_mutex)) |
{ |
__nacl_irt_mutex_create = u.nacl_irt_mutex.mutex_create; |
__nacl_irt_mutex_destroy = u.nacl_irt_mutex.mutex_destroy; |
@@ -578,7 +593,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_COND_v0_1, &u.nacl_irt_cond, |
- sizeof(u.nacl_irt_cond)) == sizeof(u.nacl_irt_cond)) |
+ sizeof(u.nacl_irt_cond)) == sizeof(u.nacl_irt_cond)) |
{ |
__nacl_irt_cond_create = u.nacl_irt_cond.cond_create; |
__nacl_irt_cond_destroy = u.nacl_irt_cond.cond_destroy; |
@@ -599,7 +614,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_TLS_v0_1, &u.nacl_irt_tls, |
- sizeof(u.nacl_irt_tls)) == sizeof(u.nacl_irt_tls)) |
+ sizeof(u.nacl_irt_tls)) == sizeof(u.nacl_irt_tls)) |
{ |
__nacl_irt_tls_init = u.nacl_irt_tls.tls_init; |
__nacl_irt_tls_get = u.nacl_irt_tls.tls_get; |
@@ -612,7 +627,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_RESOURCE_OPEN_v0_1, &u.nacl_irt_resource_open, |
- sizeof(u.nacl_irt_resource_open)) == sizeof(u.nacl_irt_resource_open)) |
+ sizeof(u.nacl_irt_resource_open)) == |
+ sizeof(u.nacl_irt_resource_open)) |
{ |
___nacl_irt_open_resource = u.nacl_irt_resource_open.open_resource; |
__nacl_irt_open_resource = nacl_irt_open_resource; |
@@ -620,11 +636,11 @@ init_irt_table (void) |
if (_dl_argc == 1) |
{ |
static const char *argv[] = |
- { |
- DL_DST_LIB "/runnable-ld.so", |
- DL_DST_LIB "/main.nexe", |
- 0 |
- }; |
+ { |
+ DL_DST_LIB "/runnable-ld.so", |
+ DL_DST_LIB "/main.nexe", |
+ 0 |
+ }; |
_dl_argc = 2; |
_dl_argv = (char **)argv; |
} |
@@ -635,7 +651,7 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_CLOCK_v0_1, &u.nacl_irt_clock, |
- sizeof(u.nacl_irt_clock)) == sizeof(u.nacl_irt_clock)) |
+ sizeof(u.nacl_irt_clock)) == sizeof(u.nacl_irt_clock)) |
{ |
__nacl_irt_clock_getres = u.nacl_irt_clock.clock_getres; |
__nacl_irt_clock_gettime = u.nacl_irt_clock.clock_gettime; |
@@ -648,7 +664,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_DEV_GETPID_v0_1, &u.nacl_irt_dev_getpid, |
- sizeof(u.nacl_irt_dev_getpid)) == sizeof(u.nacl_irt_dev_getpid)) |
+ sizeof(u.nacl_irt_dev_getpid)) == |
+ sizeof(u.nacl_irt_dev_getpid)) |
{ |
__nacl_irt_getpid = u.nacl_irt_dev_getpid.getpid; |
} |
@@ -659,7 +676,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_DEV_FDIO_v0_2, &u.nacl_irt_dev_fdio, |
- sizeof(u.nacl_irt_dev_fdio)) == sizeof(u.nacl_irt_dev_fdio)) |
+ sizeof(u.nacl_irt_dev_fdio)) == |
+ sizeof(u.nacl_irt_dev_fdio)) |
{ |
__nacl_irt_fchdir = u.nacl_irt_dev_fdio.fchdir; |
__nacl_irt_fchmod = u.nacl_irt_dev_fdio.fchmod; |
@@ -678,7 +696,8 @@ init_irt_table (void) |
if (__nacl_irt_query && |
__nacl_irt_query (NACL_IRT_DEV_FILENAME_v0_3, &u.nacl_irt_dev_filename, |
- sizeof(u.nacl_irt_dev_filename)) == sizeof(u.nacl_irt_dev_filename)) |
+ sizeof(u.nacl_irt_dev_filename)) == |
+ sizeof(u.nacl_irt_dev_filename)) |
{ |
__nacl_irt_mkdir = u.nacl_irt_dev_filename.mkdir; |
__nacl_irt_chdir = u.nacl_irt_dev_filename.chdir; |
@@ -696,8 +715,10 @@ init_irt_table (void) |
__nacl_irt_utimes = u.nacl_irt_dev_filename.utimes; |
} |
else if (__nacl_irt_query && |
- __nacl_irt_query (NACL_IRT_DEV_FILENAME_v0_2, &u.nacl_irt_dev_filename_v0_2, |
- sizeof(u.nacl_irt_dev_filename_v0_2)) == sizeof(u.nacl_irt_dev_filename_v0_2)) |
+ __nacl_irt_query (NACL_IRT_DEV_FILENAME_v0_2, |
+ &u.nacl_irt_dev_filename_v0_2, |
+ sizeof(u.nacl_irt_dev_filename_v0_2)) == |
+ sizeof(u.nacl_irt_dev_filename_v0_2)) |
{ |
__nacl_irt_mkdir = u.nacl_irt_dev_filename_v0_2.mkdir; |
__nacl_irt_chdir = u.nacl_irt_dev_filename_v0_2.chdir; |