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

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

Issue 7785030: Replace #define syscalls cancel machinery. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Cosmetic change Created 9 years, 3 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/read.c ('k') | sysdeps/posix/libc_fatal.c » ('j') | 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 <lowlevellock.h> 7 #include <lowlevellock.h>
7 8
8 /* TODO(mseaborn): Don't use these in the NaCl build, or at least 9 /* Implementation of all syscalls for use in platform- and OS- independent code
9 don't hard code the value of ENOSYS. */ 10 as inline functions. Each function translates the syscall arguments into IRT
11 arguments and allows to intercept each call in user code.
12 TODO(khim): implement the interception logic. */
10 13
11 #define INTERNAL_SYSCALL(name, err, nr, args...) \ 14 #define INTERNAL_SYSCALL(name, err, nr, args...) \
12 INTERNAL_SYSCALL_ ## name(err, nr, args) 15 INTERNAL_SYSCALL_ ## name ## _ ## nr (&err , ## args)
13 16
14 #define INTERNAL_SYSCALL_access(err, nr, args...) (-38 /* ENOSYS */) 17 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
15 #define INTERNAL_SYSCALL_chmod(err, nr, args...) (-38 /* ENOSYS */) 18 INTERNAL_SYSCALL_NCS_ ## nr (name, &err , ## args)
16 #define INTERNAL_SYSCALL_chown(err, nr, args...) (-38 /* ENOSYS */) 19
17 #define INTERNAL_SYSCALL_chown32(err, nr, args...) (-38 /* ENOSYS */) 20 __extern_always_inline int
18 #define INTERNAL_SYSCALL_clock_getres(err, nr, args...) (-38 /* ENOSYS */) 21 INTERNAL_SYSCALL_NCS_3 (int syscall_nr, int *err, int id1, int id2, int id3)
19 #define INTERNAL_SYSCALL_clock_gettime(err, nr, args...) (-38 /* ENOSYS */) 22 {
20 #define INTERNAL_SYSCALL_clock_nanosleep(err, nr, args...) (-38 /* ENOSYS */) 23 *err = (38 /* ENOSYS */);
21 #define INTERNAL_SYSCALL_clock_settime(err, nr, args...) (-38 /* ENOSYS */) 24 return 0;
22 #define INTERNAL_SYSCALL_clone(err, nr, args...) (-38 /* ENOSYS */) 25 }
23 #define INTERNAL_SYSCALL_close(err, nr, args...) (-38 /* ENOSYS */) 26
24 #define INTERNAL_SYSCALL_epoll_pwait(err, nr, args...) (-38 /* ENOSYS */) 27 __extern_always_inline int
25 #define INTERNAL_SYSCALL_eventfd(err, nr, args...) (-38 /* ENOSYS */) 28 INTERNAL_SYSCALL_access_2 (int *err, const char *pathname, int mode)
26 #define INTERNAL_SYSCALL_execve(err, nr, args...) (-38 /* ENOSYS */) 29 {
27 #define INTERNAL_SYSCALL_faccessat(err, nr, args...) (-38 /* ENOSYS */) 30 *err = (38 /* ENOSYS */);
28 #define INTERNAL_SYSCALL_fallocate(err, nr, args...) (-38 /* ENOSYS */) 31 return 0;
29 #define INTERNAL_SYSCALL_fadvise64(err, nr, args...) (-38 /* ENOSYS */) 32 }
30 #define INTERNAL_SYSCALL_fchmodat(err, nr, args...) (-38 /* ENOSYS */) 33
31 #define INTERNAL_SYSCALL_fchown(err, nr, args...) (-38 /* ENOSYS */) 34 __extern_always_inline int
32 #define INTERNAL_SYSCALL_fchown32(err, nr, args...) (-38 /* ENOSYS */) 35 INTERNAL_SYSCALL_chmod_2 (int *err, const char *path, mode_t mode)
33 #define INTERNAL_SYSCALL_fchownat(err, nr, args...) (-38 /* ENOSYS */) 36 {
34 #define INTERNAL_SYSCALL_fcntl(err, nr, args...) (-38 /* ENOSYS */) 37 *err = (38 /* ENOSYS */);
35 #define INTERNAL_SYSCALL_fcntl64(err, nr, args...) (-38 /* ENOSYS */) 38 return 0;
36 #define INTERNAL_SYSCALL_fstat(err, nr, args...) (-38 /* ENOSYS */) 39 }
37 #define INTERNAL_SYSCALL_fstat64(err, nr, args...) (-38 /* ENOSYS */) 40
38 #define INTERNAL_SYSCALL_fstatat64(err, nr, args...) (-38 /* ENOSYS */) 41 __extern_always_inline int
39 #define INTERNAL_SYSCALL_fstatfs64(err, nr, args...) (-38 /* ENOSYS */) 42 INTERNAL_SYSCALL_chown_3 (int *err, const char *path,
40 #define INTERNAL_SYSCALL_ftruncate64(err, nr, args...) (-38 /* ENOSYS */) 43 __kernel_uid_t owner, __kernel_gid_t group)
41 #define INTERNAL_SYSCALL_futimesat(err, nr, args...) (-38 /* ENOSYS */) 44 {
42 #define INTERNAL_SYSCALL_getcpu(err, nr, args...) (-38 /* ENOSYS */) 45 *err = (38 /* ENOSYS */);
43 #define INTERNAL_SYSCALL_getcwd(err, nr, args...) (-38 /* ENOSYS */) 46 return 0;
44 #define INTERNAL_SYSCALL_getdents(err, nr, args...) (-38 /* ENOSYS */) 47 }
45 #define INTERNAL_SYSCALL_getdents64(err, nr, args...) (-38 /* ENOSYS */) 48
46 #define INTERNAL_SYSCALL_getegid(err, nr, args...) (-38 /* ENOSYS */) 49 __extern_always_inline int
47 #define INTERNAL_SYSCALL_getegid32(err, nr, args...) (-38 /* ENOSYS */) 50 INTERNAL_SYSCALL_chown32_3 (int *err, const char *path,
48 #define INTERNAL_SYSCALL_geteuid(err, nr, args...) (-38 /* ENOSYS */) 51 uid_t owner, gid_t group)
49 #define INTERNAL_SYSCALL_geteuid32(err, nr, args...) (-38 /* ENOSYS */) 52 {
50 #define INTERNAL_SYSCALL_getgid(err, nr, args...) (-38 /* ENOSYS */) 53 *err = (38 /* ENOSYS */);
51 #define INTERNAL_SYSCALL_getgid32(err, nr, args...) (-38 /* ENOSYS */) 54 return 0;
52 #define INTERNAL_SYSCALL_getgroups(err, nr, args...) (-38 /* ENOSYS */) 55 }
53 #define INTERNAL_SYSCALL_getgroups32(err, nr, args...) (-38 /* ENOSYS */) 56
54 #define INTERNAL_SYSCALL_getpmsg(err, nr, args...) (-38 /* ENOSYS */) 57 __extern_always_inline int
55 #define INTERNAL_SYSCALL_getpriority(err, nr, args...) (-38 /* ENOSYS */) 58 INTERNAL_SYSCALL_clock_getres_2 (int *err, clockid_t clk_id,
56 #define INTERNAL_SYSCALL_getresgid(err, nr, args...) (-38 /* ENOSYS */) 59 struct timespec *res)
57 #define INTERNAL_SYSCALL_getresgid32(err, nr, args...) (-38 /* ENOSYS */) 60 {
58 #define INTERNAL_SYSCALL_getresuid(err, nr, args...) (-38 /* ENOSYS */) 61 *err = (38 /* ENOSYS */);
59 #define INTERNAL_SYSCALL_getresuid32(err, nr, args...) (-38 /* ENOSYS */) 62 return 0;
60 #define INTERNAL_SYSCALL_getrlimit(err, nr, args...) (-38 /* ENOSYS */) 63 }
61 #define INTERNAL_SYSCALL_gettid(err, nr, args...) (-38 /* ENOSYS */) 64
62 #define INTERNAL_SYSCALL_getuid(err, nr, args...) (-38 /* ENOSYS */) 65 __extern_always_inline int
63 #define INTERNAL_SYSCALL_getuid32(err, nr, args...) (-38 /* ENOSYS */) 66 INTERNAL_SYSCALL_clock_gettime_2 (int *err, clockid_t clk_id,
64 #define INTERNAL_SYSCALL_ioctl(err, nr, args...) (-38 /* ENOSYS */) 67 struct timespec *tp)
65 #define INTERNAL_SYSCALL_ipc(err, nr, args...) (-38 /* ENOSYS */) 68 {
66 #define INTERNAL_SYSCALL_kill(err, nr, args...) (-38 /* ENOSYS */) 69 *err = (38 /* ENOSYS */);
67 #define INTERNAL_SYSCALL_lchown(err, nr, args...) (-38 /* ENOSYS */) 70 return 0;
68 #define INTERNAL_SYSCALL_lchown32(err, nr, args...) (-38 /* ENOSYS */) 71 }
69 #define INTERNAL_SYSCALL_link(err, nr, args...) (-38 /* ENOSYS */) 72
70 #define INTERNAL_SYSCALL_linkat(err, nr, args...) (-38 /* ENOSYS */) 73 __extern_always_inline int
71 #define INTERNAL_SYSCALL__llseek(err, nr, args...) (-38 /* ENOSYS */) 74 INTERNAL_SYSCALL_clock_nanosleep_4 (int *err, clockid_t clock_id, int flags,
72 #define INTERNAL_SYSCALL_lstat(err, nr, args...) (-38 /* ENOSYS */) 75 const struct timespec *request,
73 #define INTERNAL_SYSCALL_lstat64(err, nr, args...) (-38 /* ENOSYS */) 76 struct timespec *remain)
74 #define INTERNAL_SYSCALL_madvise(err, nr, args...) (-38 /* ENOSYS */) 77 {
75 #define INTERNAL_SYSCALL_mkdir(err, nr, args...) (-38 /* ENOSYS */) 78 *err = (38 /* ENOSYS */);
76 #define INTERNAL_SYSCALL_mkdirat(err, nr, args...) (-38 /* ENOSYS */) 79 return 0;
77 #define INTERNAL_SYSCALL_mknod(err, nr, args...) (-38 /* ENOSYS */) 80 }
78 #define INTERNAL_SYSCALL_mknodat(err, nr, args...) (-38 /* ENOSYS */) 81
79 #define INTERNAL_SYSCALL_mq_notify(err, nr, args...) (-38 /* ENOSYS */) 82 __extern_always_inline int
80 #define INTERNAL_SYSCALL_mq_open(err, nr, args...) (-38 /* ENOSYS */) 83 INTERNAL_SYSCALL_clock_settime_2 (int *err, clockid_t clk_id,
81 #define INTERNAL_SYSCALL_mq_unlink(err, nr, args...) (-38 /* ENOSYS */) 84 const struct timespec *tp)
82 #define INTERNAL_SYSCALL_munmap(err, nr, args...) (-38 /* ENOSYS */) 85 {
83 #define INTERNAL_SYSCALL_newfstatat(err, nr, args...) (-38 /* ENOSYS */) 86 *err = (38 /* ENOSYS */);
84 #define INTERNAL_SYSCALL_open(err, nr, args...) (-38 /* ENOSYS */) 87 return 0;
85 #define INTERNAL_SYSCALL_openat(err, nr, args...) (-38 /* ENOSYS */) 88 }
86 #define INTERNAL_SYSCALL_poll(err, nr, args...) (-38 /* ENOSYS */) 89
87 #define INTERNAL_SYSCALL_ppoll(err, nr, args...) (-38 /* ENOSYS */) 90 __extern_always_inline int
88 #define INTERNAL_SYSCALL_pread(err, nr, args...) (-38 /* ENOSYS */) 91 INTERNAL_SYSCALL_close_1 (int *err, unsigned int fd)
89 #define INTERNAL_SYSCALL_ptrace(err, nr, args...) (-38 /* ENOSYS */) 92 {
90 #define INTERNAL_SYSCALL_putpmsg(err, nr, args...) (-38 /* ENOSYS */) 93 *err = __nacl_irt_close(fd);
91 #define INTERNAL_SYSCALL_pwrite(err, nr, args...) (-38 /* ENOSYS */) 94 return 0;
92 #define INTERNAL_SYSCALL_pselect6(err, nr, args...) (-38 /* ENOSYS */) 95 }
93 #define INTERNAL_SYSCALL_readahead(err, nr, args...) (-38 /* ENOSYS */) 96
94 #define INTERNAL_SYSCALL_readlink(err, nr, args...) (-38 /* ENOSYS */) 97 __extern_always_inline int
95 #define INTERNAL_SYSCALL_readlinkat(err, nr, args...) (-38 /* ENOSYS */) 98 INTERNAL_SYSCALL_epoll_pwait_6 (int *err, int epfd, struct epoll_event *events,
96 #define INTERNAL_SYSCALL_readv(err, nr, args...) (-38 /* ENOSYS */) 99 int maxevents, int timeout,
97 #define INTERNAL_SYSCALL_reboot(err, nr, args...) (-38 /* ENOSYS */) 100 const sigset_t *sigmask, size_t sigsetsize)
98 #define INTERNAL_SYSCALL_rename(err, nr, args...) (-38 /* ENOSYS */) 101 {
99 #define INTERNAL_SYSCALL_renameat(err, nr, args...) (-38 /* ENOSYS */) 102 *err = (38 /* ENOSYS */);
100 #define INTERNAL_SYSCALL_rmdir(err, nr, args...) (-38 /* ENOSYS */) 103 return 0;
101 #define INTERNAL_SYSCALL_rt_sigaction(err, nr, args...) (-38 /* ENOSYS */) 104 }
102 #define INTERNAL_SYSCALL_rt_sigpending(err, nr, args...) (-38 /* ENOSYS */) 105
103 #define INTERNAL_SYSCALL_rt_sigprocmask(err, nr, args...) (-38 /* ENOSYS */) 106 __extern_always_inline int
104 #define INTERNAL_SYSCALL_rt_sigqueueinfo(err, nr, args...) (-38 /* ENOSYS */) 107 INTERNAL_SYSCALL_execve_3 (int *err, const char *filename, char *const argv[],
105 #define INTERNAL_SYSCALL_rt_sigsuspend(err, nr, args...) (-38 /* ENOSYS */) 108 char *const envp[])
106 #define INTERNAL_SYSCALL_rt_sigtimedwait(err, nr, args...) (-38 /* ENOSYS */) 109 {
107 #define INTERNAL_SYSCALL_sched_get_priority_max(err, nr, args...) (-38 /* ENOSYS */) 110 *err = (38 /* ENOSYS */);
108 #define INTERNAL_SYSCALL_sched_get_priority_min(err, nr, args...) (-38 /* ENOSYS */) 111 return 0;
109 #define INTERNAL_SYSCALL_sched_getaffinity(err, nr, args...) (-38 /* ENOSYS */) 112 }
110 #define INTERNAL_SYSCALL_sched_getparam(err, nr, args...) (-38 /* ENOSYS */) 113
111 #define INTERNAL_SYSCALL_sched_getscheduler(err, nr, args...) (-38 /* ENOSYS */) 114 __extern_always_inline int
112 #define INTERNAL_SYSCALL_sched_setaffinity(err, nr, args...) (-38 /* ENOSYS */) 115 INTERNAL_SYSCALL_eventfd2_2 (int *err, unsigned int initval, int flags)
113 #define INTERNAL_SYSCALL_sched_setscheduler(err, nr, args...) (-38 /* ENOSYS */) 116 {
114 #define INTERNAL_SYSCALL_set_robust_list(err, nr, args...) (-38 /* ENOSYS */) 117 *err = (38 /* ENOSYS */);
115 #define INTERNAL_SYSCALL_set_tid_address(err, nr, args...) (-38 /* ENOSYS */) 118 return 0;
116 #define INTERNAL_SYSCALL_setfsgid(err, nr, args...) (-38 /* ENOSYS */) 119 }
117 #define INTERNAL_SYSCALL_setfsgid32(err, nr, args...) (-38 /* ENOSYS */) 120
118 #define INTERNAL_SYSCALL_setfsuid(err, nr, args...) (-38 /* ENOSYS */) 121 __extern_always_inline int
119 #define INTERNAL_SYSCALL_setfsuid32(err, nr, args...) (-38 /* ENOSYS */) 122 INTERNAL_SYSCALL_eventfd_1 (int *err, unsigned int initval)
120 #define INTERNAL_SYSCALL_setgid(err, nr, args...) (-38 /* ENOSYS */) 123 {
121 #define INTERNAL_SYSCALL_setgid32(err, nr, args...) (-38 /* ENOSYS */) 124 return INTERNAL_SYSCALL_eventfd2_2(err, initval, 0);
122 #define INTERNAL_SYSCALL_setgroups(err, nr, args...) (-38 /* ENOSYS */) 125 }
123 #define INTERNAL_SYSCALL_setgroups32(err, nr, args...) (-38 /* ENOSYS */) 126
124 #define INTERNAL_SYSCALL_setregid(err, nr, args...) (-38 /* ENOSYS */) 127 __extern_always_inline int
125 #define INTERNAL_SYSCALL_setregid32(err, nr, args...) (-38 /* ENOSYS */) 128 INTERNAL_SYSCALL_faccessat_3 (int *err, int dirfd, const char *pathname,
126 #define INTERNAL_SYSCALL_setresgid(err, nr, args...) (-38 /* ENOSYS */) 129 int mode)
127 #define INTERNAL_SYSCALL_setresgid32(err, nr, args...) (-38 /* ENOSYS */) 130 {
128 #define INTERNAL_SYSCALL_setresuid(err, nr, args...) (-38 /* ENOSYS */) 131 *err = (38 /* ENOSYS */);
129 #define INTERNAL_SYSCALL_setresuid32(err, nr, args...) (-38 /* ENOSYS */) 132 return 0;
130 #define INTERNAL_SYSCALL_setreuid(err, nr, args...) (-38 /* ENOSYS */) 133 }
131 #define INTERNAL_SYSCALL_setreuid32(err, nr, args...) (-38 /* ENOSYS */) 134
132 #define INTERNAL_SYSCALL_setrlimit(err, nr, args...) (-38 /* ENOSYS */) 135 __extern_always_inline int
133 #define INTERNAL_SYSCALL_setuid(err, nr, args...) (-38 /* ENOSYS */) 136 INTERNAL_SYSCALL_fchmod_2 (int *err, int fd, mode_t mode)
134 #define INTERNAL_SYSCALL_setuid32(err, nr, args...) (-38 /* ENOSYS */) 137 {
135 #define INTERNAL_SYSCALL_signalfd(err, nr, args...) (-38 /* ENOSYS */) 138 *err = (38 /* ENOSYS */);
136 #define INTERNAL_SYSCALL_stat(err, nr, args...) (-38 /* ENOSYS */) 139 return 0;
137 #define INTERNAL_SYSCALL_stat64(err, nr, args...) (-38 /* ENOSYS */) 140 }
138 #define INTERNAL_SYSCALL_statfs64(err, nr, args...) (-38 /* ENOSYS */) 141
139 #define INTERNAL_SYSCALL_symlink(err, nr, args...) (-38 /* ENOSYS */) 142 __extern_always_inline int
140 #define INTERNAL_SYSCALL_symlinkat(err, nr, args...) (-38 /* ENOSYS */) 143 INTERNAL_SYSCALL_fchmodat_3 (int *err, int dirfd, const char *pathname,
141 #define INTERNAL_SYSCALL_sync_file_range(err, nr, args...) (-38 /* ENOSYS */) 144 mode_t mode)
142 #define INTERNAL_SYSCALL__sysctl(err, nr, args...) (-38 /* ENOSYS */) 145 {
143 #define INTERNAL_SYSCALL_tgkill(err, nr, args...) (-38 /* ENOSYS */) 146 *err = (38 /* ENOSYS */);
144 #define INTERNAL_SYSCALL_time(err, nr, args...) (-38 /* ENOSYS */) 147 return 0;
145 #define INTERNAL_SYSCALL_timer_create(err, nr, args...) (-38 /* ENOSYS */) 148 }
146 #define INTERNAL_SYSCALL_timer_delete(err, nr, args...) (-38 /* ENOSYS */) 149
147 #define INTERNAL_SYSCALL_timer_getoverrun(err, nr, args...) (-38 /* ENOSYS */) 150 __extern_always_inline int
148 #define INTERNAL_SYSCALL_timer_gettime(err, nr, args...) (-38 /* ENOSYS */) 151 INTERNAL_SYSCALL_fchown_3 (int *err, int fd,
149 #define INTERNAL_SYSCALL_timer_settime(err, nr, args...) (-38 /* ENOSYS */) 152 __kernel_uid_t owner, __kernel_gid_t group)
150 #define INTERNAL_SYSCALL_times(err, nr, args...) (-38 /* ENOSYS */) 153 {
151 #define INTERNAL_SYSCALL_tkill(err, nr, args...) (-38 /* ENOSYS */) 154 *err = (38 /* ENOSYS */);
152 #define INTERNAL_SYSCALL_truncate64(err, nr, args...) (-38 /* ENOSYS */) 155 return 0;
153 #define INTERNAL_SYSCALL_ugetrlimit(err, nr, args...) (-38 /* ENOSYS */) 156 }
154 #define INTERNAL_SYSCALL_unlink(err, nr, args...) (-38 /* ENOSYS */) 157
155 #define INTERNAL_SYSCALL_unlinkat(err, nr, args...) (-38 /* ENOSYS */) 158 __extern_always_inline int
156 #define INTERNAL_SYSCALL_ustat(err, nr, args...) (-38 /* ENOSYS */) 159 INTERNAL_SYSCALL_fchown32_3 (int *err, int fd,
157 #define INTERNAL_SYSCALL_utime(err, nr, args...) (-38 /* ENOSYS */) 160 uid_t owner, gid_t group)
158 #define INTERNAL_SYSCALL_utimensat(err, nr, args...) (-38 /* ENOSYS */) 161 {
159 #define INTERNAL_SYSCALL_utimes(err, nr, args...) (-38 /* ENOSYS */) 162 *err = (38 /* ENOSYS */);
160 #define INTERNAL_SYSCALL_wait4(err, nr, args...) (-38 /* ENOSYS */) 163 return 0;
161 #define INTERNAL_SYSCALL_waitid(err, nr, args...) (-38 /* ENOSYS */) 164 }
162 #define INTERNAL_SYSCALL_write(err, nr, args...) (-38 /* ENOSYS */) 165
163 #define INTERNAL_SYSCALL_writev(err, nr, args...) (-38 /* ENOSYS */) 166 __extern_always_inline int
164 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) (-38 /* ENOSYS */) 167 INTERNAL_SYSCALL_fchownat_5 (int *err, int dirfd, const char *pathname,
165 #define INTERNAL_SYSCALL_futex(err, nr, args...) \ 168 uid_t owner, gid_t group, int flags)
166 INTERNAL_SYSCALL_futex ## nr(args) 169 {
170 *err = (38 /* ENOSYS */);
171 return 0;
172 }
173
174 __extern_always_inline int
175 INTERNAL_SYSCALL_fcntl_3 (int *err, int fd, int cmd, void *arg)
176 {
177 *err = (38 /* ENOSYS */);
178 return 0;
179 }
180
181 __extern_always_inline int
182 INTERNAL_SYSCALL_fcntl64_3 (int *err, int fd, int cmd,
183 union __attribute__ ((__transparent_union__))
184 {
185 unsigned long long ullarg;
186 long long llarg;
187 unsigned long ularg;
188 long larg;
189 unsigned int uiarg;
190 int iarg;
191 void *parg;
192 } arg)
193 {
194 *err = (38 /* ENOSYS */);
195 return 0;
196 }
167 197
168 __errordecl (__futex_emulation_unknown_operation, 198 __errordecl (__futex_emulation_unknown_operation,
169 "unknown futex operation or argument"); 199 "unknown futex operation or argument");
170 200
171 struct __attribute__ ((__packed__)) decoded_futex_operation 201 struct __attribute__ ((__packed__)) decoded_futex_operation
172 { 202 {
173 unsigned int operation :7; 203 unsigned int operation :7;
174 unsigned int private :1; 204 unsigned int private :1;
175 unsigned int realtime :1; 205 unsigned int realtime :1;
176 unsigned int padding :23; 206 unsigned int padding :23;
177 }; 207 };
178 208
179 union __attribute__ ((__transparent_union__)) encoded_futex_operation 209 union __attribute__ ((__transparent_union__)) encoded_futex_operation
180 { 210 {
181 unsigned int encoded_futex_operation; 211 unsigned int encoded_futex_operation;
182 int const_futex_operation; 212 int const_futex_operation;
183 struct decoded_futex_operation decoded_futex_operation; 213 struct decoded_futex_operation decoded_futex_operation;
184 }; 214 };
185 215
186 __extern_always_inline unsigned int 216 __extern_always_inline void
187 INTERNAL_SYSCALL_futex2 (union __attribute__ ((__transparent_union__)) 217 INTERNAL_SYSCALL_futex_2 (int *err,
188 » » » { 218 » » » union __attribute__ ((__transparent_union__))
189 » » » volatile int *addr; 219 » » » {
190 » » » volatile unsigned int *uaddr; 220 » » » volatile int *addr;
191 » » » } addr, 221 » » » volatile unsigned int *uaddr;
192 » » » union encoded_futex_operation futex_operation) 222 » » » } addr,
223 » » » union encoded_futex_operation futex_operation)
193 { 224 {
194 switch (futex_operation.decoded_futex_operation.operation) 225 switch (futex_operation.decoded_futex_operation.operation)
195 { 226 {
196 case FUTEX_UNLOCK_PI: 227 case FUTEX_UNLOCK_PI:
197 » return (-38 /* ENOSYS */); 228 » *err = (38 /* ENOSYS */);
229 » return;
198 default: 230 default:
199 if (__builtin_constant_p ( 231 if (__builtin_constant_p (
200 futex_operation.decoded_futex_operation.operation)) 232 futex_operation.decoded_futex_operation.operation))
201 __futex_emulation_unknown_operation (); 233 __futex_emulation_unknown_operation ();
234 *err = 0;
202 } 235 }
203 return 0;
204 } 236 }
205 237
206 __extern_always_inline unsigned int 238 __extern_always_inline unsigned int
207 INTERNAL_SYSCALL_futex3 (union __attribute__ ((__transparent_union__)) 239 INTERNAL_SYSCALL_futex_3 (int *err,
208 » » » { 240 » » » union __attribute__ ((__transparent_union__))
209 » » » volatile int *addr; 241 » » » {
210 » » » volatile unsigned int *uaddr; 242 » » » volatile int *addr;
211 » » » } addr, 243 » » » volatile unsigned int *uaddr;
212 » » » union encoded_futex_operation futex_operation, 244 » » » } addr,
213 » » » int val) 245 » » » union encoded_futex_operation futex_operation,
214 { 246 » » » int val)
247 {
248 int count;
215 switch (futex_operation.decoded_futex_operation.operation) 249 switch (futex_operation.decoded_futex_operation.operation)
216 { 250 {
217 case FUTEX_WAKE: 251 case FUTEX_WAKE:
218 » return __nacl_futex_wake (addr.addr, val, __FUTEX_BITSET_MATCH_ANY); 252 » *err = __nacl_futex_wake (addr.addr, val, __FUTEX_BITSET_MATCH_ANY,
253 » » » » &count);
254 » return count;
219 default: 255 default:
220 if (__builtin_constant_p ( 256 if (__builtin_constant_p (
221 futex_operation.decoded_futex_operation.operation)) 257 futex_operation.decoded_futex_operation.operation))
222 __futex_emulation_unknown_operation (); 258 __futex_emulation_unknown_operation ();
259 *err = 0;
223 } 260 }
224 return 0; 261 return 0;
225 } 262 }
226 263
227 __extern_always_inline unsigned int 264 __extern_always_inline unsigned int
228 INTERNAL_SYSCALL_futex4 (union __attribute__ ((__transparent_union__)) 265 INTERNAL_SYSCALL_futex_4 (int *err,
229 » » » { 266 » » » union __attribute__ ((__transparent_union__))
230 » » » volatile int *addr; 267 » » » {
231 » » » volatile unsigned int *uaddr; 268 » » » volatile int *addr;
232 » » » } addr, 269 » » » volatile unsigned int *uaddr;
233 » » » union encoded_futex_operation futex_operation, 270 » » » } addr,
234 » » » int val1, 271 » » » union encoded_futex_operation futex_operation,
235 » » » /* We need to accept 0 here. May be better to 272 » » » int val1,
236 » » » replace 0 with NULL in NPTL code? */ 273 » » » /* We need to accept 0 here. May be better to
237 » » » union __attribute__ ((__transparent_union__)) 274 » » » replace 0 with NULL in NPTL code? */
238 » » » { 275 » » » union __attribute__ ((__transparent_union__))
239 » » » const struct timespec *timeout; 276 » » » {
240 » » » int null_timeout; 277 » » » const struct timespec *timeout;
241 » » » } val2) 278 » » » int null_timeout;
279 » » » } val2)
242 { 280 {
243 switch (futex_operation.decoded_futex_operation.operation) 281 switch (futex_operation.decoded_futex_operation.operation)
244 { 282 {
245 case FUTEX_WAIT: 283 case FUTEX_WAIT:
246 » return __nacl_futex_wait (addr.addr, val1, __FUTEX_BITSET_MATCH_ANY, 284 » *err = __nacl_futex_wait (addr.addr, val1, __FUTEX_BITSET_MATCH_ANY,
247 » » » » val2.timeout); 285 » » » » val2.timeout);
248 /* TODO(khim): handle PI-locks in some less hacky way. */ 286 » return 0;
287 /* TODO(khim): hook up PI-locks to some IRT-handleable functions. */
249 case FUTEX_LOCK_PI: 288 case FUTEX_LOCK_PI:
250 case FUTEX_UNLOCK_PI: 289 case FUTEX_UNLOCK_PI:
251 case FUTEX_TRYLOCK_PI: 290 case FUTEX_TRYLOCK_PI:
252 » return (-38 /* ENOSYS */); 291 » *err = (38 /* ENOSYS */);
292 » return 0;
253 default: 293 default:
254 if (__builtin_constant_p ( 294 if (__builtin_constant_p (
255 futex_operation.decoded_futex_operation.operation)) 295 futex_operation.decoded_futex_operation.operation))
256 __futex_emulation_unknown_operation (); 296 __futex_emulation_unknown_operation ();
297 *err = 0;
257 } 298 }
258 return 0; 299 return 0;
259 } 300 }
301
260 __extern_always_inline unsigned int 302 __extern_always_inline unsigned int
261 INTERNAL_SYSCALL_futex6 (union __attribute__ ((__transparent_union__)) 303 INTERNAL_SYSCALL_futex_6 (int *err,
262 » » » { 304 » » » union __attribute__ ((__transparent_union__))
263 » » » volatile int *addr; 305 » » » {
264 » » » volatile unsigned int *uaddr; 306 » » » volatile int *addr;
265 » » » } addr1, 307 » » » volatile unsigned int *uaddr;
266 » » » union encoded_futex_operation futex_operation, 308 » » » } addr1,
267 » » » int val1, 309 » » » union encoded_futex_operation futex_operation,
268 » » » int val2, 310 » » » int val1,
269 » » » union __attribute__ ((__transparent_union__)) 311 » » » int val2,
270 » » » { 312 » » » union __attribute__ ((__transparent_union__))
271 » » » volatile int *addr; 313 » » » {
272 » » » volatile unsigned int *uaddr; 314 » » » volatile int *addr;
273 » » » } addr2, 315 » » » volatile unsigned int *uaddr;
274 » » » int val3) 316 » » » } addr2,
275 { 317 » » » int val3)
318 {
319 int count;
276 switch (futex_operation.decoded_futex_operation.operation) 320 switch (futex_operation.decoded_futex_operation.operation)
277 { 321 {
278 case FUTEX_WAKE_OP: 322 case FUTEX_WAKE_OP:
279 » return __nacl_futex_wake_op (addr1.addr, addr2.addr, val1, val2, val3); 323 » *err = __nacl_futex_wake_op (addr1.addr, addr2.addr,
324 » » » » val1, val2, val3, &count);
325 » return count;
280 case FUTEX_CMP_REQUEUE: 326 case FUTEX_CMP_REQUEUE:
281 » return __nacl_futex_cmp_requeue (addr1.addr, addr2.addr, 327 » *err = __nacl_futex_cmp_requeue (addr1.addr, addr2.addr,
282 » » » » » val1, val2, val3); 328 » » » » » val1, val2, val3, &count);
329 » return count;
283 default: 330 default:
284 if (__builtin_constant_p ( 331 if (__builtin_constant_p (
285 futex_operation.decoded_futex_operation.operation)) 332 futex_operation.decoded_futex_operation.operation))
286 __futex_emulation_unknown_operation (); 333 __futex_emulation_unknown_operation ();
334 *err = 0;
287 } 335 }
288 return 0; 336 return 0;
289 } 337 }
338
339 __extern_always_inline int
340 INTERNAL_SYSCALL_futimesat_3 (int *err, int dirfd, const char *pathname,
341 const struct timeval times[2])
342 {
343 *err = (38 /* ENOSYS */);
344 return 0;
345 }
346
347 __extern_always_inline int
348 INTERNAL_SYSCALL_getcpu_3 (int *err, unsigned *cpu, unsigned *node,
349 struct getcpu_cache *tcache)
350 {
351 *err = (38 /* ENOSYS */);
352 return 0;
353 }
354
355 /* NOTE! The user-level library version returns a character pointer.
356
357 The system call just returns the length of the buffer filled (which includes
358 the ending '\0' character), or zero in case of error. */
359 __extern_always_inline int
360 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size)
361 {
362 *err = (38 /* ENOSYS */);
363 return 0;
364 }
365
366 __extern_always_inline __kernel_gid_t
367 INTERNAL_SYSCALL_getegid_0 (int *err)
368 {
369 *err = (38 /* ENOSYS */);
370 return 0;
371 }
372
373 __extern_always_inline gid_t
374 INTERNAL_SYSCALL_getegid32_0 (int *err)
375 {
376 *err = (38 /* ENOSYS */);
377 return 0;
378 }
379
380 __extern_always_inline __kernel_uid_t
381 INTERNAL_SYSCALL_geteuid_0 (int *err)
382 {
383 *err = (38 /* ENOSYS */);
384 return 0;
385 }
386
387 __extern_always_inline uid_t
388 INTERNAL_SYSCALL_geteuid32_0 (int *err)
389 {
390 *err = (38 /* ENOSYS */);
391 return 0;
392 }
393
394 __extern_always_inline __kernel_gid_t
395 INTERNAL_SYSCALL_getgid_0 (int *err)
396 {
397 *err = (38 /* ENOSYS */);
398 return 0;
399 }
400
401 __extern_always_inline gid_t
402 INTERNAL_SYSCALL_getgid32_0 (int *err)
403 {
404 *err = (38 /* ENOSYS */);
405 return 0;
406 }
407
408 __extern_always_inline int
409 INTERNAL_SYSCALL_getgroups_2 (int *err, int size, __kernel_gid_t *list)
410 {
411 *err = (38 /* ENOSYS */);
412 return 0;
413 }
414
415 __extern_always_inline int
416 INTERNAL_SYSCALL_getgroups32_2 (int *err, int size, gid_t *list)
417 {
418 *err = (38 /* ENOSYS */);
419 return 0;
420 }
421
422 __extern_always_inline int
423 INTERNAL_SYSCALL_getmsg_4 (int *err, int fildes, const struct strbuf *ctlptr,
424 const struct strbuf *dataptr, int *pflags)
425 {
426 *err = (38 /* ENOSYS */);
427 return 0;
428 }
429
430 __extern_always_inline int
431 INTERNAL_SYSCALL_getpmsg_5 (int *err, int fildes, const struct strbuf *ctlptr,
432 const struct strbuf *dataptr, int *pband, int *pflags )
433 {
434 *err = (38 /* ENOSYS */);
435 return 0;
436 }
437
438 /* The return value of getpriority syscall is biased by this value
439 to avoid returning negative values. */
440 __extern_always_inline int
441 INTERNAL_SYSCALL_getpriority_2 (int *err, int which, int who)
442 {
443 *err = (38 /* ENOSYS */);
444 return 0;
445 }
446
447 __extern_always_inline int
448 INTERNAL_SYSCALL_getresgid_3 (int *err, __kernel_gid_t *rgid,
449 __kernel_gid_t *egid, __kernel_gid_t *sgid)
450 {
451 *err = (38 /* ENOSYS */);
452 return 0;
453 }
454
455 __extern_always_inline int
456 INTERNAL_SYSCALL_getresgid32_3 (int *err, gid_t *rgid, gid_t *egid, gid_t *sgid)
457 {
458 *err = (38 /* ENOSYS */);
459 return 0;
460 }
461
462 __extern_always_inline int
463 INTERNAL_SYSCALL_getresuid_3 (int *err, __kernel_uid_t *ruid,
464 __kernel_uid_t *euid, __kernel_uid_t *suid)
465 {
466 *err = (38 /* ENOSYS */);
467 return 0;
468 }
469
470 __extern_always_inline int
471 INTERNAL_SYSCALL_getresuid32_3 (int *err, uid_t *ruid, uid_t *euid, uid_t *ugid)
472 {
473 *err = (38 /* ENOSYS */);
474 return 0;
475 }
476
477 __extern_always_inline __kernel_uid_t
478 INTERNAL_SYSCALL_getuid_0 (int *err)
479 {
480 *err = (38 /* ENOSYS */);
481 return 0;
482 }
483
484 __extern_always_inline uid_t
485 INTERNAL_SYSCALL_getuid32_0 (int *err)
486 {
487 *err = (38 /* ENOSYS */);
488 return 0;
489 }
490
491 __extern_always_inline uid_t
492 INTERNAL_SYSCALL_open_3 (int *err, const char *pathname, int flags, mode_t mode)
493 {
494 int newfd;
495 *err = __nacl_irt_open (pathname, flags, mode, &newfd);
496 return newfd;
497 }
498
499 __extern_always_inline uid_t
500 INTERNAL_SYSCALL_openat_4 (int *err, int dirfd, const char *pathname,
501 int flags, mode_t mode)
502 {
503 *err = (38 /* ENOSYS */);
504 return 0;
505 }
506
507 __extern_always_inline int
508 INTERNAL_SYSCALL_ioctl_3 (int *err, int d, int request,
509 union __attribute__ ((__transparent_union__))
510 {
511 unsigned long long ullarg;
512 long long llarg;
513 unsigned long ularg;
514 long larg;
515 unsigned int uiarg;
516 int iarg;
517 void *parg;
518 } arg)
519 {
520 *err = (38 /* ENOSYS */);
521 return 0;
522 }
523
524 __extern_always_inline int
525 INTERNAL_SYSCALL_ipc_6 (int *err, unsigned int call, int first, int second,
526 int third, void *ptr, long fifth)
527 {
528 *err = (38 /* ENOSYS */);
529 return 0;
530 }
531
532 __extern_always_inline int
533 INTERNAL_SYSCALL_ipc_5 (int *err, unsigned int call, int first, int second,
534 int third, void *ptr)
535 {
536 return INTERNAL_SYSCALL_ipc_6 (err, call, first, second, third, ptr, 0);
537 return 0;
538 }
539
540 __extern_always_inline int
541 INTERNAL_SYSCALL_kill_2 (int *err, pid_t pid, int sig)
542 {
543 *err = (38 /* ENOSYS */);
544 return 0;
545 }
546
547 __extern_always_inline int
548 INTERNAL_SYSCALL_laccess_2 (int *err, const char *pathname, int mode)
549 {
550 *err = (38 /* ENOSYS */);
551 return 0;
552 }
553
554 __extern_always_inline int
555 INTERNAL_SYSCALL_lchown_3 (int *err, const char *path,
556 __kernel_uid_t owner, __kernel_gid_t group)
557 {
558 *err = (38 /* ENOSYS */);
559 return 0;
560 }
561
562 __extern_always_inline int
563 INTERNAL_SYSCALL_lchown32_3 (int *err, const char *path,
564 uid_t owner, gid_t group)
565 {
566 *err = (38 /* ENOSYS */);
567 return 0;
568 }
569
570 __extern_always_inline int
571 INTERNAL_SYSCALL_link_2 (int *err, const char *oldpath, const char *newpath)
572 {
573 *err = (38 /* ENOSYS */);
574 return 0;
575 }
576
577 __extern_always_inline int
578 INTERNAL_SYSCALL_linkat_5 (int *err, int olddfd, const char *oldname,
579 int newdfd, const char *newname, int flags)
580 {
581 *err = (38 /* ENOSYS */);
582 return 0;
583 }
584
585 __extern_always_inline int
586 INTERNAL_SYSCALL_madvise_3 (int *err, void *addr, size_t length, int advice)
587 {
588 *err = (38 /* ENOSYS */);
589 return 0;
590 }
591
592 __extern_always_inline int
593 INTERNAL_SYSCALL_mkdir_2 (int *err, const char *pathname, mode_t mode)
594 {
595 *err = (38 /* ENOSYS */);
596 return 0;
597 }
598
599 __extern_always_inline int
600 INTERNAL_SYSCALL_mkdirat_3 (int *err, int dirfd, const char *pathname,
601 mode_t mode)
602 {
603 *err = (38 /* ENOSYS */);
604 return 0;
605 }
606
607 __extern_always_inline int
608 INTERNAL_SYSCALL_mknod_3 (int *err, const char *pathname,
609 mode_t mode, dev_t dev)
610 {
611 *err = (38 /* ENOSYS */);
612 return 0;
613 }
614
615 __extern_always_inline int
616 INTERNAL_SYSCALL_mknodat_4 (int *err, int dirfd, const char *pathname,
617 mode_t mode, dev_t dev)
618 {
619 *err = (38 /* ENOSYS */);
620 return 0;
621 }
622
623 struct mq_attr;
624 __extern_always_inline int/*mqd_t*/
625 INTERNAL_SYSCALL_mq_open_4 (int *err, const char *name, int oflag, mode_t mode,
626 struct mq_attr *attr)
627 {
628 *err = (38 /* ENOSYS */);
629 return 0;
630 }
631
632 __extern_always_inline int
633 INTERNAL_SYSCALL_mq_notify_2 (int *err, int/*mqd_t*/ mqdes,
634 const struct sigevent *notification)
635 {
636 *err = (38 /* ENOSYS */);
637 return 0;
638 }
639
640 __extern_always_inline int
641 INTERNAL_SYSCALL_mq_unlink_1 (int *err, const char *name)
642 {
643 *err = (38 /* ENOSYS */);
644 return 0;
645 }
646
647 __extern_always_inline int
648 INTERNAL_SYSCALL_munmap_2 (int *err, void *addr, size_t length)
649 {
650 *err = __nacl_irt_munmap(addr, length);
651 return 0;
652 }
653
654 __extern_always_inline int
655 INTERNAL_SYSCALL_poll_3 (int *err, struct pollfd *fds, nfds_t nfds, int timeout)
656 {
657 *err = (38 /* ENOSYS */);
658 return 0;
659 }
660
661 __extern_always_inline int
662 INTERNAL_SYSCALL_ppoll_5 (int *err, struct pollfd *fds, nfds_t nfds,
663 const struct timespec *timeout,
664 const sigset_t *sigmask, size_t sigsetsize)
665 {
666 *err = (38 /* ENOSYS */);
667 return 0;
668 }
669
670 __extern_always_inline long
671 INTERNAL_SYSCALL_ptrace_4 (int *err, enum __ptrace_request request, pid_t pid,
672 void *addr, void *data)
673 {
674 *err = (38 /* ENOSYS */);
675 return 0;
676 }
677
678 __extern_always_inline int
679 INTERNAL_SYSCALL_putmsg_4 (int *err, int fildes, const struct strbuf *ctlptr,
680 const struct strbuf *dataptr, int flags)
681 {
682 *err = (38 /* ENOSYS */);
683 return 0;
684 }
685
686 __extern_always_inline int
687 INTERNAL_SYSCALL_putpmsg_5 (int *err, int fildes, const struct strbuf *ctlptr,
688 const struct strbuf *dataptr, int band, int flags)
689 {
690 *err = (38 /* ENOSYS */);
691 return 0;
692 }
693
694 __extern_always_inline int
695 INTERNAL_SYSCALL_readahead_4 (int *err, int fd,
696 __LONG_LONG_PAIR(long offset_high,
697 long offset_low), size_t count)
698 {
699 #if 0
700 off64_t offset = ((off64_t)offset_high) << 32 | offset_low;
290 #endif 701 #endif
702 *err = (38 /* ENOSYS */);
703 return 0;
704 }
705
706 __extern_always_inline ssize_t
707 INTERNAL_SYSCALL_readv_3 (int *err, int fd, const
708 struct iovec *iov, int iovcnt)
709 {
710 *err = (38 /* ENOSYS */);
711 return 0;
712 }
713
714 __extern_always_inline ssize_t
715 INTERNAL_SYSCALL_readlink_3 (int *err, const char *path,
716 char *buf, size_t bufsiz)
717 {
718 *err = (38 /* ENOSYS */);
719 return 0;
720 }
721
722 __extern_always_inline ssize_t
723 INTERNAL_SYSCALL_readlinkat_4 (int *err, int dirfd, const char *pathname,
724 char *buf, size_t bufsiz)
725 {
726 *err = (38 /* ENOSYS */);
727 return 0;
728 }
729
730 __extern_always_inline int
731 INTERNAL_SYSCALL_reboot_4 (int *err, int magic1, int magic2, int cmd, void *arg)
732 {
733 *err = (38 /* ENOSYS */);
734 return 0;
735 }
736
737 __extern_always_inline int
738 INTERNAL_SYSCALL_reboot_3 (int *err, int magic1, int magic2, int howto)
739 {
740 return INTERNAL_SYSCALL_reboot_4 (err, magic1, magic2, howto, NULL);
741 }
742
743 __extern_always_inline int
744 INTERNAL_SYSCALL_rename_2 (int *err, const char *oldpath, const char *newpath)
745 {
746 *err = (38 /* ENOSYS */);
747 return 0;
748 }
749
750 __extern_always_inline int
751 INTERNAL_SYSCALL_renameat_4 (int *err, int olddfd, const char *oldname,
752 int newdfd, const char *newname)
753 {
754 *err = (38 /* ENOSYS */);
755 return 0;
756 }
757
758 __extern_always_inline int
759 INTERNAL_SYSCALL_rmdir_1 (int *err, const char *pathname)
760 {
761 *err = (38 /* ENOSYS */);
762 return 0;
763 }
764
765 __extern_always_inline int
766 INTERNAL_SYSCALL_rt_sigpending_2(int *err, sigset_t *set, size_t sigsetsize)
767 {
768 *err = (38 /* ENOSYS */);
769 return 0;
770 }
771
772 __extern_always_inline int
773 INTERNAL_SYSCALL_rt_sigprocmask_4 (int *err, int how, const sigset_t *set,
774 sigset_t *oldset, size_t sigsetsize)
775 {
776 *err = (38 /* ENOSYS */);
777 return 0;
778 }
779
780 __extern_always_inline int
781 INTERNAL_SYSCALL_rt_sigqueueinfo_3 (int *err, pid_t pid, int sig,
782 siginfo_t *info)
783 {
784 *err = (38 /* ENOSYS */);
785 return 0;
786 }
787
788 __extern_always_inline int
789 INTERNAL_SYSCALL_rt_sigsuspend_2 (int *err, const sigset_t *mask,
790 size_t sigsetsize)
791 {
792 *err = (38 /* ENOSYS */);
793 return 0;
794 }
795
796 __extern_always_inline int
797 INTERNAL_SYSCALL_rt_sigtimedwait_4 (int *err, const sigset_t *set,
798 siginfo_t *info,
799 const struct timespec *timeout,
800 size_t sigsetsize)
801 {
802 *err = (38 /* ENOSYS */);
803 return 0;
804 }
805
806 __extern_always_inline int
807 INTERNAL_SYSCALL_sched_getaffinity_3 (int *err, pid_t pid, size_t cpusetsize,
808 cpu_set_t *mask)
809 {
810 *err = (38 /* ENOSYS */);
811 return 0;
812 }
813
814 __extern_always_inline int
815 INTERNAL_SYSCALL_sched_getparam_2 (int *err, pid_t pid,
816 struct sched_param *param)
817 {
818 *err = (38 /* ENOSYS */);
819 return 0;
820 }
821
822 __extern_always_inline int
823 INTERNAL_SYSCALL_sched_get_priority_min_1 (int *err, int policy)
824 {
825 *err = (38 /* ENOSYS */);
826 return 0;
827 }
828
829 __extern_always_inline int
830 INTERNAL_SYSCALL_sched_get_priority_max_1 (int *err, int policy)
831 {
832 *err = (38 /* ENOSYS */);
833 return 0;
834 }
835
836 __extern_always_inline int
837 INTERNAL_SYSCALL_sched_getscheduler_1 (int *err, pid_t pid)
838 {
839 *err = (38 /* ENOSYS */);
840 return 0;
841 }
842
843 __extern_always_inline int
844 INTERNAL_SYSCALL_sched_setaffinity_3 (int *err, pid_t pid, size_t cpusetsize,
845 const cpu_set_t *mask)
846 {
847 *err = (38 /* ENOSYS */);
848 return 0;
849 }
850
851 __extern_always_inline int
852 INTERNAL_SYSCALL_sched_setparam_2 (int *err, pid_t pid,
853 struct sched_param *param)
854 {
855 *err = (38 /* ENOSYS */);
856 return 0;
857 }
858
859 __extern_always_inline int
860 INTERNAL_SYSCALL_sched_setscheduler_3 (int *err, pid_t pid, int policy,
861 const struct sched_param *param)
862 {
863 *err = (38 /* ENOSYS */);
864 return 0;
865 }
866
867 __extern_always_inline int
868 INTERNAL_SYSCALL_setfsgid_1 (int *err, __kernel_gid_t gid)
869 {
870 *err = (38 /* ENOSYS */);
871 return 0;
872 }
873
874 __extern_always_inline int
875 INTERNAL_SYSCALL_setfsgid32_1 (int *err, gid_t gid)
876 {
877 *err = (38 /* ENOSYS */);
878 return 0;
879 }
880
881 __extern_always_inline int
882 INTERNAL_SYSCALL_setfsuid_1 (int *err, __kernel_uid_t uid)
883 {
884 *err = (38 /* ENOSYS */);
885 return 0;
886 }
887
888 __extern_always_inline int
889 INTERNAL_SYSCALL_setfsuid32_1 (int *err, uid_t uid)
890 {
891 *err = (38 /* ENOSYS */);
892 return 0;
893 }
894
895 __extern_always_inline int
896 INTERNAL_SYSCALL_setgid_1 (int *err, __kernel_gid_t gid)
897 {
898 *err = (38 /* ENOSYS */);
899 return 0;
900 }
901
902 __extern_always_inline int
903 INTERNAL_SYSCALL_setgid32_1 (int *err, gid_t gid)
904 {
905 *err = (38 /* ENOSYS */);
906 return 0;
907 }
908
909 __extern_always_inline int
910 INTERNAL_SYSCALL_setgroups_2 (int *err, int size, const __kernel_gid_t *list)
911 {
912 *err = (38 /* ENOSYS */);
913 return 0;
914 }
915
916 __extern_always_inline int
917 INTERNAL_SYSCALL_setgroups32_2 (int *err, int size, const gid_t *list)
918 {
919 *err = (38 /* ENOSYS */);
920 return 0;
921 }
922
923 __extern_always_inline int
924 INTERNAL_SYSCALL_setpriority_3 (int *err, int which, int who, int prio)
925 {
926 *err = (38 /* ENOSYS */);
927 return 0;
928 }
929
930 __extern_always_inline int
931 INTERNAL_SYSCALL_setregid_2 (int *err, __kernel_gid_t rgid, __kernel_gid_t egid)
932 {
933 *err = (38 /* ENOSYS */);
934 return 0;
935 }
936
937 __extern_always_inline int
938 INTERNAL_SYSCALL_setregid32_2 (int *err, gid_t rgid, gid_t egid)
939 {
940 *err = (38 /* ENOSYS */);
941 return 0;
942 }
943
944 __extern_always_inline int
945 INTERNAL_SYSCALL_setresgid_3 (int *err, __kernel_gid_t rgid,
946 __kernel_gid_t egid, __kernel_gid_t sgid)
947 {
948 *err = (38 /* ENOSYS */);
949 return 0;
950 }
951
952 __extern_always_inline int
953 INTERNAL_SYSCALL_setresgid32_3 (int *err, gid_t rgid, gid_t egid, gid_t sgid)
954 {
955 *err = (38 /* ENOSYS */);
956 return 0;
957 }
958
959 __extern_always_inline int
960 INTERNAL_SYSCALL_setresuid_3 (int *err, __kernel_uid_t ruid,
961 __kernel_uid_t euid, __kernel_uid_t suid)
962 {
963 *err = (38 /* ENOSYS */);
964 return 0;
965 }
966
967 __extern_always_inline int
968 INTERNAL_SYSCALL_setresuid32_3 (int *err, uid_t ruid, uid_t euid, uid_t suid)
969 {
970 *err = (38 /* ENOSYS */);
971 return 0;
972 }
973
974 __extern_always_inline int
975 INTERNAL_SYSCALL_setreuid_2 (int *err, __kernel_uid_t ruid, __kernel_uid_t euid)
976 {
977 *err = (38 /* ENOSYS */);
978 return 0;
979 }
980
981 __extern_always_inline int
982 INTERNAL_SYSCALL_setreuid32_2 (int *err, uid_t ruid, uid_t euid)
983 {
984 *err = (38 /* ENOSYS */);
985 return 0;
986 }
987
988 __extern_always_inline int
989 INTERNAL_SYSCALL_set_robust_list_2 (int *err, struct robust_list_head *head,
990 size_t len)
991 {
992 *err = (38 /* ENOSYS */);
993 return 0;
994 }
995
996 __extern_always_inline int
997 INTERNAL_SYSCALL_setuid_1 (int *err, __kernel_uid_t uid)
998 {
999 *err = (38 /* ENOSYS */);
1000 return 0;
1001 }
1002
1003 __extern_always_inline int
1004 INTERNAL_SYSCALL_setuid32_1 (int *err, uid_t uid)
1005 {
1006 *err = (38 /* ENOSYS */);
1007 return 0;
1008 }
1009
1010 __extern_always_inline int
1011 INTERNAL_SYSCALL_signalfd4_4 (int *err, int fd, const sigset_t *mask,
1012 size_t sigsetsize, int flags)
1013 {
1014 *err = (38 /* ENOSYS */);
1015 return 0;
1016 }
1017
1018 __extern_always_inline int
1019 INTERNAL_SYSCALL_signalfd_3 (int *err, int fd, const sigset_t *mask,
1020 size_t sigsetsize)
1021 {
1022 return INTERNAL_SYSCALL_signalfd4_4 (err, fd, mask, sigsetsize, 0);
1023 }
1024
1025 __extern_always_inline int
1026 INTERNAL_SYSCALL_symlink_2 (int *err, const char *oldpath, const char *newpath)
1027 {
1028 *err = (38 /* ENOSYS */);
1029 return 0;
1030 }
1031
1032 __extern_always_inline int
1033 INTERNAL_SYSCALL_symlinkat_3 (int *err, const char *oldpath,
1034 int newdirfd, const char *newpath)
1035 {
1036 *err = (38 /* ENOSYS */);
1037 return 0;
1038 }
1039
1040 __extern_always_inline int
1041 INTERNAL_SYSCALL_sync_file_range_6 (int *err, int fd,
1042 __LONG_LONG_PAIR(long offset_high,
1043 long offset_low),
1044 __LONG_LONG_PAIR(long nbytes_high,
1045 long nbytes_low),
1046 unsigned int flags)
1047 {
1048 #if 0
1049 off64_t offset = ((off64_t)offset_high) << 32 | offset_low;
1050 off64_t nbytes = ((off64_t)nbytes_high) << 32 | nbytes_low;
1051 #endif
1052 *err = (38 /* ENOSYS */);
1053 return 0;
1054 }
1055
1056 __extern_always_inline int
1057 INTERNAL_SYSCALL__sysctl_1 (int *err, struct __sysctl_args *args)
1058 {
1059 *err = (38 /* ENOSYS */);
1060 return 0;
1061 }
1062
1063 __extern_always_inline int
1064 INTERNAL_SYSCALL_tgkill_3 (int *err, gid_t tgid, pid_t tid, int sig)
1065 {
1066 *err = (38 /* ENOSYS */);
1067 return 0;
1068 }
1069
1070 __extern_always_inline int
1071 INTERNAL_SYSCALL_timer_create_3 (int *err, clockid_t clockid,
1072 struct sigevent *evp,
1073 __kernel_timer_t *timerid)
1074 {
1075 *err = (38 /* ENOSYS */);
1076 return 0;
1077 }
1078
1079 __extern_always_inline int
1080 INTERNAL_SYSCALL_timer_delete_1 (int *err, __kernel_timer_t timerid)
1081 {
1082 *err = (38 /* ENOSYS */);
1083 return 0;
1084 }
1085
1086 __extern_always_inline int
1087 INTERNAL_SYSCALL_timer_getoverrun_1 (int *err, __kernel_timer_t timerid)
1088 {
1089 *err = (38 /* ENOSYS */);
1090 return 0;
1091 }
1092
1093 __extern_always_inline int
1094 INTERNAL_SYSCALL_timer_gettime_2 (int *err, __kernel_timer_t timerid,
1095 struct itimerspec *curr_value)
1096 {
1097 *err = (38 /* ENOSYS */);
1098 return 0;
1099 }
1100
1101 __extern_always_inline int
1102 INTERNAL_SYSCALL_timer_settime_4 (int *err, __kernel_timer_t timerid, int flags,
1103 const struct itimerspec *new_value,
1104 struct itimerspec * old_value)
1105 {
1106 *err = (38 /* ENOSYS */);
1107 return 0;
1108 }
1109
1110 __extern_always_inline clock_t
1111 INTERNAL_SYSCALL_times_1 (int *err, struct tms *buf)
1112 {
1113 *err = (38 /* ENOSYS */);
1114 return 0;
1115 }
1116
1117 __extern_always_inline int
1118 INTERNAL_SYSCALL_tkill_2 (int *err, pid_t tid, int sig)
1119 {
1120 *err = (38 /* ENOSYS */);
1121 return 0;
1122 }
1123
1124 __extern_always_inline int
1125 INTERNAL_SYSCALL_unlink_1 (int *err, const char *pathname)
1126 {
1127 *err = (38 /* ENOSYS */);
1128 return 0;
1129 }
1130
1131 __extern_always_inline int
1132 INTERNAL_SYSCALL_unlinkat_3 (int *err, int dirfd, const char *pathname,
1133 int flags)
1134 {
1135 *err = (38 /* ENOSYS */);
1136 return 0;
1137 }
1138
1139 __extern_always_inline int
1140 INTERNAL_SYSCALL_ustat_2 (int *err, dev_t dev, struct ustat *ubuf)
1141 {
1142 *err = (38 /* ENOSYS */);
1143 return 0;
1144 }
1145
1146 __extern_always_inline int
1147 INTERNAL_SYSCALL_utime_2 (int *err, const char *filename,
1148 const struct utimbuf *times)
1149 {
1150 *err = (38 /* ENOSYS */);
1151 return 0;
1152 }
1153
1154 __extern_always_inline int
1155 INTERNAL_SYSCALL_utimes_2 (int *err, const char *filename,
1156 const struct timeval times[2])
1157 {
1158 *err = (38 /* ENOSYS */);
1159 return 0;
1160 }
1161
1162 __extern_always_inline int
1163 INTERNAL_SYSCALL_utimensat_4 (int *err, int dirfd, const char *pathname,
1164 const struct timespec times[2], int flags)
1165 {
1166 *err = (38 /* ENOSYS */);
1167 return 0;
1168 }
1169
1170 __extern_always_inline pid_t
1171 INTERNAL_SYSCALL_wait3_3 (int *err, int *status, int options,
1172 struct rusage *rusage)
1173 {
1174 *err = (38 /* ENOSYS */);
1175 return 0;
1176 }
1177
1178 __extern_always_inline pid_t
1179 INTERNAL_SYSCALL_wait4_4 (int *err, pid_t pid, int *status, int options,
1180 struct rusage *rusage)
1181 {
1182 *err = (38 /* ENOSYS */);
1183 return 0;
1184 }
1185
1186 __extern_always_inline ssize_t
1187 INTERNAL_SYSCALL_write_3 (int *err, int fd, const void *buf, size_t count)
1188 {
1189 size_t nwrote;
1190 *err = __nacl_irt_write (fd, buf, count, &nwrote);
1191 return nwrote;
1192 }
1193
1194 __extern_always_inline ssize_t
1195 INTERNAL_SYSCALL_writev_3 (int *err, int fd, const
1196 struct iovec *iov, int iovcnt)
1197 {
1198 *err = (38 /* ENOSYS */);
1199 return 0;
1200 }
1201 #endif
291 1202
292 #include_next <sysdep.h> 1203 #include_next <sysdep.h>
293 1204
1205 #if !defined(__ASSEMBLER__) && \
1206 defined(THREAD_SELF) && defined(CLOCK_IDFIELD_SIZE)
1207 #include <tls.h>
1208
1209 /* We don't support redefinition of this function. We always use 30 bits of the
1210 address of pthread structure as TID. */
1211 __extern_always_inline pid_t
1212 INTERNAL_SYSCALL_gettid_0 (int *err)
1213 {
1214 *err = 0;
1215 /* Native Client does not have a notion of a thread ID, so we make
1216 one up. This must be small enough to leave space for number
1217 identifying the clock. Use CLOCK_IDFIELD_SIZE to guarantee
1218 that. */
1219 return ((unsigned int) THREAD_SELF) >> CLOCK_IDFIELD_SIZE;
1220 }
1221
1222 /* We can not return error code - this function is not supposed to fail.
1223 It should return pid (which is equal to tid for the main process).
1224 It's only ever called from main process so we just return TID. */
1225 __extern_always_inline int
1226 INTERNAL_SYSCALL_set_tid_address_1 (int *err, volatile int *tidptr)
1227 {
1228 return INTERNAL_SYSCALL_gettid_0 (err);
1229 }
1230 #endif
1231
1232 #undef INTERNAL_SYSCALL_DECL
1233 #define INTERNAL_SYSCALL_DECL(err) int err
1234
1235 #undef INTERNAL_SYSCALL_ERRNO
1236 #define INTERNAL_SYSCALL_ERRNO(val, err) (err)
1237
1238 #undef INTERNAL_SYSCALL_ERROR_P
1239 #define INTERNAL_SYSCALL_ERROR_P(val, err) (err)
1240
1241 /* Define a macro which expands inline into the wrapper code for a IRT
1242 call. */
1243 # undef INLINE_SYSCALL
1244 # define INLINE_SYSCALL(name, nr, args...) \
1245 ({ \
1246 INTERNAL_SYSCALL_DECL (err); \
1247 unsigned long int resultvar = INTERNAL_SYSCALL (name, err, nr , ## args); \
1248 if (__builtin_expect (err, 0)) \
1249 { \
1250 __set_errno (err); \
1251 resultvar = (unsigned long int) -1; \
1252 } \
1253 (long int) resultvar; })
1254
1255 #undef INTERNAL_VSYSCALL
1256 #define INTERNAL_VSYSCALL INTERNAL_SYSCALL
1257
294 #undef __NR_fallocate 1258 #undef __NR_fallocate
295 #undef __NR_pselect6 1259 #undef __NR_pselect6
296 #undef __NR_rt_sigaction 1260 #undef __NR_rt_sigaction
297 1261
298 #ifndef __x86_64__ 1262 #ifndef __x86_64__
299 #undef PSEUDO 1263 #undef PSEUDO
300 #define PSEUDO(name, syscall_name, args) \ 1264 #define PSEUDO(name, syscall_name, args) \
301 .text; \ 1265 .text; \
302 ENTRY (name) \ 1266 ENTRY (name) \
303 mov $-38, %eax; \ 1267 mov $-38, %eax; \
304 L(pseudo_end): \ 1268 L(pseudo_end): \
305 NACLRET 1269 NACLRET
306 1270
307 #undef PSEUDO_END 1271 #undef PSEUDO_END
308 #define PSEUDO_END(name) \ 1272 #define PSEUDO_END(name) \
309 SYSCALL_ERROR_HANDLER \ 1273 SYSCALL_ERROR_HANDLER \
310 END (name) 1274 END (name)
311 1275
312 #undef PSEUDO_NOERRNO 1276 #undef PSEUDO_NOERRNO
313 #define PSEUDO_NOERRNO(name, syscall_name, args)\ 1277 #define PSEUDO_NOERRNO(name, syscall_name, args)\
314 .text; \ 1278 .text; \
315 ENTRY (name) \ 1279 ENTRY (name) \
316 mov $-38, %eax 1280 mov $-38, %eax
317 1281
318 #undef PSEUDO_END_NOERRNO 1282 #undef PSEUDO_END_NOERRNO
319 #define PSEUDO_END_NOERRNO(name) \ 1283 #define PSEUDO_END_NOERRNO(name) \
320 END (name) 1284 END (name)
321 1285
1286 #undef ret_NOERRNO
322 #define ret_NOERRNO NACLRET 1287 #define ret_NOERRNO NACLRET
323 1288
324 /* The function has to return the error code. */ 1289 /* The function has to return the error code. */
325 #undef PSEUDO_ERRVAL 1290 #undef PSEUDO_ERRVAL
326 #define PSEUDO_ERRVAL(name, syscall_name, args) \ 1291 #define PSEUDO_ERRVAL(name, syscall_name, args) \
327 .text; \ 1292 .text; \
328 ENTRY (name) \ 1293 ENTRY (name) \
329 mov $38, %eax 1294 mov $38, %eax
330 1295
331 #undef PSEUDO_END_ERRVAL 1296 #undef PSEUDO_END_ERRVAL
332 #define PSEUDO_END_ERRVAL(name) \ 1297 #define PSEUDO_END_ERRVAL(name) \
333 END (name) 1298 END (name)
334 1299
335 #undef SYSCALL_ERROR_HANDLER_TLS_STORE 1300 #undef SYSCALL_ERROR_HANDLER_TLS_STORE
336 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ 1301 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
337 movl %gs:0, %eax; \ 1302 movl %gs:0, %eax; \
338 movl src, (%eax,destoff) 1303 movl src, (%eax,destoff)
339 1304
340 #endif 1305 #endif
341 #endif 1306 #endif
OLDNEW
« no previous file with comments | « sysdeps/nacl/read.c ('k') | sysdeps/posix/libc_fatal.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698