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 |
| 249 INTERNAL_SYSCALL_epoll_create1_1 (int *err, int flags) |
| 250 { |
| 251 int fd; |
| 252 *err = __nacl_irt_epoll_create1 (flags, &fd); |
| 253 return fd; |
| 254 } |
| 255 |
| 256 __extern_always_inline int |
248 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd, | 257 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd, |
249 struct epoll_event *event) | 258 struct epoll_event *event) |
250 { | 259 { |
251 *err = __nacl_irt_epoll_ctl (epfd, op, fd, event); | 260 *err = __nacl_irt_epoll_ctl (epfd, op, fd, event); |
252 return 0; | 261 return 0; |
253 } | 262 } |
254 | 263 |
255 __extern_always_inline int | 264 __extern_always_inline int |
256 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events, | 265 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events, |
257 int maxevents, int timeout, | 266 int maxevents, int timeout, |
258 const sigset_t *sigmask, size_t sigset_size) | 267 const sigset_t *sigmask, size_t sigset_size) |
259 { | 268 { |
| 269 int count; |
260 *err = __nacl_irt_epoll_pwait (epfd, events, maxevents, timeout, sigmask, | 270 *err = __nacl_irt_epoll_pwait (epfd, events, maxevents, timeout, sigmask, |
261 sigset_size); | 271 sigset_size, &count); |
262 return 0; | 272 return count; |
263 } | 273 } |
264 | 274 |
265 __extern_always_inline int | 275 __extern_always_inline int |
266 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[], | 276 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[], |
267 char *const envp[]) | 277 char *const envp[]) |
268 { | 278 { |
269 *err = (38 /* ENOSYS */); | 279 *err = (38 /* ENOSYS */); |
270 return 0; | 280 return 0; |
271 } | 281 } |
272 | 282 |
273 __extern_always_inline int | 283 __extern_always_inline int |
274 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events, | 284 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events, |
275 int maxevents, int timeout) | 285 int maxevents, int timeout) |
276 { | 286 { |
277 *err = (38 /* ENOSYS */); | 287 int count; |
278 *err = __nacl_irt_epoll_wait (epfd, events, maxevents, timeout); | 288 *err = __nacl_irt_epoll_wait (epfd, events, maxevents, timeout, &count); |
279 return 0; | 289 return count; |
280 } | 290 } |
281 | 291 |
282 __extern_always_inline int | 292 __extern_always_inline int |
283 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags) | 293 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags) |
284 { | 294 { |
285 *err = (38 /* ENOSYS */); | 295 *err = (38 /* ENOSYS */); |
286 return 0; | 296 return 0; |
287 } | 297 } |
288 | 298 |
289 __extern_always_inline int | 299 __extern_always_inline int |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return 0; | 586 return 0; |
577 } | 587 } |
578 | 588 |
579 /* NOTE! The user-level library version returns a character pointer. | 589 /* NOTE! The user-level library version returns a character pointer. |
580 | 590 |
581 The system call just returns the length of the buffer filled (which includes | 591 The system call just returns the length of the buffer filled (which includes |
582 the ending '\0' character), or zero in case of error. */ | 592 the ending '\0' character), or zero in case of error. */ |
583 __extern_always_inline int | 593 __extern_always_inline int |
584 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size) | 594 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size) |
585 { | 595 { |
586 int ret; | 596 int len; |
587 *err = __nacl_irt_getcwd (buf, size, &ret); | 597 *err = __nacl_irt_getcwd (buf, size, &len); |
588 return ret; | 598 return len; |
589 } | 599 } |
590 | 600 |
591 __extern_always_inline gid_t | 601 __extern_always_inline gid_t |
592 INTERNAL_SYSCALL_getegid_0 (int *err) | 602 INTERNAL_SYSCALL_getegid_0 (int *err) |
593 { | 603 { |
594 *err = (38 /* ENOSYS */); | 604 *err = (38 /* ENOSYS */); |
595 return 0; | 605 return 0; |
596 } | 606 } |
597 | 607 |
598 __extern_always_inline uid_t | 608 __extern_always_inline uid_t |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root, | 1162 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root, |
1153 const char *put_old) | 1163 const char *put_old) |
1154 { | 1164 { |
1155 *err = (38 /* ENOSYS */); | 1165 *err = (38 /* ENOSYS */); |
1156 return 0; | 1166 return 0; |
1157 } | 1167 } |
1158 | 1168 |
1159 __extern_always_inline int | 1169 __extern_always_inline int |
1160 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout) | 1170 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout) |
1161 { | 1171 { |
1162 *err = __nacl_irt_poll (fds, nfds, timeout); | 1172 int count; |
1163 return 0; | 1173 *err = __nacl_irt_poll (fds, nfds, timeout, &count); |
| 1174 return count; |
1164 } | 1175 } |
1165 | 1176 |
1166 __extern_always_inline int | 1177 __extern_always_inline int |
1167 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds, | 1178 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds, |
1168 const struct timespec *timeout, | 1179 const struct timespec *timeout, |
1169 const sigset_t *sigmask, size_t sigset_size) | 1180 const sigset_t *sigmask, size_t sigset_size) |
1170 { | 1181 { |
1171 *err = __nacl_irt_ppoll (fds, nfds, timeout, sigmask, sigset_size); | 1182 int count; |
1172 return 0; | 1183 *err = __nacl_irt_ppoll (fds, nfds, timeout, sigmask, sigset_size, &count); |
| 1184 return count; |
1173 } | 1185 } |
1174 | 1186 |
1175 __extern_always_inline int | 1187 __extern_always_inline int |
1176 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2, | 1188 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2, |
1177 unsigned long arg3, unsigned long arg4, | 1189 unsigned long arg3, unsigned long arg4, |
1178 unsigned long arg5) | 1190 unsigned long arg5) |
1179 { | 1191 { |
1180 *err = (38 /* ENOSYS */); | 1192 *err = (38 /* ENOSYS */); |
1181 return 0; | 1193 return 0; |
1182 } | 1194 } |
1183 | 1195 |
1184 __extern_always_inline int | 1196 __extern_always_inline int |
1185 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds, | 1197 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds, |
1186 fd_set *writefds, fd_set *exceptfds, | 1198 fd_set *writefds, fd_set *exceptfds, |
1187 const struct timeval *timeout, | 1199 const struct timeval *timeout, |
1188 void *sigmask) | 1200 void *sigmask) |
1189 { | 1201 { |
| 1202 int count; |
1190 *err = __nacl_irt_pselect (nfds, readfds, writefds, exceptfds, timeout, | 1203 *err = __nacl_irt_pselect (nfds, readfds, writefds, exceptfds, timeout, |
1191 sigmask); | 1204 sigmask, &count); |
1192 return 0; | 1205 return count; |
1193 } | 1206 } |
1194 | 1207 |
1195 __extern_always_inline long | 1208 __extern_always_inline long |
1196 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid, | 1209 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid, |
1197 void *addr, void *data) | 1210 void *addr, void *data) |
1198 { | 1211 { |
1199 *err = (38 /* ENOSYS */); | 1212 *err = (38 /* ENOSYS */); |
1200 return 0; | 1213 return 0; |
1201 } | 1214 } |
1202 | 1215 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 } | 1430 } |
1418 | 1431 |
1419 #ifdef __i386__ | 1432 #ifdef __i386__ |
1420 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5 | 1433 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5 |
1421 #endif | 1434 #endif |
1422 __extern_always_inline int | 1435 __extern_always_inline int |
1423 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds, | 1436 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds, |
1424 fd_set *writefds, fd_set *exceptfds, | 1437 fd_set *writefds, fd_set *exceptfds, |
1425 const struct timeval *timeout) | 1438 const struct timeval *timeout) |
1426 { | 1439 { |
1427 *err = __nacl_irt_select (nfds, readfds, writefds, exceptfds, timeout); | 1440 int count; |
1428 return 0; | 1441 *err = __nacl_irt_select (nfds, readfds, writefds, exceptfds, timeout, &count)
; |
| 1442 return count; |
1429 } | 1443 } |
1430 | 1444 |
1431 __extern_always_inline int | 1445 __extern_always_inline int |
1432 INTERNAL_SYSCALL_semctl_4 (int *err, int semid, int semnum, int cmd, | 1446 INTERNAL_SYSCALL_semctl_4 (int *err, int semid, int semnum, int cmd, |
1433 #ifdef _SEM_SEMUN_UNDEFINED | 1447 #ifdef _SEM_SEMUN_UNDEFINED |
1434 int semun) | 1448 int semun) |
1435 #else | 1449 #else |
1436 union semun semun) | 1450 union semun semun) |
1437 #endif | 1451 #endif |
1438 { | 1452 { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 __extern_always_inline int | 1653 __extern_always_inline int |
1640 INTERNAL_SYSCALL_signalfd_3 (int *err, int fd, const sigset_t *mask, | 1654 INTERNAL_SYSCALL_signalfd_3 (int *err, int fd, const sigset_t *mask, |
1641 size_t sigsetsize) | 1655 size_t sigsetsize) |
1642 { | 1656 { |
1643 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0); | 1657 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0); |
1644 } | 1658 } |
1645 | 1659 |
1646 __extern_always_inline int | 1660 __extern_always_inline int |
1647 INTERNAL_SYSCALL_socket_3 (int *err, int domain, int type, int protocol) | 1661 INTERNAL_SYSCALL_socket_3 (int *err, int domain, int type, int protocol) |
1648 { | 1662 { |
1649 *err = __nacl_irt_socket (domain, type, protocol); | 1663 int sd; |
1650 return 0; | 1664 *err = __nacl_irt_socket (domain, type, protocol, &sd); |
| 1665 return sd; |
1651 } | 1666 } |
1652 | 1667 |
1653 __extern_always_inline int | 1668 __extern_always_inline int |
1654 INTERNAL_SYSCALL_accept_3 (int *err, int sockfd, struct sockaddr* addr, | 1669 INTERNAL_SYSCALL_accept_3 (int *err, int sockfd, struct sockaddr* addr, |
1655 socklen_t* addr_len) | 1670 socklen_t* addr_len) |
1656 { | 1671 { |
1657 *err = __nacl_irt_accept (sockfd, addr, addr_len); | 1672 int sd; |
1658 return 0; | 1673 *err = __nacl_irt_accept (sockfd, addr, addr_len, &sd); |
| 1674 return sd; |
1659 } | 1675 } |
1660 | 1676 |
1661 __extern_always_inline int | 1677 __extern_always_inline int |
1662 INTERNAL_SYSCALL_bind_3 (int *err, int sockfd, struct sockaddr* addr, | 1678 INTERNAL_SYSCALL_bind_3 (int *err, int sockfd, struct sockaddr* addr, |
1663 socklen_t addr_len) | 1679 socklen_t addr_len) |
1664 { | 1680 { |
1665 *err = __nacl_irt_bind (sockfd, addr, addr_len); | 1681 *err = __nacl_irt_bind (sockfd, addr, addr_len); |
1666 return 0; | 1682 return 0; |
1667 } | 1683 } |
1668 | 1684 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 #define PSEUDO_END_ERRVAL(name) \ | 2247 #define PSEUDO_END_ERRVAL(name) \ |
2232 END (name) | 2248 END (name) |
2233 | 2249 |
2234 #undef SYSCALL_ERROR_HANDLER_TLS_STORE | 2250 #undef SYSCALL_ERROR_HANDLER_TLS_STORE |
2235 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ | 2251 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ |
2236 movl %gs:0, %eax; \ | 2252 movl %gs:0, %eax; \ |
2237 movl src, (%eax,destoff) | 2253 movl src, (%eax,destoff) |
2238 | 2254 |
2239 #endif | 2255 #endif |
2240 #endif | 2256 #endif |
OLD | NEW |