OLD | NEW |
1 #ifndef _NACL_SYSDEP_H | 1 #ifndef _NACL_SYSDEP_H |
2 #define _NACL_SYSDEP_H 1 | 2 #define _NACL_SYSDEP_H 1 |
3 | 3 |
4 #if !defined(__ASSEMBLER__) | 4 #if !defined(__ASSEMBLER__) |
5 #include <futex_emulation.h> | 5 #include <futex_emulation.h> |
6 #include <irt_syscalls.h> | 6 #include <irt_syscalls.h> |
7 #include <lowlevellock.h> | 7 #include <lowlevellock.h> |
8 | 8 |
9 /* Implementation of all syscalls for use in platform- and OS- independent code | 9 /* Implementation of all syscalls for use in platform- and OS- independent code |
10 as inline functions. Each function translates the syscall arguments into IRT | 10 as inline functions. Each function translates the syscall arguments into IRT |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 __extern_always_inline int | 233 __extern_always_inline int |
234 INTERNAL_SYSCALL_dup3_3 (int *err, int oldfd, int newfd, int flags) | 234 INTERNAL_SYSCALL_dup3_3 (int *err, int oldfd, int newfd, int flags) |
235 { | 235 { |
236 *err = (38 /* ENOSYS */); | 236 *err = (38 /* ENOSYS */); |
237 return 0; | 237 return 0; |
238 } | 238 } |
239 | 239 |
240 __extern_always_inline int | 240 __extern_always_inline int |
241 INTERNAL_SYSCALL_epoll_create_1 (int *err, int size) | 241 INTERNAL_SYSCALL_epoll_create_1 (int *err, int size) |
242 { | 242 { |
243 *err = __nacl_irt_epoll_create (size); | 243 int fd; |
244 return 0; | 244 *err = __nacl_irt_epoll_create (size, &fd); |
| 245 return fd; |
245 } | 246 } |
246 | 247 |
247 __extern_always_inline int | 248 __extern_always_inline int |
248 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd, | 249 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd, |
249 struct epoll_event *event) | 250 struct epoll_event *event) |
250 { | 251 { |
251 *err = __nacl_irt_epoll_ctl (epfd, op, fd, event); | 252 *err = __nacl_irt_epoll_ctl (epfd, op, fd, event); |
252 return 0; | 253 return 0; |
253 } | 254 } |
254 | 255 |
255 __extern_always_inline int | 256 __extern_always_inline int |
256 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events, | 257 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events, |
257 int maxevents, int timeout, | 258 int maxevents, int timeout, |
258 const sigset_t *sigmask, size_t sigset_size) | 259 const sigset_t *sigmask, size_t sigset_size) |
259 { | 260 { |
| 261 int count; |
260 *err = __nacl_irt_epoll_pwait (epfd, events, maxevents, timeout, sigmask, | 262 *err = __nacl_irt_epoll_pwait (epfd, events, maxevents, timeout, sigmask, |
261 sigset_size); | 263 sigset_size, &count); |
262 return 0; | 264 return count; |
263 } | 265 } |
264 | 266 |
265 __extern_always_inline int | 267 __extern_always_inline int |
266 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[], | 268 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[], |
267 char *const envp[]) | 269 char *const envp[]) |
268 { | 270 { |
269 *err = (38 /* ENOSYS */); | 271 *err = (38 /* ENOSYS */); |
270 return 0; | 272 return 0; |
271 } | 273 } |
272 | 274 |
273 __extern_always_inline int | 275 __extern_always_inline int |
274 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events, | 276 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events, |
275 int maxevents, int timeout) | 277 int maxevents, int timeout) |
276 { | 278 { |
277 *err = (38 /* ENOSYS */); | 279 int count; |
278 *err = __nacl_irt_epoll_wait (epfd, events, maxevents, timeout); | 280 *err = __nacl_irt_epoll_wait (epfd, events, maxevents, timeout, &count); |
279 return 0; | 281 return count; |
280 } | 282 } |
281 | 283 |
282 __extern_always_inline int | 284 __extern_always_inline int |
283 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags) | 285 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags) |
284 { | 286 { |
285 *err = (38 /* ENOSYS */); | 287 *err = (38 /* ENOSYS */); |
286 return 0; | 288 return 0; |
287 } | 289 } |
288 | 290 |
289 __extern_always_inline int | 291 __extern_always_inline int |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root, | 1154 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root, |
1153 const char *put_old) | 1155 const char *put_old) |
1154 { | 1156 { |
1155 *err = (38 /* ENOSYS */); | 1157 *err = (38 /* ENOSYS */); |
1156 return 0; | 1158 return 0; |
1157 } | 1159 } |
1158 | 1160 |
1159 __extern_always_inline int | 1161 __extern_always_inline int |
1160 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout) | 1162 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout) |
1161 { | 1163 { |
1162 *err = __nacl_irt_poll (fds, nfds, timeout); | 1164 int count; |
1163 return 0; | 1165 *err = __nacl_irt_poll (fds, nfds, timeout, &count); |
| 1166 return count; |
1164 } | 1167 } |
1165 | 1168 |
1166 __extern_always_inline int | 1169 __extern_always_inline int |
1167 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds, | 1170 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds, |
1168 const struct timespec *timeout, | 1171 const struct timespec *timeout, |
1169 const sigset_t *sigmask, size_t sigset_size) | 1172 const sigset_t *sigmask, size_t sigset_size) |
1170 { | 1173 { |
1171 *err = __nacl_irt_ppoll (fds, nfds, timeout, sigmask, sigset_size); | 1174 int count; |
1172 return 0; | 1175 *err = __nacl_irt_ppoll (fds, nfds, timeout, sigmask, sigset_size, &count); |
| 1176 return count; |
1173 } | 1177 } |
1174 | 1178 |
1175 __extern_always_inline int | 1179 __extern_always_inline int |
1176 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2, | 1180 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2, |
1177 unsigned long arg3, unsigned long arg4, | 1181 unsigned long arg3, unsigned long arg4, |
1178 unsigned long arg5) | 1182 unsigned long arg5) |
1179 { | 1183 { |
1180 *err = (38 /* ENOSYS */); | 1184 *err = (38 /* ENOSYS */); |
1181 return 0; | 1185 return 0; |
1182 } | 1186 } |
1183 | 1187 |
1184 __extern_always_inline int | 1188 __extern_always_inline int |
1185 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds, | 1189 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds, |
1186 fd_set *writefds, fd_set *exceptfds, | 1190 fd_set *writefds, fd_set *exceptfds, |
1187 const struct timeval *timeout, | 1191 const struct timeval *timeout, |
1188 void *sigmask) | 1192 void *sigmask) |
1189 { | 1193 { |
| 1194 int count; |
1190 *err = __nacl_irt_pselect (nfds, readfds, writefds, exceptfds, timeout, | 1195 *err = __nacl_irt_pselect (nfds, readfds, writefds, exceptfds, timeout, |
1191 sigmask); | 1196 sigmask, &count); |
1192 return 0; | 1197 return count; |
1193 } | 1198 } |
1194 | 1199 |
1195 __extern_always_inline long | 1200 __extern_always_inline long |
1196 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid, | 1201 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid, |
1197 void *addr, void *data) | 1202 void *addr, void *data) |
1198 { | 1203 { |
1199 *err = (38 /* ENOSYS */); | 1204 *err = (38 /* ENOSYS */); |
1200 return 0; | 1205 return 0; |
1201 } | 1206 } |
1202 | 1207 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 } | 1422 } |
1418 | 1423 |
1419 #ifdef __i386__ | 1424 #ifdef __i386__ |
1420 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5 | 1425 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5 |
1421 #endif | 1426 #endif |
1422 __extern_always_inline int | 1427 __extern_always_inline int |
1423 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds, | 1428 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds, |
1424 fd_set *writefds, fd_set *exceptfds, | 1429 fd_set *writefds, fd_set *exceptfds, |
1425 const struct timeval *timeout) | 1430 const struct timeval *timeout) |
1426 { | 1431 { |
1427 *err = __nacl_irt_select (nfds, readfds, writefds, exceptfds, timeout); | 1432 int count; |
1428 return 0; | 1433 *err = __nacl_irt_select (nfds, readfds, writefds, exceptfds, timeout, &count)
; |
| 1434 return count; |
1429 } | 1435 } |
1430 | 1436 |
1431 __extern_always_inline int | 1437 __extern_always_inline int |
1432 INTERNAL_SYSCALL_semctl_4 (int *err, int semid, int semnum, int cmd, | 1438 INTERNAL_SYSCALL_semctl_4 (int *err, int semid, int semnum, int cmd, |
1433 #ifdef _SEM_SEMUN_UNDEFINED | 1439 #ifdef _SEM_SEMUN_UNDEFINED |
1434 int semun) | 1440 int semun) |
1435 #else | 1441 #else |
1436 union semun semun) | 1442 union semun semun) |
1437 #endif | 1443 #endif |
1438 { | 1444 { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 __extern_always_inline int | 1645 __extern_always_inline int |
1640 INTERNAL_SYSCALL_signalfd_3 (int *err, int fd, const sigset_t *mask, | 1646 INTERNAL_SYSCALL_signalfd_3 (int *err, int fd, const sigset_t *mask, |
1641 size_t sigsetsize) | 1647 size_t sigsetsize) |
1642 { | 1648 { |
1643 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0); | 1649 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0); |
1644 } | 1650 } |
1645 | 1651 |
1646 __extern_always_inline int | 1652 __extern_always_inline int |
1647 INTERNAL_SYSCALL_socket_3 (int *err, int domain, int type, int protocol) | 1653 INTERNAL_SYSCALL_socket_3 (int *err, int domain, int type, int protocol) |
1648 { | 1654 { |
1649 *err = __nacl_irt_socket (domain, type, protocol); | 1655 int sd; |
1650 return 0; | 1656 *err = __nacl_irt_socket (domain, type, protocol, &sd); |
| 1657 return sd; |
1651 } | 1658 } |
1652 | 1659 |
1653 __extern_always_inline int | 1660 __extern_always_inline int |
1654 INTERNAL_SYSCALL_accept_3 (int *err, int sockfd, struct sockaddr* addr, | 1661 INTERNAL_SYSCALL_accept_3 (int *err, int sockfd, struct sockaddr* addr, |
1655 socklen_t* addr_len) | 1662 socklen_t* addr_len) |
1656 { | 1663 { |
1657 *err = __nacl_irt_accept (sockfd, addr, addr_len); | 1664 int sd; |
1658 return 0; | 1665 *err = __nacl_irt_accept (sockfd, addr, addr_len, &sd); |
| 1666 return sd; |
1659 } | 1667 } |
1660 | 1668 |
1661 __extern_always_inline int | 1669 __extern_always_inline int |
1662 INTERNAL_SYSCALL_bind_3 (int *err, int sockfd, struct sockaddr* addr, | 1670 INTERNAL_SYSCALL_bind_3 (int *err, int sockfd, struct sockaddr* addr, |
1663 socklen_t addr_len) | 1671 socklen_t addr_len) |
1664 { | 1672 { |
1665 *err = __nacl_irt_bind (sockfd, addr, addr_len); | 1673 *err = __nacl_irt_bind (sockfd, addr, addr_len); |
1666 return 0; | 1674 return 0; |
1667 } | 1675 } |
1668 | 1676 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 #define PSEUDO_END_ERRVAL(name) \ | 2239 #define PSEUDO_END_ERRVAL(name) \ |
2232 END (name) | 2240 END (name) |
2233 | 2241 |
2234 #undef SYSCALL_ERROR_HANDLER_TLS_STORE | 2242 #undef SYSCALL_ERROR_HANDLER_TLS_STORE |
2235 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ | 2243 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ |
2236 movl %gs:0, %eax; \ | 2244 movl %gs:0, %eax; \ |
2237 movl src, (%eax,destoff) | 2245 movl src, (%eax,destoff) |
2238 | 2246 |
2239 #endif | 2247 #endif |
2240 #endif | 2248 #endif |
OLD | NEW |