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

Side by Side Diff: sysdeps/nacl/sysdep.h

Issue 9969049: added several system call hooks for future sockets implementation (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: added more syscalls, getcwd and other calls got tested in my app Created 8 years, 8 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
« no previous file with comments | « sysdeps/nacl/irt_syscalls.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 flags) 241 INTERNAL_SYSCALL_epoll_create_1 (int *err, int flags)
242 { 242 {
243 *err = (38 /* ENOSYS */); 243 // here flags is size
244 *err = __nacl_irt_epoll_create (flags);
244 return 0; 245 return 0;
245 } 246 }
246 247
247 __extern_always_inline int 248 __extern_always_inline int
248 INTERNAL_SYSCALL_epoll_create1_1 (int *err, int flags) 249 INTERNAL_SYSCALL_epoll_create1_1 (int *err, int flags)
249 { 250 {
250 *err = (38 /* ENOSYS */); 251 *err = __nacl_irt_epoll_create1 (flags);
251 return 0; 252 return 0;
252 } 253 }
253 254
254 __extern_always_inline int 255 __extern_always_inline int
255 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd, 256 INTERNAL_SYSCALL_epoll_ctl_4 (int *err, int epfd, int op, int fd,
256 struct epoll_event *event) 257 struct epoll_event *event)
257 { 258 {
258 *err = (38 /* ENOSYS */); 259 *err = __nacl_irt_epoll_ctl (epfd, op, fd, event);
259 return 0; 260 return 0;
260 } 261 }
261 262
262 __extern_always_inline int 263 __extern_always_inline int
263 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events, 264 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events,
264 int maxevents, int timeout, 265 int maxevents, int timeout,
265 const sigset_t *sigmask, size_t sigsetsize) 266 const sigset_t *sigmask, size_t sigsetsize)
266 { 267 {
267 *err = (38 /* ENOSYS */); 268 *err = __nacl_irt_epoll_pwait (epfd, events, maxevents, timeout, sigmask, sigs etsize);
Evgeniy Stepanov 2012/04/09 11:45:13 80 chars
268 return 0; 269 return 0;
269 } 270 }
270 271
271 __extern_always_inline int 272 __extern_always_inline int
272 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[], 273 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[],
273 char *const envp[]) 274 char *const envp[])
274 { 275 {
275 *err = (38 /* ENOSYS */); 276 *err = (38 /* ENOSYS */);
276 return 0; 277 return 0;
277 } 278 }
278 279
279 __extern_always_inline int 280 __extern_always_inline int
280 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events, 281 INTERNAL_SYSCALL_epoll_wait_4 (int *err, int epfd, struct epoll_event *events,
281 int maxevents, int timeout) 282 int maxevents, int timeout)
282 { 283 {
283 *err = (38 /* ENOSYS */); 284 *err = (38 /* ENOSYS */);
285 *err = __nacl_irt_epoll_wait (epfd, events, maxevents, timeout);
284 return 0; 286 return 0;
285 } 287 }
286 288
287 __extern_always_inline int 289 __extern_always_inline int
288 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags) 290 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags)
289 { 291 {
290 *err = (38 /* ENOSYS */); 292 *err = (38 /* ENOSYS */);
291 return 0; 293 return 0;
292 } 294 }
293 295
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root, 1159 INTERNAL_SYSCALL_pivot_root_2 (int *err, const char *new_root,
1158 const char *put_old) 1160 const char *put_old)
1159 { 1161 {
1160 *err = (38 /* ENOSYS */); 1162 *err = (38 /* ENOSYS */);
1161 return 0; 1163 return 0;
1162 } 1164 }
1163 1165
1164 __extern_always_inline int 1166 __extern_always_inline int
1165 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout) 1167 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout)
1166 { 1168 {
1167 *err = (38 /* ENOSYS */); 1169 *err = __nacl_irt_poll (fds, nfds, timeout);
1168 return 0; 1170 return 0;
1169 } 1171 }
1170 1172
1171 __extern_always_inline int 1173 __extern_always_inline int
1172 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds, 1174 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds,
1173 const struct timespec *timeout, 1175 const struct timespec *timeout,
1174 const sigset_t *sigmask, size_t sigsetsize) 1176 const sigset_t *sigmask, size_t sigsetsize)
1175 { 1177 {
1176 *err = (38 /* ENOSYS */); 1178 *err = __nacl_irt_ppoll (fds, nfds, timeout, sigmask, sigsetsize);
1177 return 0; 1179 return 0;
1178 } 1180 }
1179 1181
1180 __extern_always_inline int 1182 __extern_always_inline int
1181 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2, 1183 INTERNAL_SYSCALL_prctl_5 (int *err, int option, unsigned long arg2,
1182 unsigned long arg3, unsigned long arg4, 1184 unsigned long arg3, unsigned long arg4,
1183 unsigned long arg5) 1185 unsigned long arg5)
1184 { 1186 {
1185 *err = (38 /* ENOSYS */); 1187 *err = (38 /* ENOSYS */);
1186 return 0; 1188 return 0;
1187 } 1189 }
1188 1190
1189 __extern_always_inline int 1191 __extern_always_inline int
1190 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds, 1192 INTERNAL_SYSCALL_pselect6_6 (int *err, int nfds, fd_set *readfds,
1191 fd_set *writefds, fd_set *exceptfds, 1193 fd_set *writefds, fd_set *exceptfds,
1192 » » » const struct timespec *timeout, 1194 » » » const struct timeval *timeout,
1193 » » » void *sigmask) 1195 » » » void *sigmask) // const sigset_t *sigmask?
Evgeniy Stepanov 2012/04/09 11:45:13 There were tabs in the original file?? Please repl
khim 2012/04/09 12:21:12 Hold your horses! This is GLibC, not NaCl. native
1194 { 1196 {
1195 *err = (38 /* ENOSYS */); 1197 *err = __nacl_irt_pselect (nfds, readfds, writefds, exceptfds, timeout, sigmas k);
Evgeniy Stepanov 2012/04/09 11:45:13 80 chars here and below
1196 return 0; 1198 return 0;
1197 } 1199 }
1198 1200
1199 __extern_always_inline long 1201 __extern_always_inline long
1200 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid, 1202 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid,
1201 void *addr, void *data) 1203 void *addr, void *data)
1202 { 1204 {
1203 *err = (38 /* ENOSYS */); 1205 *err = (38 /* ENOSYS */);
1204 return 0; 1206 return 0;
1205 } 1207 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 } 1423 }
1422 1424
1423 #ifdef __i386__ 1425 #ifdef __i386__
1424 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5 1426 #define INTERNAL_SYSCALL_select_5 INTERNAL_SYSCALL__newselect_5
1425 #endif 1427 #endif
1426 __extern_always_inline int 1428 __extern_always_inline int
1427 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds, 1429 INTERNAL_SYSCALL_select_5 (int *err, int nfds, fd_set *readfds,
1428 fd_set *writefds, fd_set *exceptfds, 1430 fd_set *writefds, fd_set *exceptfds,
1429 const struct timeval *timeout) 1431 const struct timeval *timeout)
1430 { 1432 {
1431 *err = (38 /* ENOSYS */); 1433 *err = __nacl_irt_select (nfds, readfds, writefds, exceptfds, timeout);
1432 return 0; 1434 return 0;
1433 } 1435 }
1434 1436
1435 __extern_always_inline int 1437 __extern_always_inline int
1436 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,
1437 #ifdef _SEM_SEMUN_UNDEFINED 1439 #ifdef _SEM_SEMUN_UNDEFINED
1438 int semun) 1440 int semun)
1439 #else 1441 #else
1440 union semun semun) 1442 union semun semun)
1441 #endif 1443 #endif
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 __extern_always_inline int 1645 __extern_always_inline int
1644 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,
1645 size_t sigsetsize) 1647 size_t sigsetsize)
1646 { 1648 {
1647 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0); 1649 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0);
1648 } 1650 }
1649 1651
1650 __extern_always_inline int 1652 __extern_always_inline int
1651 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)
1652 { 1654 {
1653 *err = (38 /* ENOSYS */); 1655 *err = __nacl_irt_socket (domain, type, protocol);
1654 return 0; 1656 return 0;
1655 } 1657 }
1656 1658
1659 __extern_always_inline int
1660 INTERNAL_SYSCALL_accept_3 (int *err, int sockfd, struct sockaddr* addr, socklen_ t* addr_len)
1661 {
1662 *err = __nacl_irt_accept (sockfd, addr, addr_len);
1663 return 0;
1664 }
1665
1666 __extern_always_inline int
1667 INTERNAL_SYSCALL_bind_3 (int *err, int sockfd, struct sockaddr* addr, socklen_t addr_len)
1668 {
1669 *err = __nacl_irt_bind (sockfd, addr, addr_len);
1670 return 0;
1671 }
1672
1673 __extern_always_inline int
1674 INTERNAL_SYSCALL_listen_2 (int *err, int sockfd, int backlog)
1675 {
1676 *err = __nacl_irt_listen (sockfd, backlog);
1677 return 0;
1678 }
1679
1680 __extern_always_inline int
1681 INTERNAL_SYSCALL_connect_3 (int *err, int sockfd, struct sockaddr* addr, socklen _t* addr_len)
1682 {
1683 *err = __nacl_irt_connect (sockfd, addr, addr_len);
1684 return 0;
1685 }
1686
1687 __extern_always_inline int
1688 INTERNAL_SYSCALL_send_4 (int *err, int sockfd, const void *buf, size_t len, int flags)
1689 {
1690 *err = __nacl_irt_send (sockfd, buf, len, flags);
1691 return 0;
1692 }
1693
1694 __extern_always_inline int
1695 INTERNAL_SYSCALL_sendto_6 (int *err, int sockfd, const void *buf, size_t len, in t flags,
1696 const struct sockaddr *dest_addr, socklen_t addrlen)
1697 {
1698 *err = __nacl_irt_sendto (sockfd, buf, len, flags, dest_addr, addrlen);
1699 return 0;
1700 }
1701
1702 __extern_always_inline int
1703 INTERNAL_SYSCALL_recv_4 (int *err, int sockfd, void *buf, size_t len, int flags)
1704 {
1705 *err = __nacl_irt_recv (sockfd, buf, len, flags);
1706 return 0;
1707 }
1708
1709 __extern_always_inline int
1710 INTERNAL_SYSCALL_recvfrom_6 (int *err, int sockfd, void *buf, size_t len, int fl ags,
1711 struct sockaddr *dest_addr, socklen_t addrlen)
1712 {
1713 *err = __nacl_irt_recvfrom (sockfd, buf, len, flags, dest_addr, addrlen);
1714 return 0;
1715 }
1716
1657 __extern_always_inline ssize_t 1717 __extern_always_inline ssize_t
1658 INTERNAL_SYSCALL_splice_6 (int *err, int fd_in, loff_t *off_in, int fd_out, 1718 INTERNAL_SYSCALL_splice_6 (int *err, int fd_in, loff_t *off_in, int fd_out,
1659 loff_t *off_out, size_t len, unsigned int flags) 1719 loff_t *off_out, size_t len, unsigned int flags)
1660 { 1720 {
1661 *err = (38 /* ENOSYS */); 1721 *err = (38 /* ENOSYS */);
1662 return 0; 1722 return 0;
1663 } 1723 }
1664 1724
1665 __extern_always_inline int 1725 __extern_always_inline int
1666 INTERNAL_SYSCALL_stime_1 (int *err, time_t *t) 1726 INTERNAL_SYSCALL_stime_1 (int *err, time_t *t)
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 #define PSEUDO_END_ERRVAL(name) \ 2166 #define PSEUDO_END_ERRVAL(name) \
2107 END (name) 2167 END (name)
2108 2168
2109 #undef SYSCALL_ERROR_HANDLER_TLS_STORE 2169 #undef SYSCALL_ERROR_HANDLER_TLS_STORE
2110 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ 2170 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
2111 movl %gs:0, %eax; \ 2171 movl %gs:0, %eax; \
2112 movl src, (%eax,destoff) 2172 movl src, (%eax,destoff)
2113 2173
2114 #endif 2174 #endif
2115 #endif 2175 #endif
OLDNEW
« no previous file with comments | « sysdeps/nacl/irt_syscalls.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698