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

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

Powered by Google App Engine
This is Rietveld 408576698