Bundle libseccomp 2.3.1
[linux-seccomp.git] / libseccomp / src / arch-mips-syscalls.c
CommitLineData
8befd5cc
MG
1/**
2 * Enhanced Seccomp MIPS Specific Code
3 *
4 * Copyright (c) 2014 Imagination Technologies Ltd.
5 * Author: Markos Chandras <markos.chandras@imgtec.com>
6 *
7 */
8
9/*
10 * This library is free software; you can redistribute it and/or modify it
11 * under the terms of version 2.1 of the GNU Lesser General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This library is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, see <http://www.gnu.org/licenses>.
21 */
22
23#include <string.h>
24
25#include <seccomp.h>
26
27#include "arch.h"
28#include "arch-mips.h"
29
30/* O32 ABI */
31#define __SCMP_NR_BASE 4000
32
33/* NOTE: based on Linux 4.5-rc4 */
34const struct arch_syscall_def mips_syscall_table[] = { \
35 { "_llseek", (__SCMP_NR_BASE + 140) },
36 { "_newselect", (__SCMP_NR_BASE + 142) },
37 { "_sysctl", (__SCMP_NR_BASE + 153) },
38 { "accept", (__SCMP_NR_BASE + 168) },
39 { "accept4", (__SCMP_NR_BASE + 334) },
40 { "access", (__SCMP_NR_BASE + 33) },
41 { "acct", (__SCMP_NR_BASE + 51) },
42 { "add_key", (__SCMP_NR_BASE + 280) },
43 { "adjtimex", (__SCMP_NR_BASE + 124) },
44 { "afs_syscall", __SCMP_NR_BASE + 137 },
45 { "alarm", (__SCMP_NR_BASE + 27) },
46 { "arm_fadvise64_64", __PNR_arm_fadvise64_64 },
47 { "arm_sync_file_range", __PNR_arm_sync_file_range },
48 { "arch_prctl", __PNR_arch_prctl },
49 { "bdflush", (__SCMP_NR_BASE + 134) },
50 { "bind", (__SCMP_NR_BASE + 169) },
51 { "bpf", (__SCMP_NR_BASE + 355) },
52 { "break", __SCMP_NR_BASE + 17 },
53 { "breakpoint", __PNR_breakpoint },
54 { "brk", (__SCMP_NR_BASE + 45) },
55 { "cachectl", (__SCMP_NR_BASE + 148) },
56 { "cacheflush", (__SCMP_NR_BASE + 147) },
57 { "capget", (__SCMP_NR_BASE + 204) },
58 { "capset", (__SCMP_NR_BASE + 205) },
59 { "chdir", (__SCMP_NR_BASE + 12) },
60 { "chmod", (__SCMP_NR_BASE + 15) },
61 { "chown", (__SCMP_NR_BASE + 202) },
62 { "chown32", (__PNR_chown32) },
63 { "chroot", (__SCMP_NR_BASE + 61) },
64 { "clock_adjtime", (__SCMP_NR_BASE + 341) },
65 { "clock_getres", (__SCMP_NR_BASE + 264) },
66 { "clock_gettime", (__SCMP_NR_BASE + 263) },
67 { "clock_nanosleep", (__SCMP_NR_BASE + 265) },
68 { "clock_settime", (__SCMP_NR_BASE + 262) },
69 { "clone", (__SCMP_NR_BASE + 120) },
70 { "close", (__SCMP_NR_BASE + 6) },
71 { "connect", (__SCMP_NR_BASE + 170) },
72 { "copy_file_range", (__SCMP_NR_BASE + 360) },
73 { "creat", (__SCMP_NR_BASE + 8) },
74 { "create_module", __SCMP_NR_BASE + 127 },
75 { "delete_module", (__SCMP_NR_BASE + 129) },
76 { "dup", (__SCMP_NR_BASE + 41) },
77 { "dup2", (__SCMP_NR_BASE + 63) },
78 { "dup3", (__SCMP_NR_BASE + 327) },
79 { "epoll_create", (__SCMP_NR_BASE + 248) },
80 { "epoll_create1", (__SCMP_NR_BASE + 326) },
81 { "epoll_ctl", (__SCMP_NR_BASE + 249) },
82 { "epoll_ctl_old", __PNR_epoll_ctl_old },
83 { "epoll_pwait", (__SCMP_NR_BASE + 313) },
84 { "epoll_wait", (__SCMP_NR_BASE + 250) },
85 { "epoll_wait_old", __PNR_epoll_wait_old },
86 { "eventfd", (__SCMP_NR_BASE + 319) },
87 { "eventfd2", (__SCMP_NR_BASE + 325) },
88 { "execve", (__SCMP_NR_BASE + 11) },
89 { "execveat", (__SCMP_NR_BASE + 356) },
90 { "exit", (__SCMP_NR_BASE + 1) },
91 { "exit_group", (__SCMP_NR_BASE + 246) },
92 { "faccessat", (__SCMP_NR_BASE + 300) },
93 { "fadvise64", __SCMP_NR_BASE + 254 },
94 { "fadvise64_64", __PNR_fadvise64_64 },
95 { "fallocate", (__SCMP_NR_BASE + 320) },
96 { "fanotify_init", (__SCMP_NR_BASE + 336) },
97 { "fanotify_mark", (__SCMP_NR_BASE + 337) },
98 { "fchdir", (__SCMP_NR_BASE + 133) },
99 { "fchmod", (__SCMP_NR_BASE + 94) },
100 { "fchmodat", (__SCMP_NR_BASE + 299) },
101 { "fchown", (__SCMP_NR_BASE + 95) },
102 { "fchown32", (__PNR_fchown32) },
103 { "fchownat", (__SCMP_NR_BASE + 291) },
104 { "fcntl", (__SCMP_NR_BASE + 55) },
105 { "fcntl64", (__SCMP_NR_BASE + 220) },
106 { "fdatasync", (__SCMP_NR_BASE + 152) },
107 { "fgetxattr", (__SCMP_NR_BASE + 229) },
108 { "finit_module", (__SCMP_NR_BASE + 348) },
109 { "flistxattr", (__SCMP_NR_BASE + 232) },
110 { "flock", (__SCMP_NR_BASE + 143) },
111 { "fork", (__SCMP_NR_BASE + 2) },
112 { "fremovexattr", (__SCMP_NR_BASE + 235) },
113 { "fsetxattr", (__SCMP_NR_BASE + 226) },
114 { "fstat", (__SCMP_NR_BASE + 108) },
115 { "fstat64", (__SCMP_NR_BASE + 215) },
116 { "fstatat64", (__SCMP_NR_BASE + 293) },
117 { "fstatfs", (__SCMP_NR_BASE + 100) },
118 { "fstatfs64", (__SCMP_NR_BASE + 256) },
119 { "fsync", (__SCMP_NR_BASE + 118) },
120 { "ftime", (__SCMP_NR_BASE + 35) },
121 { "ftruncate", (__SCMP_NR_BASE + 93) },
122 { "ftruncate64", (__SCMP_NR_BASE + 212) },
123 { "futex", (__SCMP_NR_BASE + 238) },
124 { "futimesat", (__SCMP_NR_BASE + 292) },
125 { "get_kernel_syms", (__SCMP_NR_BASE + 130) },
126 { "get_mempolicy", (__SCMP_NR_BASE + 269) },
127 { "get_robust_list", (__SCMP_NR_BASE + 310) },
128 { "get_thread_area", __PNR_get_thread_area },
129 { "getcpu", (__SCMP_NR_BASE + 312) },
130 { "getcwd", (__SCMP_NR_BASE + 203) },
131 { "getdents", (__SCMP_NR_BASE + 141) },
132 { "getdents64", (__SCMP_NR_BASE + 219) },
133 { "getegid", (__SCMP_NR_BASE + 50) },
134 { "getegid32", __PNR_getegid32 },
135 { "geteuid", (__SCMP_NR_BASE + 49) },
136 { "geteuid32", __PNR_geteuid32 },
137 { "getgid", (__SCMP_NR_BASE + 47) },
138 { "getgid32", __PNR_getgid32 },
139 { "getgroups", (__SCMP_NR_BASE + 80) },
140 { "getgroups32", __PNR_getgroups32 },
141 { "getitimer", (__SCMP_NR_BASE + 105) },
142 { "getpeername", (__SCMP_NR_BASE + 171) },
143 { "getpgid", (__SCMP_NR_BASE + 132) },
144 { "getpgrp", (__SCMP_NR_BASE + 65) },
145 { "getpid", (__SCMP_NR_BASE + 20) },
146 { "getpmsg", (__SCMP_NR_BASE + 208) },
147 { "getppid", (__SCMP_NR_BASE + 64) },
148 { "getpriority", (__SCMP_NR_BASE + 96) },
149 { "getrandom", (__SCMP_NR_BASE + 353) },
150 { "getresgid", (__SCMP_NR_BASE + 191) },
151 { "getresgid32", __PNR_getresgid32 },
152 { "getresuid", (__SCMP_NR_BASE + 186) },
153 { "getresuid32", __PNR_getresuid32 },
154 { "getrlimit", (__SCMP_NR_BASE + 76) },
155 { "getrusage", (__SCMP_NR_BASE + 77) },
156 { "getsid", (__SCMP_NR_BASE + 151) },
157 { "getsockname", (__SCMP_NR_BASE + 172) },
158 { "getsockopt", (__SCMP_NR_BASE + 173) },
159 { "gettid", (__SCMP_NR_BASE + 222) },
160 { "gettimeofday", (__SCMP_NR_BASE + 78) },
161 { "getuid", (__SCMP_NR_BASE + 24) },
162 { "getuid32", __PNR_getuid32 },
163 { "getxattr", (__SCMP_NR_BASE + 227) },
164 { "gtty", (__SCMP_NR_BASE + 32) },
165 { "idle", (__SCMP_NR_BASE + 112) },
166 { "init_module", (__SCMP_NR_BASE + 128) },
167 { "inotify_add_watch", (__SCMP_NR_BASE + 285) },
168 { "inotify_init", (__SCMP_NR_BASE + 284) },
169 { "inotify_init1", (__SCMP_NR_BASE + 329) },
170 { "inotify_rm_watch", (__SCMP_NR_BASE + 286) },
171 { "io_cancel", (__SCMP_NR_BASE + 245) },
172 { "io_destroy", (__SCMP_NR_BASE + 242) },
173 { "io_getevents", (__SCMP_NR_BASE + 243) },
174 { "io_setup", (__SCMP_NR_BASE + 241) },
175 { "io_submit", (__SCMP_NR_BASE + 244) },
176 { "ioctl", (__SCMP_NR_BASE + 54) },
177 { "ioperm", (__SCMP_NR_BASE + 101) },
178 { "iopl", (__SCMP_NR_BASE + 110) },
179 { "ioprio_get", (__SCMP_NR_BASE + 315) },
180 { "ioprio_set", (__SCMP_NR_BASE + 314) },
181 { "ipc", (__SCMP_NR_BASE + 117) },
182 { "kcmp", (__SCMP_NR_BASE + 347) },
183 { "kexec_file_load", __PNR_kexec_file_load },
184 { "kexec_load", (__SCMP_NR_BASE + 311) },
185 { "keyctl", (__SCMP_NR_BASE + 282) },
186 { "kill", (__SCMP_NR_BASE + 37) },
187 { "lchown", (__SCMP_NR_BASE + 16) },
188 { "lchown32", __PNR_lchown32 },
189 { "lgetxattr", (__SCMP_NR_BASE + 228) },
190 { "link", (__SCMP_NR_BASE + 9) },
191 { "linkat", (__SCMP_NR_BASE + 296) },
192 { "listen", (__SCMP_NR_BASE + 174) },
193 { "listxattr", (__SCMP_NR_BASE + 230) },
194 { "llistxattr", (__SCMP_NR_BASE + 231) },
195 { "lock", (__SCMP_NR_BASE + 53) },
196 { "lookup_dcookie", (__SCMP_NR_BASE + 247) },
197 { "lremovexattr", (__SCMP_NR_BASE + 234) },
198 { "lseek", (__SCMP_NR_BASE + 19) },
199 { "lsetxattr", (__SCMP_NR_BASE + 225) },
200 { "lstat", (__SCMP_NR_BASE + 107) },
201 { "lstat64", (__SCMP_NR_BASE + 214) },
202 { "madvise", (__SCMP_NR_BASE + 218) },
203 { "mbind", (__SCMP_NR_BASE + 268) },
204 { "membarrier", (__SCMP_NR_BASE + 358) },
205 { "memfd_create", (__SCMP_NR_BASE + 354) },
206 { "migrate_pages", (__SCMP_NR_BASE + 287) },
207 { "mincore", (__SCMP_NR_BASE + 217) },
208 { "mkdir", (__SCMP_NR_BASE + 39) },
209 { "mkdirat", (__SCMP_NR_BASE + 289) },
210 { "mknod", (__SCMP_NR_BASE + 14) },
211 { "mknodat", (__SCMP_NR_BASE + 290) },
212 { "mlock", (__SCMP_NR_BASE + 154) },
213 { "mlock2", (__SCMP_NR_BASE + 359) },
214 { "mlockall", (__SCMP_NR_BASE + 156) },
215 { "mmap", (__SCMP_NR_BASE + 90) },
216 { "mmap2", (__SCMP_NR_BASE + 210) },
217 { "modify_ldt", (__SCMP_NR_BASE + 123) },
218 { "mount", (__SCMP_NR_BASE + 21) },
219 { "move_pages", (__SCMP_NR_BASE + 308) },
220 { "mprotect", (__SCMP_NR_BASE + 125) },
221 { "mpx", (__SCMP_NR_BASE + 56) },
222 { "mq_getsetattr", (__SCMP_NR_BASE + 276) },
223 { "mq_notify", (__SCMP_NR_BASE + 275) },
224 { "mq_open", (__SCMP_NR_BASE + 271) },
225 { "mq_timedreceive", (__SCMP_NR_BASE + 274) },
226 { "mq_timedsend", (__SCMP_NR_BASE + 273) },
227 { "mq_unlink", (__SCMP_NR_BASE + 272) },
228 { "mremap", (__SCMP_NR_BASE + 167) },
229 { "msgctl", __PNR_msgctl },
230 { "msgget", __PNR_msgget },
231 { "msgrcv", __PNR_msgrcv },
232 { "msgsnd", __PNR_msgsnd },
233 { "msync", (__SCMP_NR_BASE + 144) },
234 { "multiplexer", __PNR_multiplexer },
235 { "munlock", (__SCMP_NR_BASE + 155) },
236 { "munlockall", (__SCMP_NR_BASE + 157) },
237 { "munmap", (__SCMP_NR_BASE + 91) },
238 { "name_to_handle_at", (__SCMP_NR_BASE + 339) },
239 { "nanosleep", (__SCMP_NR_BASE + 166) },
240 { "newfstatat", __PNR_newfstatat },
241 { "nfsservctl", (__SCMP_NR_BASE + 189) },
242 { "nice", (__SCMP_NR_BASE + 34) },
243 { "oldfstat", __PNR_oldfstat },
244 { "oldlstat", __PNR_oldlstat },
245 { "oldolduname", __PNR_oldolduname },
246 { "oldstat", __PNR_oldstat },
247 { "olduname", __PNR_olduname },
248 { "oldwait4", __PNR_oldwait4 },
249 { "open", (__SCMP_NR_BASE + 5) },
250 { "open_by_handle_at", (__SCMP_NR_BASE + 340) },
251 { "openat", (__SCMP_NR_BASE + 288) },
252 { "pause", (__SCMP_NR_BASE + 29) },
253 { "pciconfig_iobase", __PNR_pciconfig_iobase },
254 { "pciconfig_read", __PNR_pciconfig_read },
255 { "pciconfig_write", __PNR_pciconfig_write },
256 { "perf_event_open", (__SCMP_NR_BASE + 333) },
257 { "personality", (__SCMP_NR_BASE + 136) },
258 { "pipe", (__SCMP_NR_BASE + 42) },
259 { "pipe2", (__SCMP_NR_BASE + 328) },
260 { "pivot_root", (__SCMP_NR_BASE + 216) },
261 { "poll", (__SCMP_NR_BASE + 188) },
262 { "ppoll", (__SCMP_NR_BASE + 302) },
263 { "prctl", (__SCMP_NR_BASE + 192) },
264 { "pread64", (__SCMP_NR_BASE + 200) },
265 { "preadv", (__SCMP_NR_BASE + 330) },
266 { "prlimit64", (__SCMP_NR_BASE + 338) },
267 { "process_vm_readv", (__SCMP_NR_BASE + 345) },
268 { "process_vm_writev", (__SCMP_NR_BASE + 346) },
269 { "prof", (__SCMP_NR_BASE + 44) },
270 { "profil", (__SCMP_NR_BASE + 98) },
271 { "pselect6", (__SCMP_NR_BASE + 301) },
272 { "ptrace", (__SCMP_NR_BASE + 26) },
273 { "putpmsg", (__SCMP_NR_BASE + 209) },
274 { "pwrite64", (__SCMP_NR_BASE + 201) },
275 { "pwritev", (__SCMP_NR_BASE + 331) },
276 { "query_module", (__SCMP_NR_BASE + 187) },
277 { "quotactl", (__SCMP_NR_BASE + 131) },
278 { "read", (__SCMP_NR_BASE + 3) },
279 { "readahead", (__SCMP_NR_BASE + 223) },
280 { "readdir", (__SCMP_NR_BASE + 89) },
281 { "readlink", (__SCMP_NR_BASE + 85) },
282 { "readlinkat", (__SCMP_NR_BASE + 298) },
283 { "readv", (__SCMP_NR_BASE + 145) },
284 { "reboot", (__SCMP_NR_BASE + 88) },
285 { "recv", (__SCMP_NR_BASE + 175) },
286 { "recvfrom", (__SCMP_NR_BASE + 176) },
287 { "recvmmsg", (__SCMP_NR_BASE + 335) },
288 { "recvmsg", (__SCMP_NR_BASE + 177) },
289 { "remap_file_pages", (__SCMP_NR_BASE + 251) },
290 { "removexattr", (__SCMP_NR_BASE + 233) },
291 { "rename", (__SCMP_NR_BASE + 38) },
292 { "renameat", (__SCMP_NR_BASE + 295) },
293 { "renameat2", (__SCMP_NR_BASE + 351) },
294 { "request_key", (__SCMP_NR_BASE + 281) },
295 { "restart_syscall", (__SCMP_NR_BASE + 253) },
296 { "rmdir", (__SCMP_NR_BASE + 40) },
297 { "rt_sigaction", (__SCMP_NR_BASE + 194) },
298 { "rt_sigpending", (__SCMP_NR_BASE + 196) },
299 { "rt_sigprocmask", (__SCMP_NR_BASE + 195) },
300 { "rt_sigqueueinfo", (__SCMP_NR_BASE + 198) },
301 { "rt_sigreturn", (__SCMP_NR_BASE + 193) },
302 { "rt_sigsuspend", (__SCMP_NR_BASE + 199) },
303 { "rt_sigtimedwait", (__SCMP_NR_BASE + 197) },
304 { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 332) },
305 { "rtas", __PNR_rtas },
306 { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read },
307 { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write },
308 { "s390_runtime_instr", __PNR_s390_runtime_instr },
309 { "sched_get_priority_max", (__SCMP_NR_BASE + 163) },
310 { "sched_get_priority_min", (__SCMP_NR_BASE + 164) },
311 { "sched_getaffinity", (__SCMP_NR_BASE + 240) },
312 { "sched_getattr", (__SCMP_NR_BASE + 350) },
313 { "sched_getparam", (__SCMP_NR_BASE + 159) },
314 { "sched_getscheduler", (__SCMP_NR_BASE + 161) },
315 { "sched_rr_get_interval", (__SCMP_NR_BASE + 165) },
316 { "sched_setaffinity", (__SCMP_NR_BASE + 239) },
317 { "sched_setattr", (__SCMP_NR_BASE + 349) },
318 { "sched_setparam", (__SCMP_NR_BASE + 158) },
319 { "sched_setscheduler", (__SCMP_NR_BASE + 160) },
320 { "sched_yield", (__SCMP_NR_BASE + 162) },
321 { "seccomp", (__SCMP_NR_BASE + 352) },
322 { "security", __PNR_security },
323 { "select", __PNR_select },
324 { "semctl", __PNR_semctl },
325 { "semget", __PNR_semget },
326 { "semop", __PNR_semop },
327 { "semtimedop", __PNR_semtimedop },
328 { "send", (__SCMP_NR_BASE + 178) },
329 { "sendfile", (__SCMP_NR_BASE + 207) },
330 { "sendfile64", (__SCMP_NR_BASE + 237) },
331 { "sendmmsg", (__SCMP_NR_BASE + 343) },
332 { "sendmsg", (__SCMP_NR_BASE + 179) },
333 { "sendto", (__SCMP_NR_BASE + 180) },
334 { "set_mempolicy", (__SCMP_NR_BASE + 270) },
335 { "set_robust_list", (__SCMP_NR_BASE + 309) },
336 { "set_thread_area", (__SCMP_NR_BASE + 283) },
337 { "set_tid_address", (__SCMP_NR_BASE + 252) },
338 { "set_tls", __PNR_set_tls },
339 { "setdomainname", (__SCMP_NR_BASE + 121) },
340 { "setfsgid", (__SCMP_NR_BASE + 139) },
341 { "setfsgid32", __PNR_setfsgid32 },
342 { "setfsuid", (__SCMP_NR_BASE + 138) },
343 { "setfsuid32", __PNR_setfsuid32 },
344 { "setgid", (__SCMP_NR_BASE + 46) },
345 { "setgid32", __PNR_setgid32 },
346 { "setgroups", (__SCMP_NR_BASE + 81) },
347 { "setgroups32", __PNR_setgroups32 },
348 { "sethostname", (__SCMP_NR_BASE + 74) },
349 { "setitimer", (__SCMP_NR_BASE + 104) },
350 { "setns", (__SCMP_NR_BASE + 344) },
351 { "setpgid", (__SCMP_NR_BASE + 57) },
352 { "setpriority", (__SCMP_NR_BASE + 97) },
353 { "setregid", (__SCMP_NR_BASE + 71) },
354 { "setregid32", __PNR_setregid32 },
355 { "setresgid", (__SCMP_NR_BASE + 190) },
356 { "setresgid32", __PNR_setresgid32 },
357 { "setresuid", (__SCMP_NR_BASE + 185) },
358 { "setresuid32", __PNR_setresuid32 },
359 { "setreuid", (__SCMP_NR_BASE + 70) },
360 { "setreuid32", __PNR_setreuid32 },
361 { "setrlimit", (__SCMP_NR_BASE + 75) },
362 { "setsid", (__SCMP_NR_BASE + 66) },
363 { "setsockopt", (__SCMP_NR_BASE + 181) },
364 { "settimeofday", (__SCMP_NR_BASE + 79) },
365 { "setuid", (__SCMP_NR_BASE + 23) },
366 { "setuid32", __PNR_setuid32 },
367 { "setxattr", (__SCMP_NR_BASE + 224) },
368 { "sgetmask", (__SCMP_NR_BASE + 68) },
369 { "shmat", __PNR_shmat },
370 { "shmctl", __PNR_shmctl },
371 { "shmdt", __PNR_shmdt },
372 { "shmget", __PNR_shmget },
373 { "shutdown", (__SCMP_NR_BASE + 182) },
374 { "sigaction", (__SCMP_NR_BASE + 67) },
375 { "sigaltstack", (__SCMP_NR_BASE + 206) },
376 { "signal", (__SCMP_NR_BASE + 48) },
377 { "signalfd", (__SCMP_NR_BASE + 317) },
378 { "signalfd4", (__SCMP_NR_BASE + 324) },
379 { "sigpending", (__SCMP_NR_BASE + 73) },
380 { "sigprocmask", (__SCMP_NR_BASE + 126) },
381 { "sigreturn", (__SCMP_NR_BASE + 119) },
382 { "sigsuspend", (__SCMP_NR_BASE + 72) },
383 { "socket", (__SCMP_NR_BASE + 183) },
384 { "socketcall", (__SCMP_NR_BASE + 102) },
385 { "socketpair", (__SCMP_NR_BASE + 184) },
386 { "splice", (__SCMP_NR_BASE + 304) },
387 { "spu_create", __PNR_spu_create },
388 { "spu_run", __PNR_spu_run },
389 { "ssetmask", (__SCMP_NR_BASE + 69) },
390 { "stat", (__SCMP_NR_BASE + 106) },
391 { "stat64", (__SCMP_NR_BASE + 213) },
392 { "statfs", (__SCMP_NR_BASE + 99) },
393 { "statfs64", (__SCMP_NR_BASE + 255) },
394 { "stime", (__SCMP_NR_BASE + 25) },
395 { "stty", (__SCMP_NR_BASE + 31) },
396 { "subpage_prot", __PNR_subpage_prot },
397 { "swapcontext", __PNR_swapcontext },
398 { "swapoff", (__SCMP_NR_BASE + 115) },
399 { "swapon", (__SCMP_NR_BASE + 87) },
400 { "switch_endian", __PNR_switch_endian },
401 { "symlink", (__SCMP_NR_BASE + 83) },
402 { "symlinkat", (__SCMP_NR_BASE + 297) },
403 { "sync", (__SCMP_NR_BASE + 36) },
404 { "sync_file_range", (__SCMP_NR_BASE + 305) },
405 { "sync_file_range2", __PNR_sync_file_range2 },
406 { "syncfs", (__SCMP_NR_BASE + 342) },
407 { "syscall", (__SCMP_NR_BASE + 0) },
408 { "sys_debug_setcontext", __PNR_sys_debug_setcontext },
409 { "sysfs", (__SCMP_NR_BASE + 135) },
410 { "sysinfo", (__SCMP_NR_BASE + 116) },
411 { "syslog", (__SCMP_NR_BASE + 103) },
412 { "sysmips", (__SCMP_NR_BASE + 149) },
413 { "tee", (__SCMP_NR_BASE + 306) },
414 { "tgkill", (__SCMP_NR_BASE + 266) },
415 { "time", (__SCMP_NR_BASE + 13) },
416 { "timer_create", (__SCMP_NR_BASE + 257) },
417 { "timer_delete", (__SCMP_NR_BASE + 261) },
418 { "timer_getoverrun", (__SCMP_NR_BASE + 260) },
419 { "timer_gettime", (__SCMP_NR_BASE + 259) },
420 { "timer_settime", (__SCMP_NR_BASE + 258) },
421 { "timerfd", (__SCMP_NR_BASE + 318) },
422 { "timerfd_create", (__SCMP_NR_BASE + 321) },
423 { "timerfd_gettime", (__SCMP_NR_BASE + 322) },
424 { "timerfd_settime", (__SCMP_NR_BASE + 323) },
425 { "times", (__SCMP_NR_BASE + 43) },
426 { "tkill", (__SCMP_NR_BASE + 236) },
427 { "truncate", (__SCMP_NR_BASE + 92) },
428 { "truncate64", (__SCMP_NR_BASE + 211) },
429 { "tuxcall", __PNR_tuxcall },
430 { "ugetrlimit", __PNR_ugetrlimit },
431 { "ulimit", (__SCMP_NR_BASE + 58) },
432 { "umask", (__SCMP_NR_BASE + 60) },
433 { "umount", (__SCMP_NR_BASE + 22) },
434 { "umount2", (__SCMP_NR_BASE + 52) },
435 { "uname", (__SCMP_NR_BASE + 122) },
436 { "unlink", (__SCMP_NR_BASE + 10) },
437 { "unlinkat", (__SCMP_NR_BASE + 294) },
438 { "unshare", (__SCMP_NR_BASE + 303) },
439 { "uselib", (__SCMP_NR_BASE + 86) },
440 { "userfaultfd", (__SCMP_NR_BASE + 357) },
441 { "usr26", __PNR_usr26 },
442 { "usr32", __PNR_usr32 },
443 { "ustat", (__SCMP_NR_BASE + 62) },
444 { "utime", (__SCMP_NR_BASE + 30) },
445 { "utimensat", (__SCMP_NR_BASE + 316) },
446 { "utimes", (__SCMP_NR_BASE + 267) },
447 { "vfork", __PNR_vfork },
448 { "vhangup", (__SCMP_NR_BASE + 111) },
449 { "vm86", (__SCMP_NR_BASE + 113) },
450 { "vm86old", __PNR_vm86old },
451 { "vmsplice", (__SCMP_NR_BASE + 307) },
452 { "vserver", (__SCMP_NR_BASE + 277) },
453 { "wait4", (__SCMP_NR_BASE + 114) },
454 { "waitid", (__SCMP_NR_BASE + 278) },
455 { "waitpid", (__SCMP_NR_BASE + 7) },
456 { "write", (__SCMP_NR_BASE + 4) },
457 { "writev", (__SCMP_NR_BASE + 146) },
458 { NULL, __NR_SCMP_ERROR },
459};
460
461/**
462 * Resolve a syscall name to a number
463 * @param name the syscall name
464 *
465 * Resolve the given syscall name to the syscall number using the syscall table.
466 * Returns the syscall number on success, including negative pseudo syscall
467 * numbers; returns __NR_SCMP_ERROR on failure.
468 *
469 */
470int mips_syscall_resolve_name(const char *name)
471{
472 unsigned int iter;
473 const struct arch_syscall_def *table = mips_syscall_table;
474
475 /* XXX - plenty of room for future improvement here */
476 for (iter = 0; table[iter].name != NULL; iter++) {
477 if (strcmp(name, table[iter].name) == 0)
478 return table[iter].num;
479 }
480
481 return __NR_SCMP_ERROR;
482}
483
484/**
485 * Resolve a syscall number to a name
486 * @param num the syscall number
487 *
488 * Resolve the given syscall number to the syscall name using the syscall table.
489 * Returns a pointer to the syscall name string on success, including pseudo
490 * syscall names; returns NULL on failure.
491 *
492 */
493const char *mips_syscall_resolve_num(int num)
494{
495 unsigned int iter;
496 const struct arch_syscall_def *table = mips_syscall_table;
497
498 /* XXX - plenty of room for future improvement here */
499 for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) {
500 if (num == table[iter].num)
501 return table[iter].name;
502 }
503
504 return NULL;
505}
506
507/**
508 * Iterate through the syscall table and return the syscall name
509 * @param spot the offset into the syscall table
510 *
511 * Return the syscall name at position @spot or NULL on failure. This function
512 * should only ever be used internally by libseccomp.
513 *
514 */
515const char *mips_syscall_iterate_name(unsigned int spot)
516{
517 /* XXX - no safety checks here */
518 return mips_syscall_table[spot].name;
519}
This page took 0.038716 seconds and 4 git commands to generate.