1/* Basic syscall test, see memcheck/tests/x86-linux/scalar.c for more info. */
2
3#include "scalar.h"
4
5#include <bsm/audit.h>
6#include <nfs/nfs.h>
7#include <nfs/nfssys.h>
8#include <sys/acl.h>
9#include <sys/door.h>
10#include <sys/fcntl.h>
11#include <sys/lwp.h>
12#include <sys/mman.h>
13#include <sys/mount.h>
14#include <sys/port_impl.h>
15#include <sys/priocntl.h>
16#include <sys/priv.h>
17#include <sys/sem_impl.h>
18#include <sys/sendfile.h>
19#include <sys/shm_impl.h>
20#include <sys/termios.h>
21#include <sys/ucontext.h>
22#include <sys/utsname.h>
23#include <sys/tsol/tndb.h>
24#include <sys/tsol/tsyscall.h>
25
26/* Helper functions.  These are necessary if we've got two tests for a single
27   syscall.  In that case, Memcheck can sometimes merge error messages.  Doing
28   each test in its own function prevents that. */
29__attribute__((noinline))
30static void sys_mount(void)
31{
32   GO(SYS_mount, "(4-arg, table variant) 4s 2m");
33   SY(SYS_mount, x0 + 1, x0, x0, x0); FAIL;
34}
35
36__attribute__((noinline))
37static void sys_mount2(void)
38{
39   GO(SYS_mount, "(4-arg) 4s 3m");
40   SY(SYS_mount, x0 + 1, x0, x0, x0 + 256); FAIL;
41}
42
43__attribute__((noinline))
44static void sys_mount3(void)
45{
46   GO(SYS_mount, "(6-arg) 6s 4m");
47   SY(SYS_mount, x0 + 1, x0, x0 | MS_DATA, x0 + 256, x0 + 1, x0 + 1); FAIL;
48}
49
50__attribute__((noinline))
51static void sys_mount4(void)
52{
53   GO(SYS_mount, "(8-arg) 8s 5m");
54   SY(SYS_mount, x0 + 1, x0, x0 | MS_OPTIONSTR, x0 + 256, x0 + 1, x0 + 1,
55                 x0 + 1, x0 + 1); FAIL;
56}
57
58__attribute__((noinline))
59static void sys_pgrpsys(void)
60{
61   GO(SYS_pgrpsys, "(GETPGRP) 1s 0m");
62   SY(SYS_pgrpsys, x0); SUCC;
63}
64
65__attribute__((noinline))
66static void sys_pgrpsys2(void)
67{
68   GO(SYS_pgrpsys, "(GETSID) 2s 0m");
69   SY(SYS_pgrpsys, x0 + 2, x0); SUCC;
70}
71
72__attribute__((noinline))
73static void sys_pgrpsys3(void)
74{
75   GO(SYS_pgrpsys, "(GETPGID) 2s 0m");
76   SY(SYS_pgrpsys, x0 + 4, x0); SUCC;
77}
78
79__attribute__((noinline))
80static void sys_shmsys(void)
81{
82   GO(SYS_shmsys, "(SHMAT) 4s 0m");
83   SY(SYS_shmsys, x0 + SHMAT, x0, x0 - 1, x0); FAIL;
84}
85
86__attribute__((noinline))
87static void sys_shmsys2(void)
88{
89   GO(SYS_shmsys, "(SHMCTL,SHM_LOCK) 3s 0m");
90   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + SHM_LOCK); FAIL;
91}
92
93__attribute__((noinline))
94static void sys_shmsys3(void)
95{
96   GO(SYS_shmsys, "(SHMCTL,SHM_UNLOCK) 3s 0m");
97   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + SHM_UNLOCK); FAIL;
98}
99
100__attribute__((noinline))
101static void sys_shmsys4(void)
102{
103   GO(SYS_shmsys, "(SHMCTL,IPC_RMID) 3s 0m");
104   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_RMID); FAIL;
105}
106
107__attribute__((noinline))
108static void sys_shmsys5(void)
109{
110   GO(SYS_shmsys, "(SHMCTL,IPC_SET) 4s 3m");
111   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_SET, x0 + 1); FAIL;
112}
113
114__attribute__((noinline))
115static void sys_shmsys6(void)
116{
117   struct shmid_ds buf;
118   buf.shm_perm.uid = x0 + 1;
119   buf.shm_perm.gid = x0 + 1;
120   buf.shm_perm.mode = x0 + 1;
121
122   GO(SYS_shmsys, "(SHMCTL,IPC_SET) 6s 0m");
123   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_SET, &buf); FAIL;
124}
125
126__attribute__((noinline))
127static void sys_shmsys7(void)
128{
129   GO(SYS_shmsys, "(SHMCTL,IPC_STAT) 4s 1m");
130   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_STAT, x0 + 1); FAIL;
131}
132
133__attribute__((noinline))
134static void sys_shmsys8(void)
135{
136   GO(SYS_shmsys, "(SHMCTL,IPC_SET64) 4s 3m");
137   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_SET64, x0 + 1); FAIL;
138}
139
140__attribute__((noinline))
141static void sys_shmsys9(void)
142{
143   struct shmid_ds64 buf;
144   buf.shmx_perm.ipcx_uid = x0 + 1;
145   buf.shmx_perm.ipcx_gid = x0 + 1;
146   buf.shmx_perm.ipcx_mode = x0 + 1;
147
148   GO(SYS_shmsys, "(SHMCTL,IPC_SET64) 6s 0m");
149   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_SET64, &buf); FAIL;
150}
151
152__attribute__((noinline))
153static void sys_shmsys10(void)
154{
155   GO(SYS_shmsys, "(SHMCTL,IPC_STAT64) 4s 1m");
156   SY(SYS_shmsys, x0 + SHMCTL, x0, x0 + IPC_STAT64, x0 + 1); FAIL;
157}
158
159__attribute__((noinline))
160static void sys_shmsys11(void)
161{
162   GO(SYS_shmsys, "(SHMDT) 2s 0m");
163   SY(SYS_shmsys, x0 + SHMDT, x0 - 1); FAIL;
164}
165
166__attribute__((noinline))
167static void sys_shmsys12(void)
168{
169   GO(SYS_shmsys, "(SHMGET) 4s 0m");
170   SY(SYS_shmsys, x0 + SHMGET, x0, x0, x0); FAIL;
171}
172
173__attribute__((noinline))
174static void sys_shmsys13(void)
175{
176   GO(SYS_shmsys, "(SHMIDS) 4s 2m");
177   SY(SYS_shmsys, x0 + SHMIDS, x0 + 1, x0 + 1, x0 + 1); FAIL;
178}
179
180__attribute__((noinline))
181static void sys_semsys(void)
182{
183   GO(SYS_semsys, "(SEMCTL,IPC_STAT) 5s 1m");
184   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + IPC_STAT, x0 + 1); FAIL;
185}
186
187__attribute__((noinline))
188static void sys_semsys2(void)
189{
190   GO(SYS_semsys, "(SEMCTL,IPC_SET) 5s 1m");
191   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + IPC_SET, x0 + 1); FAIL;
192}
193
194__attribute__((noinline))
195static void sys_semsys3(void)
196{
197   GO(SYS_semsys, "(SEMCTL,IPC_STAT64) 5s 1m");
198   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + IPC_STAT64, x0 + 1); FAIL;
199}
200
201__attribute__((noinline))
202static void sys_semsys4(void)
203{
204   GO(SYS_semsys, "(SEMCTL,IPC_SET64) 5s 1m");
205   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + IPC_SET64, x0 + 1); FAIL;
206}
207
208__attribute__((noinline))
209static void sys_semsys5(void)
210{
211   GO(SYS_semsys, "(SEMCTL,IPC_RMID) 3s 0m");
212   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + IPC_RMID); FAIL;
213}
214
215__attribute__((noinline))
216static void sys_semsys6(void)
217{
218   GO(SYS_semsys, "(SEMCTL,GETALL) 4s 0m");
219   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + GETALL, x0 + 1); FAIL;
220}
221
222__attribute__((noinline))
223static void sys_semsys7(void)
224{
225   GO(SYS_semsys, "(SEMCTL,SETALL) 4s 0m");
226   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + SETALL, x0 + 1); FAIL;
227}
228
229__attribute__((noinline))
230static void sys_semsys8(void)
231{
232   GO(SYS_semsys, "(SEMCTL,GETVAL) 4s 0m");
233   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + GETVAL); FAIL;
234}
235
236__attribute__((noinline))
237static void sys_semsys9(void)
238{
239   GO(SYS_semsys, "(SEMCTL,SETVAL) 5s 0m");
240   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + SETVAL, x0 + 2); FAIL;
241}
242
243__attribute__((noinline))
244static void sys_semsys10(void)
245{
246   GO(SYS_semsys, "(SEMCTL,GETPID) 4s 0m");
247   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + GETPID); FAIL;
248}
249
250__attribute__((noinline))
251static void sys_semsys11(void)
252{
253   GO(SYS_semsys, "(SEMCTL,GETNCNT) 4s 0m");
254   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + GETNCNT); FAIL;
255}
256
257__attribute__((noinline))
258static void sys_semsys12(void)
259{
260   GO(SYS_semsys, "(SEMCTL,GETZCNT) 4s 0m");
261   SY(SYS_semsys, x0 + SEMCTL, x0, x0, x0 + GETZCNT); FAIL;
262}
263
264__attribute__((noinline))
265static void sys_semsys13(void)
266{
267   GO(SYS_semsys, "(SEMGET) 4s 0m");
268   SY(SYS_semsys, x0 + SEMGET, x0, x0, x0); FAIL;
269}
270
271__attribute__((noinline))
272static void sys_semsys14(void)
273{
274   GO(SYS_semsys, "(SEMOP) 4s 1m");
275   SY(SYS_semsys, x0 + SEMOP, x0, x0 + 1, x0 + 1); FAIL;
276}
277
278__attribute__((noinline))
279static void sys_semsys15(void)
280{
281   GO(SYS_semsys, "(SEMIDS) 4s 2m");
282   SY(SYS_semsys, x0 + SEMIDS, x0 + 1, x0 + 1, x0 + 1); FAIL;
283}
284
285__attribute__((noinline))
286static void sys_semsys16(void)
287{
288   GO(SYS_semsys, "(SEMTIMEDOP) 5s 2m");
289   SY(SYS_semsys, x0 + SEMTIMEDOP, x0, x0 + 1, x0 + 1, x0 + 1); FAIL;
290}
291
292__attribute__((noinline))
293static void sys_fcntl(void)
294{
295   GO(SYS_fcntl, "(GETFD) 2s 0m");
296   SY(SYS_fcntl, x0 - 1, x0 + F_GETFD); FAILx(EBADF);
297}
298
299__attribute__((noinline))
300static void sys_fcntl2(void)
301{
302   GO(SYS_fcntl, "(DUPFD) 3s 0m");
303   SY(SYS_fcntl, x0 - 1, x0 + F_DUPFD, x0); FAILx(EBADF);
304}
305
306__attribute__((noinline))
307static void sys_fcntl3(void)
308{
309   GO(SYS_fcntl, "(GETLK) 3s 5m");
310   SY(SYS_fcntl, x0 - 1, x0 + F_GETLK, x0); FAILx(EBADF);
311}
312
313__attribute__((noinline))
314static void sys_openat(void)
315{
316   GO(SYS_openat, "(3-args) 3s 1m");
317   SY(SYS_openat, x0 - 1, x0, x0); FAIL;
318}
319
320__attribute__((noinline))
321static void sys_openat2(void)
322{
323   GO(SYS_openat, "(4-args) 4s 1m");
324   SY(SYS_openat, x0 - 1, x0, x0 | O_CREAT, x0); FAIL;
325}
326
327__attribute__((noinline))
328static void sys_tasksys(void)
329{
330   GO(SYS_tasksys, "(settaskid) 3s 0m");
331   SY(SYS_tasksys, x0 + 0, x0, x0); FAIL;
332}
333
334__attribute__((noinline))
335static void sys_tasksys2(void)
336{
337   GO(SYS_tasksys, "(gettaskid) 1s 0m");
338   SY(SYS_tasksys, x0 + 1); SUCC;
339}
340
341__attribute__((noinline))
342static void sys_tasksys3(void)
343{
344   GO(SYS_tasksys, "(getprojid) 1s 0m");
345   SY(SYS_tasksys, x0 + 2); SUCC;
346}
347
348__attribute__((noinline))
349static void sys_tasksys4(void)
350{
351   GO(SYS_tasksys, "(projlist) 3s 1m");
352   /* ARG2 and ARG3 are ignored */
353   SY(SYS_tasksys, x0 + 3, x0, x0, x0 + 1, x0 + 2); FAIL;
354}
355
356__attribute__((noinline))
357static void sys_sendfilev(void)
358{
359   GO(SYS_sendfilev, "(SENDFILEV) 5s 2m");
360   SY(SYS_sendfilev, x0 + SENDFILEV, x0 - 1, x0 + 1, x0 + 2, x0 + 1); FAIL;
361}
362
363__attribute__((noinline))
364static void sys_sendfilev2(void)
365{
366   struct sendfilevec vec[2];
367   vec[0].sfv_fd = SFV_FD_SELF;
368   vec[0].sfv_off = (off_t)(x0 + 1);
369   vec[0].sfv_len = x0 + 1;
370   vec[0].sfv_flag = 0; // should be set to zero according to man page
371   vec[1].sfv_fd = x0 - 1;
372   vec[1].sfv_off = x0;
373   vec[1].sfv_len = x0 + 1;
374   vec[1].sfv_flag = 0; // should be set to zero according to man page
375
376   GO(SYS_sendfilev, "(SENDFILEV) 4s 2m");
377   SY(SYS_sendfilev, x0 + SENDFILEV, x0 - 1, vec, 2, x0 + 1); FAIL;
378}
379
380__attribute__((noinline))
381static void sys_sendfilev3(void)
382{
383   GO(SYS_sendfilev, "(SENDFILEV64) 5s 2m");
384   SY(SYS_sendfilev, x0 + SENDFILEV64, x0 - 1, x0 + 1, x0 + 2, x0 + 1); FAIL;
385}
386
387__attribute__((noinline))
388static void sys_sendfilev4(void)
389{
390   struct sendfilevec64 vec[2];
391   vec[0].sfv_fd = SFV_FD_SELF;
392   vec[0].sfv_off = (off_t)(x0 + 1);
393   vec[0].sfv_len = x0 + 1;
394   vec[0].sfv_flag = 0; // should be set to zero according to man page
395   vec[1].sfv_fd = x0 - 1;
396   vec[1].sfv_off = x0;
397   vec[1].sfv_len = x0 + 1;
398   vec[1].sfv_flag = 0; // should be set to zero according to man page
399
400   GO(SYS_sendfilev, "(SENDFILEV64) 4s 2m");
401   SY(SYS_sendfilev, x0 + SENDFILEV64, x0 - 1, vec, 2, x0 + 1); FAIL;
402}
403
404__attribute__((noinline))
405static void sys_privsys(void)
406{
407   GO(SYS_privsys, "(PRIVSYS_SETPPRIV) 5s 1m");
408   SY(SYS_privsys, x0 + PRIVSYS_SETPPRIV, x0, x0, x0, x0 + 1); FAIL;
409}
410
411__attribute__((noinline))
412static void sys_privsys2(void)
413{
414   GO(SYS_privsys, "(PRIVSYS_GETPPRIV) 5s 1m");
415   SY(SYS_privsys, x0 + PRIVSYS_GETPPRIV, x0, x0, x0, x0 + 1); FAIL;
416}
417
418__attribute__((noinline))
419static void sys_privsys3(void)
420{
421   GO(SYS_privsys, "(PRIVSYS_GETIMPLINFO) 5s 1m");
422   SY(SYS_privsys, x0 + PRIVSYS_GETIMPLINFO, x0, x0, x0, x0 + 1); FAIL;
423}
424
425__attribute__((noinline))
426static void sys_privsys4(void)
427{
428   GO(SYS_privsys, "(PRIVSYS_SETPFLAGS) 3s 0m");
429   SY(SYS_privsys, x0 + PRIVSYS_SETPFLAGS, x0, x0 + 2); FAIL;
430}
431
432__attribute__((noinline))
433static void sys_privsys5(void)
434{
435   GO(SYS_privsys, "(PRIVSYS_GETPFLAGS) 2s 0m");
436   SY(SYS_privsys, x0 + PRIVSYS_GETPFLAGS, x0); FAIL;
437}
438
439__attribute__((noinline))
440static void sys_privsys6(void)
441{
442   GO(SYS_privsys, "(PRIVSYS_ISSETUGID) 1s 0m");
443   SY(SYS_privsys, x0 + PRIVSYS_ISSETUGID); SUCC;
444}
445
446__attribute__((noinline))
447static void sys_privsys7(void)
448{
449   GO(SYS_privsys, "(PRIVSYS_PFEXEC_REG) 2s 0m");
450   SY(SYS_privsys, x0 + PRIVSYS_PFEXEC_REG, x0 - 1); FAILx(EBADF);
451}
452
453__attribute__((noinline))
454static void sys_privsys8(void)
455{
456   GO(SYS_privsys, "(PRIVSYS_PFEXEC_UNREG) 2s 0m");
457   SY(SYS_privsys, x0 + PRIVSYS_PFEXEC_UNREG, x0 - 1); FAILx(EBADF);
458}
459
460__attribute__((noinline))
461static void sys_ucredsys(void)
462{
463   GO(SYS_ucredsys, "(UCREDSYS_UCREDGET) 3s 1m");
464   SY(SYS_ucredsys, x0 + 0, x0, x0 + 1 ); FAIL;
465}
466
467__attribute__((noinline))
468static void sys_ucredsys2(void)
469{
470   GO(SYS_ucredsys, "(UCREDSYS_GETPEERUCRED) 3s 1m");
471   SY(SYS_ucredsys, x0 + 1, x0 - 1, x0 + 1 ); FAILx(EBADF);
472}
473
474__attribute__((noinline))
475static void sys_context(void)
476{
477   GO(SYS_context, "(GETCONTEXT) 2s 1m");
478   SY(SYS_context, x0 + GETCONTEXT, x0); FAILx(EFAULT);
479}
480
481__attribute__((noinline))
482static void sys_context2(void)
483{
484   /* The setcontext() wrapper has to call ML_(safe_to_deref) before doing the
485      PRE_READ_*() stuff, therefore the 0m parameter. */
486   GO(SYS_context, "(SETCONTEXT) 2s 0m");
487   SY(SYS_context, x0 + SETCONTEXT, x0 + 1); FAILx(EFAULT);
488}
489
490__attribute__((noinline))
491static void sys_context3(void)
492{
493   GO(SYS_context, "(GETUSTACK) 2s 1m");
494   SY(SYS_context, x0 + GETUSTACK, x0); FAILx(EFAULT);
495}
496
497__attribute__((noinline))
498static void sys_context4(void)
499{
500   GO(SYS_context, "(SETUSTACK) 2s 1m");
501   SY(SYS_context, x0 + SETUSTACK, x0); FAILx(EFAULT);
502}
503
504__attribute__((noinline))
505static void sys_statvfs(void)
506{
507   GO(SYS_statvfs, "2s 2m");
508   SY(SYS_statvfs, x0 + 1, x0 + 1); FAIL;
509}
510
511__attribute__((noinline))
512static int sys_statvfs2(void)
513{
514   const char path[] = "/";
515   struct statvfs stats;
516
517   GO(SYS_statvfs, "4s 0m");
518   SY(SYS_statvfs, x0 + path, x0 + &stats); SUCC;
519
520   size_t basetype_len = strlen(stats.f_basetype);
521   size_t fstr_len = strlen(stats.f_fstr);
522
523   /* Now check that memory after the strings is reported uninitialized. */
524   int x = 0;
525   if (stats.f_basetype[basetype_len + 2] != ' ') x = -1; else x = -2;
526   if (stats.f_fstr[fstr_len + 2] != ' ') x = -3; else x = -4;
527   return x;
528}
529
530__attribute__((noinline))
531static void sys_nfssys(void)
532{
533   GO(SYS_nfssys, "(NFS_REVAUTH) 2s 1m");
534   SY(SYS_nfssys, x0 + NFS_REVAUTH, x0); FAIL;
535}
536
537__attribute__((noinline))
538static void sys_priocntlsys(void)
539{
540   pcinfo_t pcinfo;
541   pcinfo.pc_clname[0] = x0 + 'T';
542   pcinfo.pc_clname[1] = x0 + 'S';
543   pcinfo.pc_clname[2] = x0;
544
545   GO(SYS_priocntlsys, "(GETCID) 6s 0m");
546   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETCID, x0 + &pcinfo, x0); SUCC;
547}
548
549__attribute__((noinline))
550static void sys_priocntlsys2(void)
551{
552   pcinfo_t pcinfo;
553   pcinfo.pc_cid = x0 + 1;
554
555   GO(SYS_priocntlsys, "(GETCLINFO) 6s 0m");
556   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETCLINFO, x0 + &pcinfo, x0); SUCC;
557}
558
559__attribute__((noinline))
560static void sys_priocntlsys3(void)
561{
562   GO(SYS_priocntlsys, "(SETPARMS) 5s 2m");
563   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_SETPARMS, x0, x0); FAIL;
564}
565
566__attribute__((noinline))
567static void sys_priocntlsys4(void)
568{
569   GO(SYS_priocntlsys, "(GETPARMS) 5s 2m");
570   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETPARMS, x0, x0); FAIL;
571}
572
573__attribute__((noinline))
574static void sys_priocntlsys5(void)
575{
576   GO(SYS_priocntlsys, "(GETPRIRANGE) 5s 2m");
577   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETPRIRANGE, x0, x0); FAIL;
578}
579
580__attribute__((noinline))
581static void sys_priocntlsys6(void)
582{
583   GO(SYS_priocntlsys, "(DONICE) 5s 2m");
584   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_DONICE, x0, x0); FAIL;
585}
586
587__attribute__((noinline))
588static void sys_priocntlsys7(void)
589{
590   GO(SYS_priocntlsys, "(SETXPARMS) 5s 3m");
591   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_SETXPARMS, x0, x0 + 1); FAIL;
592}
593
594__attribute__((noinline))
595static void sys_priocntlsys8(void)
596{
597   GO(SYS_priocntlsys, "(GETXPARMS) 5s 3m");
598   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETXPARMS, x0 + 1, x0 + 1); FAIL;
599}
600
601__attribute__((noinline))
602static void sys_priocntlsys9(void)
603{
604   GO(SYS_priocntlsys, "(SETDFLCL) 5s 1m");
605   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_SETDFLCL, x0, x0); FAIL;
606}
607
608__attribute__((noinline))
609static void sys_priocntlsys10(void)
610{
611   GO(SYS_priocntlsys, "(GETDFLCL) 5s 1m");
612   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_GETDFLCL, x0 + 1, x0); FAIL;
613}
614
615__attribute__((noinline))
616static void sys_priocntlsys11(void)
617{
618   GO(SYS_priocntlsys, "(DOPRIO) 5s 2m");
619   SY(SYS_priocntlsys, x0 + 1, x0, x0 + PC_DOPRIO, x0, x0); FAIL;
620}
621
622__attribute__((noinline))
623static void sys_uname(void)
624{
625   GO(SYS_uname, "1s 1m");
626   SY(SYS_uname, x0 + 1); FAIL;
627}
628
629__attribute__((noinline))
630static int sys_uname2(void)
631{
632   struct utsname name;
633
634   GO(SYS_uname, "6s 0m");
635   SY(SYS_uname, x0 + &name); SUCC;
636
637   size_t sysname_len = strlen(name.sysname);
638   size_t nodename_len = strlen(name.nodename);
639   size_t release_len = strlen(name.release);
640   size_t version_len = strlen(name.version);
641   size_t machine_len = strlen(name.machine);
642
643   /* Now check that memory after the strings is reported uninitialized. */
644   int x = 0;
645   if (name.sysname[sysname_len + 2] != ' ') x = -1; else x = -2;
646   if (name.nodename[nodename_len + 2] != ' ') x = -3; else x = -4;
647   if (name.release[release_len + 2] != ' ') x = -5; else x = -6;
648   if (name.version[version_len + 2] != ' ') x = -7; else x = -8;
649   if (name.machine[machine_len + 2] != ' ') x = -9; else x = -10;
650   return x;
651}
652
653__attribute__((noinline))
654static void sys_rusagesys(void)
655{
656   GO(SYS_rusagesys, "(_RUSAGESYS_GETRUSAGE) 2s 1m");
657   SY(SYS_rusagesys, x0 + _RUSAGESYS_GETRUSAGE, x0 + 1); FAIL;
658}
659
660__attribute__((noinline))
661static void sys_rusagesys2(void)
662{
663   GO(SYS_rusagesys, "(_RUSAGESYS_GETRUSAGE_CHLD) 2s 1m");
664   SY(SYS_rusagesys, x0 + _RUSAGESYS_GETRUSAGE_CHLD, x0 + 1); FAIL;
665}
666
667__attribute__((noinline))
668static void sys_rusagesys3(void)
669{
670   GO(SYS_rusagesys, "(_RUSAGESYS_GETRUSAGE_LWP) 2s 1m");
671   SY(SYS_rusagesys, x0 + _RUSAGESYS_GETRUSAGE_LWP, x0 + 1); FAIL;
672}
673
674__attribute__((noinline))
675static void sys_rusagesys4(void)
676{
677   GO(SYS_rusagesys, "(_RUSAGESYS_GETVMUSAGE) 5s 1m");
678   SY(SYS_rusagesys, x0 + _RUSAGESYS_GETVMUSAGE, x0, x0, x0 + 1, x0 + 1);
679   FAIL;
680}
681
682__attribute__((noinline))
683static void sys_rusagesys5(void)
684{
685   size_t nres = 10;
686
687   GO(SYS_rusagesys, "(_RUSAGESYS_GETVMUSAGE) 5s 1m");
688   SY(SYS_rusagesys, x0 + _RUSAGESYS_GETVMUSAGE, x0, x0, x0 + 1, x0 + &nres);
689   FAIL;
690}
691
692__attribute__((noinline))
693static void sys_port(void)
694{
695   GO(SYS_port, "(PORT_CREATE) 1s 0m");
696   SY(SYS_port, (x0 + PORT_CREATE) | PORT_SYS_NOPORT); SUCC;
697}
698
699__attribute__((noinline))
700static void sys_port2(void)
701{
702   GO(SYS_port, "(PORT_ASSOCIATE,PORT_SOURCE_FD) 6s 0m");
703   SY(SYS_port, x0 + PORT_ASSOCIATE, x0 - 1, x0 + PORT_SOURCE_FD, x0, x0,
704                x0); FAILx(EBADF);
705}
706
707__attribute__((noinline))
708static void sys_port3(void)
709{
710   GO(SYS_port, "(PORT_ASSOCIATE,PORT_SOURCE_FILE) 6s 1m");
711   SY(SYS_port, x0 + PORT_ASSOCIATE, x0 - 1, x0 + PORT_SOURCE_FILE, x0, x0,
712                x0); FAILx(EBADF);
713}
714
715__attribute__((noinline))
716static void sys_port4(void)
717{
718   GO(SYS_port, "(PORT_DISSOCIATE,PORT_SOURCE_FD) 6s 0m");
719   SY(SYS_port, x0 + PORT_DISSOCIATE, x0 - 1, x0 + PORT_SOURCE_FD, x0, x0,
720                x0); FAILx(EBADF);
721}
722
723__attribute__((noinline))
724static void sys_port5(void)
725{
726   GO(SYS_port, "(PORT_DISSOCIATE,PORT_SOURCE_FILE) 6s 1m");
727   SY(SYS_port, x0 + PORT_DISSOCIATE, x0 - 1, x0 + PORT_SOURCE_FILE, x0, x0,
728                x0); FAILx(EBADF);
729}
730
731__attribute__((noinline))
732static void sys_port6(void)
733{
734   GO(SYS_port, "(PORT_SEND) 4s 0m");
735   SY(SYS_port, x0 + PORT_SEND, x0 - 1, x0, x0); FAILx(EBADF);
736}
737
738__attribute__((noinline))
739static void sys_port7(void)
740{
741   GO(SYS_port, "(PORT_SENDN) 6s 2m");
742   SY(SYS_port, (x0 + PORT_SENDN) | PORT_SYS_NOPORT, x0, x0, x0 + 1, x0,
743                x0); FAIL;
744}
745
746__attribute__((noinline))
747static void sys_port8(void)
748{
749   GO(SYS_port, "(PORT_GET) 6s 1m");
750   SY(SYS_port, x0 + PORT_GET, x0 - 1, x0, x0, x0, x0); FAILx(EBADF);
751}
752
753__attribute__((noinline))
754static void sys_port9(void)
755{
756   GO(SYS_port, "(PORT_GETN) 5s 2m");
757   SY(SYS_port, x0 + PORT_GETN, x0 - 1, x0, x0 + 1, x0, x0 + 1); FAILx(EBADF);
758}
759
760__attribute__((noinline))
761static void sys_port10(void)
762{
763   GO(SYS_port, "(PORT_ALERT) 5s 0m");
764   SY(SYS_port, x0 + PORT_ALERT, x0 - 1, x0, x0, x0); FAILx(EBADF);
765}
766
767__attribute__((noinline))
768static void sys_port11(void)
769{
770   GO(SYS_port, "(PORT_DISPATCH) 6s 0m");
771   SY(SYS_port, x0 + PORT_DISPATCH, x0 - 1, x0, x0, x0, x0); FAILx(EBADF);
772}
773
774__attribute__((noinline))
775static void sys_labelsys(void)
776{
777   GO(SYS_labelsys, "(TSOL_SYSLABELING) 1s 0m");
778   SY(SYS_labelsys, x0 + TSOL_SYSLABELING); SUCC;
779}
780
781__attribute__((noinline))
782static void sys_labelsys2(void)
783{
784   GO(SYS_labelsys, "(TSOL_TNRH) 3s 1m");
785   SY(SYS_labelsys, x0 + TSOL_TNRH, x0 + TNDB_GET, x0 + 1); FAIL;
786}
787
788__attribute__((noinline))
789static void sys_labelsys3(void)
790{
791   GO(SYS_labelsys, "(TSOL_TNRHTP) 3s 1m");
792   SY(SYS_labelsys, x0 + TSOL_TNRHTP, x0 + TNDB_GET, x0 + 1); FAIL;
793}
794
795__attribute__((noinline))
796static void sys_labelsys4(void)
797{
798   GO(SYS_labelsys, "(TSOL_TNMLP) 3s 1m");
799   SY(SYS_labelsys, x0 + TSOL_TNMLP, x0 + TNDB_GET, x0 + 1); FAIL;
800}
801
802__attribute__((noinline))
803static void sys_labelsys5(void)
804{
805   GO(SYS_labelsys, "(TSOL_GETLABEL) 3s 2m");
806   SY(SYS_labelsys, x0 + TSOL_GETLABEL, x0 + 1, x0 + 1); FAIL;
807}
808
809__attribute__((noinline))
810static void sys_labelsys6(void)
811{
812   GO(SYS_labelsys, "(TSOL_FGETLABEL) 3s 1m");
813   SY(SYS_labelsys, x0 + TSOL_FGETLABEL, x0 - 1, x0 + 1); FAILx(EBADF);
814}
815
816__attribute__((noinline))
817static void sys_acl(void)
818{
819   GO(SYS_acl, "(SETACL) 4s 2m");
820   SY(SYS_acl, x0, x0 + SETACL, x0 + 1, x0 + 1); FAIL;
821}
822
823__attribute__((noinline))
824static void sys_acl2(void)
825{
826   GO(SYS_acl, "(GETACL) 4s 2m");
827   SY(SYS_acl, x0, x0 + GETACL, x0 + 1, x0); FAIL;
828}
829
830__attribute__((noinline))
831static void sys_acl3(void)
832{
833   GO(SYS_acl, "(GETACLCNT) 4s 1m");
834   SY(SYS_acl, x0, x0 + GETACLCNT, x0, x0); FAIL;
835}
836
837__attribute__((noinline))
838static void sys_acl4(void)
839{
840   GO(SYS_acl, "(ACE_SETACL) 4s 2m");
841   SY(SYS_acl, x0, x0 + ACE_SETACL, x0 + 1, x0 + 1); FAIL;
842}
843
844__attribute__((noinline))
845static void sys_acl5(void)
846{
847   GO(SYS_acl, "(ACE_GETACL) 4s 2m");
848   SY(SYS_acl, x0, x0 + ACE_GETACL, x0 + 1, x0); FAIL;
849}
850
851__attribute__((noinline))
852static void sys_acl6(void)
853{
854   GO(SYS_acl, "(ACE_GETACLCNT) 4s 1m");
855   SY(SYS_acl, x0, x0 + ACE_GETACLCNT, x0, x0); FAIL;
856}
857
858__attribute__((noinline))
859static void sys_auditsys(void)
860{
861   GO(SYS_auditsys, "(BSM_GETAUID) 2s 1m");
862   SY(SYS_auditsys, x0 + BSM_GETAUID, x0); FAIL;
863}
864
865__attribute__((noinline))
866static void sys_auditsys2(void)
867{
868   GO(SYS_auditsys, "(BSM_SETAUID) 2s 1m");
869   SY(SYS_auditsys, x0 + BSM_SETAUID, x0); FAIL;
870}
871
872__attribute__((noinline))
873static void sys_auditsys3(void)
874{
875   GO(SYS_auditsys, "(BSM_GETAUDIT) 2s 1m");
876   SY(SYS_auditsys, x0 + BSM_GETAUDIT, x0); FAIL;
877}
878
879__attribute__((noinline))
880static void sys_auditsys4(void)
881{
882   GO(SYS_auditsys, "(BSM_SETAUDIT) 2s 1m");
883   SY(SYS_auditsys, x0 + BSM_SETAUDIT, x0); FAIL;
884}
885
886__attribute__((noinline))
887static void sys_auditsys5(void)
888{
889   GO(SYS_auditsys, "(BSM_AUDIT) 3s 1m");
890   /* The following syscall can succeed if auditing is not enabled. */
891   SY(SYS_auditsys, x0 + BSM_AUDIT, x0, x0 + 1); /*FAIL;*/
892}
893
894__attribute__((noinline))
895static void sys_auditsys6(void)
896{
897   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETPOLICY) 3s 1m");
898   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETPOLICY, x0); FAIL;
899}
900
901__attribute__((noinline))
902static void sys_auditsys7(void)
903{
904   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETPOLICY) 3s 1m");
905   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETPOLICY, x0); FAIL;
906}
907
908__attribute__((noinline))
909static void sys_auditsys8(void)
910{
911   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETKMASK) 3s 1m");
912   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETKMASK, x0); FAIL;
913}
914
915__attribute__((noinline))
916static void sys_auditsys9(void)
917{
918   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETKMASK) 3s 1m");
919   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETKMASK, x0); FAIL;
920}
921
922__attribute__((noinline))
923static void sys_auditsys10(void)
924{
925   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETQCTRL) 3s 1m");
926   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETQCTRL, x0); FAIL;
927}
928
929__attribute__((noinline))
930static void sys_auditsys11(void)
931{
932   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETQCTRL) 3s 1m");
933   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETQCTRL, x0 + 1); FAIL;
934}
935
936__attribute__((noinline))
937static void sys_auditsys12(void)
938{
939   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETCWD) 4s 1m");
940   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETCWD, x0, x0 + 1); FAIL;
941}
942
943__attribute__((noinline))
944static void sys_auditsys13(void)
945{
946   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETCAR) 4s 1m");
947   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETCAR, x0, x0 + 1); FAIL;
948}
949
950__attribute__((noinline))
951static void sys_auditsys14(void)
952{
953   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETSTAT) 3s 1m");
954   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETSTAT, x0); FAIL;
955}
956
957__attribute__((noinline))
958static void sys_auditsys15(void)
959{
960   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETSTAT) 3s 1m");
961   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETSTAT, x0); FAIL;
962}
963
964__attribute__((noinline))
965static void sys_auditsys16(void)
966{
967   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETUMASK) 3s 1m");
968   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETUMASK, x0); FAIL;
969}
970
971__attribute__((noinline))
972static void sys_auditsys17(void)
973{
974   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETSMASK) 3s 1m");
975   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETSMASK, x0); FAIL;
976}
977
978__attribute__((noinline))
979static void sys_auditsys18(void)
980{
981   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETCOND) 3s 1m");
982   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETCOND, x0); FAIL;
983}
984
985__attribute__((noinline))
986static void sys_auditsys19(void)
987{
988   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETCOND) 3s 1m");
989   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETCOND, x0); FAIL;
990}
991
992__attribute__((noinline))
993static void sys_auditsys20(void)
994{
995   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETCLASS) 3s 0m");
996   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETCLASS, x0); FAIL;
997}
998
999__attribute__((noinline))
1000static void sys_auditsys21(void)
1001{
1002   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETCLASS) 3s 0m");
1003   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETCLASS, x0 + 1); FAIL;
1004}
1005
1006__attribute__((noinline))
1007static void sys_auditsys22(void)
1008{
1009   au_evclass_map_t classmap;
1010   classmap.ec_number = x0;
1011   classmap.ec_class = x0;
1012
1013   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETCLASS) 4s 0m");
1014   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETCLASS, &classmap); FAIL;
1015}
1016
1017__attribute__((noinline))
1018static void sys_auditsys23(void)
1019{
1020   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETPINFO) 3s 0m");
1021   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETPINFO, x0); FAIL;
1022}
1023
1024__attribute__((noinline))
1025static void sys_auditsys24(void)
1026{
1027   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETPMASK) 3s 1m");
1028   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETPMASK, x0); FAIL;
1029}
1030
1031__attribute__((noinline))
1032static void sys_auditsys25(void)
1033{
1034   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETPINFO_ADDR) 4s 0m");
1035   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETPINFO_ADDR, x0,
1036                    x0 + 1); FAIL;
1037}
1038
1039__attribute__((noinline))
1040static void sys_auditsys26(void)
1041{
1042   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETKAUDIT) 4s 1m");
1043   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETKAUDIT, x0, x0 + 1); FAIL;
1044}
1045
1046__attribute__((noinline))
1047static void sys_auditsys27(void)
1048{
1049   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETKAUDIT) 4s 1m");
1050   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETKAUDIT, x0, x0 + 1); FAIL;
1051}
1052
1053__attribute__((noinline))
1054static void sys_auditsys28(void)
1055{
1056   GO(SYS_auditsys, "(BSM_AUDITCTL,A_GETAMASK) 3s 1m");
1057   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_GETAMASK, x0); FAIL;
1058}
1059
1060__attribute__((noinline))
1061static void sys_auditsys29(void)
1062{
1063   GO(SYS_auditsys, "(BSM_AUDITCTL,A_SETAMASK) 3s 1m");
1064   SY(SYS_auditsys, x0 + BSM_AUDITCTL, x0 + A_SETAMASK, x0); FAIL;
1065}
1066
1067__attribute__((noinline))
1068static void sys_auditsys30(void)
1069{
1070   GO(SYS_auditsys, "(BSM_GETAUDIT_ADDR) 3s 1m");
1071   SY(SYS_auditsys, x0 + BSM_GETAUDIT_ADDR, x0 + 1, x0 + 1); FAIL;
1072}
1073
1074__attribute__((noinline))
1075static void sys_auditsys31(void)
1076{
1077   GO(SYS_auditsys, "(BSM_SETAUDIT_ADDR) 3s 1m");
1078   SY(SYS_auditsys, x0 + BSM_SETAUDIT_ADDR, x0, x0 + 1); FAIL;
1079}
1080
1081__attribute__((noinline))
1082static void sys_auditsys32(void)
1083{
1084   GO(SYS_auditsys, "(BSM_AUDITDOOR) 2s 0m");
1085   SY(SYS_auditsys, x0 + BSM_AUDITDOOR, x0); FAIL;
1086}
1087
1088__attribute__((noinline))
1089static void sys_timer_create(void)
1090{
1091   GO(SYS_timer_create, "3s 4m");
1092   SY(SYS_timer_create, x0, x0 + 1, x0 + 1); FAIL;
1093}
1094
1095__attribute__((noinline))
1096static void sys_timer_create2(void)
1097{
1098   struct sigevent evp;
1099   evp.sigev_notify = x0 + SIGEV_THREAD;
1100   evp.sigev_value.sival_ptr = (void *)(x0 + 1);
1101
1102   GO(SYS_timer_create, "5s 2m");
1103   SY(SYS_timer_create, x0, &evp, x0 + 1); FAIL;
1104}
1105
1106__attribute__((noinline))
1107static void sys_facl(void)
1108{
1109   GO(SYS_facl, "(SETACL) 4s 1m");
1110   SY(SYS_facl, x0 - 1, x0 + SETACL, x0 + 1, x0 + 1); FAILx(EBADF);
1111}
1112
1113__attribute__((noinline))
1114static void sys_facl2(void)
1115{
1116   GO(SYS_facl, "(GETACL) 4s 1m");
1117   SY(SYS_facl, x0 - 1, x0 + GETACL, x0 + 1, x0); FAILx(EBADF);
1118}
1119
1120__attribute__((noinline))
1121static void sys_facl3(void)
1122{
1123   GO(SYS_facl, "(GETACLCNT) 4s 0m");
1124   SY(SYS_facl, x0 - 1, x0 + GETACLCNT, x0, x0); FAILx(EBADF);
1125}
1126
1127__attribute__((noinline))
1128static void sys_facl4(void)
1129{
1130   GO(SYS_facl, "(ACE_SETACL) 4s 1m");
1131   SY(SYS_facl, x0 - 1, x0 + ACE_SETACL, x0 + 1, x0 + 1); FAILx(EBADF);
1132}
1133
1134__attribute__((noinline))
1135static void sys_facl5(void)
1136{
1137   GO(SYS_facl, "(ACE_GETACL) 4s 1m");
1138   SY(SYS_facl, x0 - 1, x0 + ACE_GETACL, x0 + 1, x0); FAILx(EBADF);
1139}
1140
1141__attribute__((noinline))
1142static void sys_facl6(void)
1143{
1144   GO(SYS_facl, "(ACE_GETACLCNT) 4s 0m");
1145   SY(SYS_facl, x0 - 1, x0 + ACE_GETACLCNT, x0, x0); FAILx(EBADF);
1146}
1147
1148__attribute__((noinline))
1149static void sys_door(void)
1150{
1151   GO(SYS_door, "(DOOR_CREATE) 4s 0m");
1152   SY(SYS_door, x0, x0, x0, x0, x0, x0 + DOOR_CREATE); SUCC;
1153}
1154
1155__attribute__((noinline))
1156static void sys_door2(void)
1157{
1158   GO(SYS_door, "(DOOR_REVOKE) 2s 0m");
1159   SY(SYS_door, x0, x0, x0, x0, x0, x0 + DOOR_REVOKE); FAIL;
1160}
1161
1162__attribute__((noinline))
1163static void sys_door3(void)
1164{
1165   GO(SYS_door, "(DOOR_INFO) 3s 1m");
1166   SY(SYS_door, x0, x0 - 1, x0, x0, x0, x0 + DOOR_INFO); FAIL;
1167}
1168
1169__attribute__((noinline))
1170static void sys_door4(void)
1171{
1172   GO(SYS_door, "(DOOR_CALL) 3s 6m");
1173   SY(SYS_door, x0 - 1, x0, x0, x0, x0, x0 + DOOR_CALL); FAILx(EBADF);
1174}
1175
1176__attribute__((noinline))
1177static void sys_door5(void)
1178{
1179   door_arg_t params;
1180   params.data_ptr = (void *)(x0 + 1);
1181   params.data_size = x0 + 1;
1182   params.desc_ptr = (void *)(x0 + 1);
1183   params.desc_num = x0 + 1;
1184   params.rbuf = (void *)(x0 + 1);
1185   params.rsize = x0 + 1;
1186
1187   GO(SYS_door, "(DOOR_CALL) 9s 2m");
1188   SY(SYS_door, x0, x0 + &params, x0, x0, x0, x0 + DOOR_CALL); FAIL;
1189}
1190
1191__attribute__((noinline))
1192static void sys_pset(void)
1193{
1194   GO(SYS_pset, "(CREATE) 2s 1m");
1195   SY(SYS_pset, x0 + PSET_CREATE, x0 + 1); FAIL;
1196}
1197
1198__attribute__((noinline))
1199static void sys_pset2(void)
1200{
1201   GO(SYS_pset, "(DESTROY) 2s 0m");
1202   SY(SYS_pset, x0 + PSET_DESTROY, x0); FAIL;
1203}
1204
1205__attribute__((noinline))
1206static void sys_pset3(void)
1207{
1208   GO(SYS_pset, "(ASSIGN) 4s 1m");
1209   SY(SYS_pset, x0 + PSET_ASSIGN, x0 + 1, x0 + 1, x0 + 1); FAIL;
1210}
1211
1212__attribute__((noinline))
1213static void sys_pset4(void)
1214{
1215   GO(SYS_pset, "(INFO) 5s 3m");
1216   SY(SYS_pset, x0 + PSET_INFO, x0 + 1, x0 + 1, x0 + 1, x0 + 1); FAIL;
1217}
1218
1219__attribute__((noinline))
1220static void sys_pset5(void)
1221{
1222   int type;
1223   uint_t numcpus = x0 + 1;
1224
1225   GO(SYS_pset, "(INFO) 5s 1m");
1226   SY(SYS_pset, x0 + PSET_INFO, x0 + 1, x0 + &type, x0 + &numcpus,
1227      x0 + 1); FAIL;
1228}
1229
1230__attribute__((noinline))
1231static void sys_pset6(void)
1232{
1233   GO(SYS_pset, "(BIND) 5s 1m");
1234   SY(SYS_pset, x0 + PSET_BIND, x0 + 1, x0 + 1, x0 + 1, x0 + 1); FAIL;
1235}
1236
1237__attribute__((noinline))
1238static void sys_pset7(void)
1239{
1240   GO(SYS_pset, "(BIND_LWP) 5s 1m");
1241   SY(SYS_pset, x0 + PSET_BIND_LWP, x0 + 1, x0 + 1, x0 + 1, x0 + 1); FAIL;
1242}
1243
1244__attribute__((noinline))
1245static void sys_pset8(void)
1246{
1247   GO(SYS_pset, "(GETLOADAVG) 4s 1m");
1248   SY(SYS_pset, x0 + PSET_GETLOADAVG, x0 + 1, x0 + 1, x0 + 1); FAIL;
1249}
1250
1251__attribute__((noinline))
1252static void sys_pset9(void)
1253{
1254   GO(SYS_pset, "(LIST) 3s 1m");
1255   SY(SYS_pset, x0 + PSET_LIST, x0 + 1, x0 + 1); FAIL;
1256}
1257
1258__attribute__((noinline))
1259static void sys_pset10(void)
1260{
1261   uint_t numpsets = x0 + 1;
1262
1263   GO(SYS_pset, "(LIST) 3s 1m");
1264   SY(SYS_pset, x0 + PSET_LIST, x0 + 1, x0 + &numpsets);
1265}
1266
1267__attribute__((noinline))
1268static void sys_pset11(void)
1269{
1270   GO(SYS_pset, "(SETATTR) 3s 0m");
1271   SY(SYS_pset, x0 + PSET_SETATTR, x0, x0); FAIL;
1272}
1273
1274__attribute__((noinline))
1275static void sys_pset12(void)
1276{
1277   GO(SYS_pset, "(GETATTR) 3s 1m");
1278   SY(SYS_pset, x0 + PSET_GETATTR, x0, x0 + 1); FAIL;
1279}
1280
1281__attribute__((noinline))
1282static void sys_pset13(void)
1283{
1284   GO(SYS_pset, "(ASSIGN_FORCED) 4s 1m");
1285   SY(SYS_pset, x0 + PSET_ASSIGN_FORCED, x0 + 1, x0 + 1, x0 + 1); FAIL;
1286}
1287
1288__attribute__((noinline))
1289static void sys_lwp_rwlock(void)
1290{
1291   GO(SYS_lwp_rwlock_sys, "(RDLOCK) 3s 8m");
1292   SY(SYS_lwp_rwlock_sys, x0, x0, x0 + 1); FAIL;
1293}
1294
1295__attribute__((noinline))
1296static void sys_lwp_rwlock2(void)
1297{
1298   GO(SYS_lwp_rwlock_sys, "(WRLOCK) 3s 8m");
1299   SY(SYS_lwp_rwlock_sys, x0 + 1, x0, x0 + 1); FAIL;
1300}
1301
1302__attribute__((noinline))
1303static void sys_lwp_rwlock3(void)
1304{
1305   GO(SYS_lwp_rwlock_sys, "(TRYRDLOCK) 2s 7m");
1306   SY(SYS_lwp_rwlock_sys, x0 + 2, x0); FAIL;
1307}
1308
1309__attribute__((noinline))
1310static void sys_lwp_rwlock4(void)
1311{
1312   GO(SYS_lwp_rwlock_sys, "(TRYWRLOCK) 2s 7m");
1313   SY(SYS_lwp_rwlock_sys, x0 + 3, x0); FAIL;
1314}
1315
1316__attribute__((noinline))
1317static void sys_lwp_rwlock5(void)
1318{
1319   GO(SYS_lwp_rwlock_sys, "(UNLOCK) 2s 2m");
1320   SY(SYS_lwp_rwlock_sys, x0 + 4, x0); FAIL;
1321}
1322
1323__attribute__((noinline))
1324static void sys_zone(void)
1325{
1326   GO(SYS_zone, "(ZONE_CREATE) 2s 12m");
1327   SY(SYS_zone, x0 + ZONE_CREATE, x0); FAIL;
1328}
1329
1330__attribute__((noinline))
1331static void sys_zone2(void)
1332{
1333   zone_def zd;
1334   zd.zone_name = (void *)(x0 + 1);
1335   zd.zone_root = (void *)(x0 + 1);
1336   zd.zone_privs = (void *)x0;
1337   zd.zone_privssz = x0 + 1;
1338   zd.rctlbuf = (void *)x0;
1339   zd.rctlbufsz = x0 + 1;
1340   zd.extended_error = (void *)x0;
1341   zd.zfsbuf = (void *)x0;
1342   zd.zfsbufsz = x0 + 1;
1343   zd.match = x0;
1344   zd.doi = x0;
1345   zd.label = (void *)(x0 + 1);
1346   zd.flags = x0;
1347
1348   GO(SYS_zone, "(create) 2s 19m");
1349   SY(SYS_zone, x0 + ZONE_CREATE, x0 + &zd); FAIL;
1350}
1351
1352__attribute__((noinline))
1353static void sys_zone3(void)
1354{
1355   GO(SYS_zone, "(ZONE_DESTROY) 2s 0m");
1356   SY(SYS_zone, x0 + ZONE_DESTROY, x0); FAIL;
1357}
1358
1359__attribute__((noinline))
1360static void sys_zone4(void)
1361{
1362   GO(SYS_zone, "(ZONE_GETATTR) 5s 1m");
1363   SY(SYS_zone, x0 + ZONE_GETATTR, x0, x0, x0, x0 + 1); FAIL;
1364}
1365
1366__attribute__((noinline))
1367static void sys_zone5(void)
1368{
1369   GO(SYS_zone, "(ZONE_ENTER) 2s 0m");
1370   SY(SYS_zone, x0 + ZONE_ENTER, x0); FAIL;
1371}
1372
1373__attribute__((noinline))
1374static void sys_zone6(void)
1375{
1376   GO(SYS_zone, "(ZONE_LIST) 3s 1m");
1377   SY(SYS_zone, x0 + ZONE_LIST, x0 + 1, x0 + 1); FAIL;
1378}
1379
1380__attribute__((noinline))
1381static void sys_zone7(void)
1382{
1383   uint_t numzones = x0 + 1;
1384
1385   GO(SYS_zone, "(ZONE_LIST) 3s 1m");
1386   SY(SYS_zone, x0 + ZONE_LIST, x0 + 1, x0 + &numzones); FAIL;
1387}
1388
1389__attribute__((noinline))
1390static void sys_zone8(void)
1391{
1392   GO(SYS_zone, "(ZONE_SHUTDOWN) 2s 0m");
1393   SY(SYS_zone, x0 + ZONE_SHUTDOWN, x0); FAIL;
1394}
1395
1396__attribute__((noinline))
1397static void sys_zone9(void)
1398{
1399   GO(SYS_zone, "(ZONE_LOOKUP) 2s 1m");
1400   SY(SYS_zone, x0 + ZONE_LOOKUP, x0 + 1); FAIL;
1401}
1402
1403__attribute__((noinline))
1404static void sys_zone10(void)
1405{
1406   GO(SYS_zone, "(ZONE_BOOT) 2s 0m");
1407   SY(SYS_zone, x0 + ZONE_BOOT, x0); FAIL;
1408}
1409
1410__attribute__((noinline))
1411static void sys_zone11(void)
1412{
1413   GO(SYS_zone, "(ZONE_SETATTR) 5s 1m");
1414   SY(SYS_zone, x0 + ZONE_SETATTR, x0, x0, x0, x0 + 1); FAIL;
1415}
1416
1417__attribute__((noinline))
1418static void sys_zone12(void)
1419{
1420   GO(SYS_zone, "(ZONE_ADD_DATALINK) 3s 0m");
1421   SY(SYS_zone, x0 + ZONE_ADD_DATALINK, x0, x0); FAIL;
1422}
1423
1424__attribute__((noinline))
1425static void sys_zone13(void)
1426{
1427   GO(SYS_zone, "(ZONE_DEL_DATALINK) 3s 0m");
1428   SY(SYS_zone, x0 + ZONE_DEL_DATALINK, x0, x0); FAIL;
1429}
1430
1431__attribute__((noinline))
1432static void sys_zone14(void)
1433{
1434   GO(SYS_zone, "(ZONE_CHECK_DATALINK) 3s 1m");
1435   SY(SYS_zone, x0 + ZONE_CHECK_DATALINK, x0, x0); FAIL;
1436}
1437
1438__attribute__((noinline))
1439static void sys_zone15(void)
1440{
1441   GO(SYS_zone, "(ZONE_LIST_DATALINK) 4s 1m");
1442   SY(SYS_zone, x0 + ZONE_LIST_DATALINK, x0, x0 + 1, x0 + 1); FAIL;
1443}
1444
1445__attribute__((noinline))
1446static void sys_zone16(void)
1447{
1448   int dlnum = x0 + 1;
1449
1450   GO(SYS_zone, "(ZONE_LIST_DATALINK) 4s 1m");
1451   SY(SYS_zone, x0 + ZONE_LIST_DATALINK, x0, x0 + &dlnum, x0 + 1); FAIL;
1452}
1453
1454__attribute__((noinline))
1455static void sys_getpeername(void)
1456{
1457   GO(SYS_getpeername, "4s 1m");
1458   SY(SYS_getpeername, x0 - 1, x0 + 1, x0, x0); FAILx(EBADF);
1459}
1460
1461__attribute__((noinline))
1462static void sys_getpeername2(void)
1463{
1464   socklen_t size = x0 + 10;
1465
1466   GO(SYS_getpeername, "4s 1m");
1467   SY(SYS_getpeername, x0 - 1, x0 + 1, &size, x0); FAILx(EBADF);
1468}
1469
1470int main(void)
1471{
1472   /* Uninitialised, but we know px[0] is 0x0. */
1473   long *px = malloc(sizeof(long));
1474   x0 = px[0];
1475
1476   /* SYS_syscall                 0 */
1477   /* SPARC only. */
1478
1479   /* SYS_exit                    1 */
1480   /* Tested below. */
1481
1482   /* SYS_read                    3 */
1483   GO(SYS_read, "3s 0m");
1484   SY(SYS_read, x0 - 1, x0, x0 + 1); FAILx(EBADF);
1485   /* Note that above should be preferably "3s 1m" test.. */
1486
1487   /* SYS_write                   4 */
1488   GO(SYS_write, "3s 1m");
1489   SY(SYS_write, x0 + 1, x0, x0 + 1); FAIL;
1490
1491   /* SYS_open                    5 */
1492   /* Tested in scalar_obsolete.c. */
1493
1494   /* SYS_close                   6 */
1495   GO(SYS_close, "1s 0m");
1496   SY(SYS_close, x0 - 1); FAILx(EBADF);
1497
1498   /* SYS_linkat                  7 */
1499   GO(SYS_linkat, "5s 2m");
1500   SY(SYS_linkat, x0 - 1, x0 + 1, x0 - 1, x0 + 1, x0); FAIL;
1501
1502   /* SYS_link                    9 */
1503   /* Tested in scalar_obsolete.c. */
1504
1505   /* SYS_unlink                 10 */
1506   /* Tested in scalar_obsolete.c. */
1507
1508   /* SYS_symlinkat              11 */
1509   GO(SYS_symlinkat, "3s 2m");
1510   SY(SYS_symlinkat, x0 + 1, x0 - 1, x0 + 1); FAIL;
1511
1512   /* SYS_chdir                  12 */
1513   GO(SYS_chdir, "1s 1m");
1514   SY(SYS_chdir, x0); FAIL;
1515
1516   /* SYS_time                   13 */
1517   GO(SYS_time, "0s 0m");
1518   SY(SYS_time); SUCC;
1519
1520   /* SYS_mknod                  14 */
1521   /* Tested in scalar_obsolete.c. */
1522
1523   /* SYS_chmod                  15 */
1524   /* Tested in scalar_obsolete.c. */
1525
1526   /* SYS_chown                  16 */
1527   /* Tested in scalar_obsolete.c. */
1528
1529   /* SYS_brk                    17 */
1530   GO(SYS_brk, "1s 0m");
1531   SY(SYS_brk, x0); SUCC;
1532
1533   /* SYS_stat                   18 */
1534   /* Tested in scalar_obsolete.c. */
1535
1536   /* SYS_lseek                  19 */
1537   GO(SYS_lseek, "3s 0m");
1538   SY(SYS_lseek, x0 - 1, x0, x0); FAILx(EBADF);
1539
1540   /* SYS_getpid                 20 */
1541   GO(SYS_getpid, "0s 0m");
1542   SY(SYS_getpid); SUCC;
1543
1544   /* SYS_mount                  21 */
1545   sys_mount();
1546   sys_mount2();
1547   sys_mount3();
1548   sys_mount4();
1549
1550   /* SYS_readlinkat             22 */
1551   GO(SYS_readlinkat, "4s 2m");
1552   SY(SYS_readlinkat, x0 - 1, x0, x0, x0 + 1); FAIL;
1553
1554   /* SYS_setuid                 23 */
1555   GO(SYS_setuid, "1s 0m");
1556   SY(SYS_setuid, x0 - 1); FAIL;
1557
1558   /* SYS_getuid                 24 */
1559   GO(SYS_getuid, "0s 0m");
1560   SY(SYS_getuid); SUCC;
1561
1562   /* SYS_stime                  25 */
1563   GO(SYS_stime, "1s 0m");
1564   SY(SYS_stime, x0); FAIL;
1565
1566   /* SYS_pcsample               26 */
1567   /* XXX Missing wrapper. */
1568
1569   /* SYS_alarm                  27 */
1570   GO(SYS_alarm, "1s 0m");
1571   SY(SYS_alarm, x0); SUCC;
1572
1573   /* SYS_fstat                  28 */
1574   /* Tested in scalar_obsolete.c. */
1575
1576   /* SYS_pause                  29 */
1577   /* Don't bother to test this. */
1578   GO(SYS_pause, "ignore");
1579
1580   /* SYS_stty                   31 */
1581   GO(SYS_stty, "2s 1m");
1582   SY(SYS_stty, x0 - 1, x0 + 1); FAIL;
1583
1584   /* SYS_gtty                   32 */
1585   GO(SYS_gtty, "2s 1m");
1586   SY(SYS_gtty, x0 - 1, x0 + 1); FAIL;
1587
1588   /* SYS_access                 33 */
1589   /* Tested in scalar_obsolete.c. */
1590
1591   /* SYS_nice                   34 */
1592   /* XXX Missing wrapper. */
1593
1594   /* SYS_statfs                 35 */
1595   /* XXX Missing wrapper. */
1596
1597   /* SYS_sync                   36 */
1598   /* XXX Missing wrapper. */
1599
1600   /* SYS_kill                   37 */
1601   GO(SYS_kill, "2s 0m");
1602   SY(SYS_kill, x0, x0); SUCC;
1603
1604   /* SYS_fstatfs                38 */
1605   /* XXX Missing wrapper. */
1606
1607   /* SYS_pgrpsys                39 */
1608   sys_pgrpsys();
1609   sys_pgrpsys2();
1610   sys_pgrpsys3();
1611
1612   /* SYS_uucopystr              40 */
1613   /* XXX Missing wrapper. */
1614
1615   /* SYS_pipe                   42 */
1616   /* Don't bother to test this. */
1617   GO(SYS_pipe, "ignore");
1618
1619   /* SYS_times                  43 */
1620   GO(SYS_times, "1s 1m");
1621   SY(SYS_times, x0 + 1); FAIL;
1622
1623   /* SYS_profil                 44 */
1624   /* XXX Missing wrapper. */
1625
1626   /* SYS_faccessat              45 */
1627   GO(SYS_faccessat, "4s 1m");
1628   SY(SYS_faccessat, x0 - 1, x0 + 1, x0, x0); FAIL;
1629
1630   /* SYS_setgid                 46 */
1631   GO(SYS_setgid, "1s 0m");
1632   SY(SYS_setgid, x0 - 1); FAIL;
1633
1634   /* SYS_getgid                 47 */
1635   GO(SYS_getgid, "0s 0m");
1636   SY(SYS_getgid); SUCC;
1637
1638   /* SYS_mknodat                48 */
1639   GO(SYS_mknodat, "4s 1m");
1640   SY(SYS_mknodat, x0 - 1, x0 + 1, x0, x0); FAIL;
1641
1642   /* SYS_msgsys                 49 */
1643   /* XXX Missing wrapper. */
1644
1645   /* SYS_sysi86                 50 */
1646   /* TODO Add test. */
1647   GO(SYS_sysi86, "incoming");
1648
1649   /* SYS_acct                   51 */
1650   /* XXX Missing wrapper. */
1651
1652   /* SYS_shmsys                 52 */
1653   sys_shmsys();
1654   sys_shmsys2();
1655   sys_shmsys3();
1656   sys_shmsys4();
1657   sys_shmsys5();
1658   sys_shmsys6();
1659   sys_shmsys7();
1660   sys_shmsys8();
1661   sys_shmsys9();
1662   sys_shmsys10();
1663   sys_shmsys11();
1664   sys_shmsys12();
1665   sys_shmsys13();
1666
1667   /* SYS_semsys                 53 */
1668   sys_semsys();
1669   sys_semsys2();
1670   sys_semsys3();
1671   sys_semsys4();
1672   sys_semsys5();
1673   sys_semsys6();
1674   sys_semsys7();
1675   sys_semsys8();
1676   sys_semsys9();
1677   sys_semsys10();
1678   sys_semsys11();
1679   sys_semsys12();
1680   sys_semsys13();
1681   sys_semsys14();
1682   sys_semsys15();
1683   sys_semsys16();
1684
1685   /* SYS_ioctl                  54 */
1686   GO(SYS_ioctl, "3s 1m");
1687   SY(SYS_ioctl, x0, x0 + TCGETS, x0); FAIL;
1688
1689   /* SYS_uadmin                 55 */
1690   /* XXX Missing wrapper. */
1691
1692   /* SYS_fchownat               56 */
1693   GO(SYS_fchownat, "5s 1m");
1694   SY(SYS_fchownat, x0 - 1, x0 + 1, x0, x0, x0); FAIL;
1695
1696   /* SYS_utssys                 57 */
1697   /* XXX Missing wrapper. */
1698
1699   /* SYS_fdsync                 58 */
1700   GO(SYS_fdsync, "2s 0m");
1701   SY(SYS_fdsync, x0 - 1, x0); FAILx(EBADF);
1702
1703   /* SYS_execve                 59 */
1704   /* illumos ignores the fourth argument. */
1705   GO(SYS_execve, "3s 1m");
1706   SY(SYS_execve, x0, x0, x0, 0); FAIL;
1707   /* More cases tested in execx.c */
1708
1709   /* SYS_umask                  60 */
1710   GO(SYS_umask, "1s 0m");
1711   SY(SYS_umask, x0 + 022); SUCC;
1712
1713   /* SYS_chroot                 61 */
1714   GO(SYS_chroot, "1s 1m");
1715   SY(SYS_chroot, x0 + 1); FAIL;
1716
1717   /* SYS_fcntl                  62 */
1718   sys_fcntl();
1719   sys_fcntl2();
1720   sys_fcntl3();
1721
1722   /* SYS_ulimit                 63 */
1723   /* XXX Missing wrapper. */
1724
1725   /* SYS_renameat               64 */
1726   GO(SYS_renameat, "4s 2m");
1727   SY(SYS_renameat, x0 - 1, x0, x0, x0); FAIL;
1728
1729   /* SYS_unlinkat               65 */
1730   GO(SYS_unlinkat, "3s 1m");
1731   SY(SYS_unlinkat, x0 - 1, x0, x0); FAIL;
1732
1733   /* SYS_fstatat                66 */
1734   GO(SYS_fstatat, "4s 2m");
1735   SY(SYS_fstatat, x0 - 1, x0 + 1, x0, x0); FAIL;
1736
1737   /* SYS_fstatat64              67 */
1738   /* Tested in x86-solaris/scalar.c. */
1739
1740   /* SYS_openat                 68 */
1741   sys_openat();
1742   sys_openat2();
1743
1744   /* SYS_openat64               69 */
1745   /* Tested in x86-solaris/scalar.c. */
1746
1747   /* SYS_tasksys                70 */
1748   sys_tasksys();
1749   sys_tasksys2();
1750   sys_tasksys3();
1751   sys_tasksys4();
1752
1753   /* SYS_acctctl                71 */
1754   /* XXX Missing wrapper. */
1755
1756   /* SYS_exacctsys              72 */
1757   /* XXX Missing wrapper. */
1758
1759   /* SYS_getpagesizes           73 */
1760   GO(SYS_getpagesizes, "3s 1m");
1761   SY(SYS_getpagesizes, x0, x0 + 1, x0 + 1); FAIL;
1762
1763   /* SYS_rctlsys                74 */
1764   /* XXX Missing wrapper. */
1765
1766   /* SYS_sidsys                 75 */
1767   /* XXX Missing wrapper. */
1768
1769   /* SYS_lwp_park               77 */
1770   /* Don't bother to test this. */
1771   GO(SYS_lwp_park, "ignore");
1772
1773   /* SYS_sendfilev              78 */
1774   sys_sendfilev();
1775   sys_sendfilev2();
1776   sys_sendfilev3();
1777   sys_sendfilev4();
1778
1779   /* SYS_rmdir                  79 */
1780   /* Tested in scalar_obsolete.c. */
1781
1782   /* SYS_mkdir                  80 */
1783   /* Tested in scalar_obsolete.c. */
1784
1785   /* SYS_getdents               81 */
1786   GO(SYS_getdents, "3s 1m");
1787   SY(SYS_getdents, x0, x0, x0 + 1); FAIL;
1788
1789   /* SYS_Privsys                82 */
1790   sys_privsys();
1791   sys_privsys2();
1792   sys_privsys3();
1793   sys_privsys4();
1794   sys_privsys5();
1795   sys_privsys6();
1796   sys_privsys7();
1797   sys_privsys8();
1798
1799   /* SYS_ucredsys               83 */
1800   sys_ucredsys();
1801   sys_ucredsys2();
1802
1803   /* SYS_sysfs                  84 */
1804   /* XXX Missing wrapper. */
1805
1806   /* SYS_getmsg                 85 */
1807   GO(SYS_getmsg, "4s 1m");
1808   SY(SYS_getmsg, x0, x0, x0, x0); FAIL;
1809
1810   /* SYS_putmsg                 86 */
1811   GO(SYS_putmsg, "4s 0m");
1812   SY(SYS_putmsg, x0, x0, x0, x0);
1813
1814   /* SYS_lstat                  88 */
1815   /* Tested in scalar_obsolete.c. */
1816
1817   /* SYS_symlink                89 */
1818   /* Tested in scalar_obsolete.c. */
1819
1820   /* SYS_readlink               90 */
1821   /* Tested in scalar_obsolete.c. */
1822
1823   /* SYS_setgroups              91 */
1824   GO(SYS_setgroups, "2s 1m");
1825   SY(SYS_setgroups, x0 + 1, x0 + 1); FAIL;
1826
1827   /* SYS_getgroups              92 */
1828   GO(SYS_getgroups, "2s 1m");
1829   SY(SYS_getgroups, x0 + 1, x0 + 1); FAIL;
1830
1831   /* SYS_fchmod                 93 */
1832   /* Tested in scalar_obsolete.c. */
1833
1834   /* SYS_fchown                 94 */
1835   /* Tested in scalar_obsolete.c. */
1836
1837   /* SYS_sigprocmask            95 */
1838   GO(SYS_sigprocmask, "3s 2m");
1839   SY(SYS_sigprocmask, x0, x0 + 1, x0 + 1); FAILx(EFAULT);
1840
1841   /* SYS_sigsuspend             96 */
1842   /* XXX Missing wrapper. */
1843
1844   /* SYS_sigaltstack            97 */
1845   GO(SYS_sigaltstack, "2s 2m");
1846   SY(SYS_sigaltstack, x0 + 1, x0 + 1); FAILx(EFAULT);
1847
1848   /* SYS_sigaction              98 */
1849   GO(SYS_sigaction, "3s 4m");
1850   SY(SYS_sigaction, x0, x0 + 1, x0 + 1); FAILx(EFAULT);
1851
1852   /* SYS_sigpending             99 */
1853   GO(SYS_sigpending, "2s 1m");
1854   SY(SYS_sigpending, x0, x0 + 1);
1855
1856   /* SYS_context               100 */
1857   sys_context();
1858   sys_context2();
1859   sys_context3();
1860   sys_context4();
1861
1862   /* SYS_fchmodat              101 */
1863   GO(SYS_fchmodat, "4s 1m");
1864   SY(SYS_fchmodat, x0 - 1, x0 + 1, x0, x0); FAIL;
1865
1866   /* SYS_mkdirat               102 */
1867   GO(SYS_mkdirat, "3s 1m");
1868   SY(SYS_mkdirat, x0 - 1, x0, x0); FAIL;
1869
1870   /* SYS_statvfs               103 */
1871   sys_statvfs();
1872   sys_statvfs2();
1873
1874   /* SYS_fstatvfs              104 */
1875   GO(SYS_fstatvfs, "2s 1m");
1876   SY(SYS_fstatvfs, x0 - 1, x0 + 1); FAILx(EBADF);
1877
1878   /* SYS_getloadavg            105 */
1879   /* XXX Missing wrapper. */
1880
1881   /* SYS_nfssys                106 */
1882   sys_nfssys();
1883   /* :TODO: Add test cases when other opcodes are implemented. */
1884
1885   /* SYS_waitid                107 */
1886   GO(SYS_waitid, "4s 1m");
1887   SY(SYS_waitid, x0 - 1, x0, x0, x0); FAIL;
1888
1889   /* SYS_sigsendsys            108 */
1890   /* XXX Missing wrapper. */
1891
1892   /* SYS_hrtsys                109 */
1893   /* XXX Missing wrapper. */
1894
1895   /* SYS_utimesys              110 */
1896   /* SYS_utimensat             110 */
1897   /* Tested in scalar_utimesys and scalar_utimensat. */
1898
1899   /* SYS_sigresend             111 */
1900   GO(SYS_sigresend, "3s 2m");
1901   SY(SYS_sigresend, x0, x0 + 1, x0); FAIL;
1902
1903   /* SYS_priocntlsys           112 */
1904   sys_priocntlsys();
1905   sys_priocntlsys2();
1906   sys_priocntlsys3();
1907   sys_priocntlsys4();
1908   sys_priocntlsys5();
1909   sys_priocntlsys6();
1910   sys_priocntlsys7();
1911   sys_priocntlsys8();
1912   sys_priocntlsys9();
1913   sys_priocntlsys10();
1914   sys_priocntlsys11();
1915
1916   /* SYS_pathconf              113 */
1917   GO(SYS_pathconf, "2s 1m");
1918   SY(SYS_pathconf, x0, x0); FAIL;
1919
1920   /* SYS_mincore               114 */
1921   /* XXX Missing wrapper. */
1922
1923   /* SYS_mmap                  115 */
1924   GO(SYS_mmap, "6s 0m");
1925   SY(SYS_mmap, x0, x0, x0, x0, x0, x0); FAILx(EINVAL);
1926
1927   /* SYS_mprotect              116 */
1928   GO(SYS_mprotect, "3s 0m");
1929   SY(SYS_mprotect, x0, x0, x0); FAILx(EINVAL);
1930
1931   /* SYS_munmap                117 */
1932   GO(SYS_munmap, "2s 0m");
1933   SY(SYS_munmap, x0, x0); FAILx(EINVAL);
1934
1935   /* SYS_fpathconf             118 */
1936   /* XXX Missing wrapper. */
1937
1938   /* SYS_vfork                 119 */
1939   /* XXX Missing wrapper. */
1940
1941   /* SYS_fchdir                120 */
1942   GO(SYS_fchdir, "1s 0m");
1943   SY(SYS_fchdir, x0 - 1); FAILx(EBADF);
1944
1945   /* SYS_readv                 121 */
1946   GO(SYS_readv, "3s 1m");
1947   SY(SYS_readv, x0, x0, x0 + 1); FAIL;
1948
1949   /* SYS_writev                122 */
1950   GO(SYS_writev, "3s 1m");
1951   SY(SYS_writev, x0, x0, x0 + 1); FAIL;
1952
1953   /* SYS_mmapobj               127 */
1954   GO(SYS_mmapobj, "5s 2m");
1955   SY(SYS_mmapobj, x0 - 1, x0 | MMOBJ_PADDING, x0, x0, x0); FAILx(EBADF);
1956
1957   /* SYS_setrlimit             128 */
1958   GO(SYS_setrlimit, "2s 1m");
1959   SY(SYS_setrlimit, x0, x0); FAIL;
1960
1961   /* SYS_getrlimit             129 */
1962   GO(SYS_getrlimit, "2s 1m");
1963   SY(SYS_getrlimit, x0, x0); FAIL;
1964
1965   /* SYS_lchown                130 */
1966   /* Tested in scalar_obsolete.c. */
1967
1968   /* SYS_memcntl               131 */
1969   GO(SYS_memcntl, "6s 1m");
1970   SY(SYS_memcntl, x0, x0, x0 | MC_HAT_ADVISE, x0, x0, x0); FAIL;
1971
1972   /* SYS_getpmsg               132 */
1973   GO(SYS_getpmsg, "5s 2m");
1974   SY(SYS_getpmsg, x0, x0, x0, x0, x0); FAIL;
1975
1976   /* SYS_putpmsg               133 */
1977   GO(SYS_putpmsg, "5s 0m");
1978   SY(SYS_putpmsg, x0, x0, x0, x0, x0); FAIL;
1979
1980   /* SYS_rename                134 */
1981   /* Tested in scalar_obsolete.c. */
1982
1983   /* SYS_uname                 135 */
1984   sys_uname();
1985   sys_uname2();
1986
1987   /* SYS_setegid               136 */
1988   GO(SYS_setegid, "1s 0m");
1989   SY(SYS_setegid, x0 - 1); FAIL;
1990
1991   /* SYS_sysconfig             137 */
1992   GO(SYS_sysconfig, "1s 0m");
1993   SY(SYS_sysconfig, x0 - 1); FAIL;
1994
1995   /* SYS_adjtime               138 */
1996   /* XXX Missing wrapper. */
1997
1998   /* SYS_systeminfo            139 */
1999   GO(SYS_systeminfo, "3s 1m");
2000   SY(SYS_systeminfo, x0 + 1, x0, x0 + 1); FAIL;
2001
2002   /* SYS_sharefs               140 */
2003   /* XXX Missing wrapper. */
2004
2005   /* SYS_seteuid               141 */
2006   GO(SYS_seteuid, "1s 0m");
2007   SY(SYS_seteuid, x0 - 1); FAIL;
2008
2009   /* SYS_forksys               142 */
2010   GO(SYS_forksys, "2s 0m");
2011   SY(SYS_forksys, x0, x0 - 1); FAIL;
2012
2013   /* SYS_sigtimedwait          144 */
2014   GO(SYS_sigtimedwait, "3s 3m");
2015   SY(SYS_sigtimedwait, x0 - 1, x0 - 1, x0 - 1); FAIL;
2016
2017   /* SYS_lwp_info              145 */
2018   /* XXX Missing wrapper. */
2019
2020   /* SYS_yield                 146 */
2021   GO(SYS_yield, "0s 0m");
2022   SY(SYS_yield); SUCC;
2023
2024   /* SYS_lwp_sema_post         148 */
2025   GO(SYS_lwp_sema_post, "1s 3m");
2026   SY(SYS_lwp_sema_post, x0); FAIL;
2027
2028   /* SYS_lwp_sema_trywait      149 */
2029   /* XXX Missing wrapper. */
2030
2031   /* SYS_lwp_detach            150 */
2032   GO(SYS_lwp_detach, "1s 0m");
2033   SY(SYS_lwp_detach, x0); FAIL;
2034
2035   /* SYS_corectl               151 */
2036   /* XXX Missing wrapper. */
2037
2038   /* SYS_modctl                152 */
2039   /* XXX Missing wrapper. */
2040
2041   /* SYS_fchroot               153 */
2042   GO(SYS_fchroot, "1s 0m");
2043   SY(SYS_fchroot, x0 - 1); FAILx(EBADF);
2044
2045   /* SYS_vhangup               155 */
2046   /* XXX Missing wrapper. */
2047
2048   /* SYS_gettimeofday          156 */
2049   GO(SYS_gettimeofday, "1s 1m");
2050   SY(SYS_gettimeofday, x0 + 1); FAIL;
2051
2052   /* SYS_getitimer             157 */
2053   GO(SYS_getitimer, "2s 2m");
2054   SY(SYS_getitimer, x0, x0 + 1); FAIL;
2055
2056   /* SYS_setitimer             158 */
2057   GO(SYS_setitimer, "3s 4m");
2058   SY(SYS_setitimer, x0, x0 + 1, x0 + 1); FAIL;
2059
2060   /* SYS_lwp_create            159 */
2061   /* In the lwp_create() wrapper, we unfortunately have to call
2062      ML_(safe_to_deref) before doing the PRE_READ_*() stuff, therefore only 1m
2063      parameter. */
2064   GO(SYS_lwp_create, "3s 1m");
2065   SY(SYS_lwp_create, x0, x0, x0 + 1); FAILx(EINVAL);
2066
2067   /* SYS_lwp_exit              160 */
2068   /* Don't bother to test this. */
2069   GO(SYS_lwp_exit, "ignore");
2070
2071   /* SYS_lwp_suspend           161 */
2072   GO(SYS_lwp_suspend, "1s 0m");
2073   SY(SYS_lwp_suspend, x0 - 1); FAIL;
2074
2075   /* SYS_lwp_continue          162 */
2076   GO(SYS_lwp_continue, "1s 0m");
2077   SY(SYS_lwp_continue, x0 - 1); FAIL;
2078
2079   /* SYS_lwp_kill              163 */
2080   /* SYS_lwp_sigqueue          163 */
2081   /* Tested in scalar_lwp_kill and scalar_lwp_sigqueue. */
2082
2083   /* SYS_lwp_self              164 */
2084   GO(SYS_lwp_self, "0s 0m");
2085   SY(SYS_lwp_self); SUCC;
2086
2087   /* SYS_lwp_sigmask           165 */
2088   GO(SYS_lwp_sigmask, "5s 0m");
2089   SY(SYS_lwp_sigmask, x0, x0, x0, x0, x0); FAIL;
2090
2091   /* SYS_lwp_private           166 */
2092   GO(SYS_lwp_private, "3s 1m");
2093#if defined(__i386)
2094   SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_GSBASE, x0); FAIL;
2095#elif defined(__amd64)
2096   SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_FSBASE, x0); FAIL;
2097#else
2098#error Unsupported platform
2099#endif
2100
2101   /* SYS_lwp_wait              167 */
2102   GO(SYS_lwp_wait, "2s 1m");
2103   SY(SYS_lwp_wait, x0 - 1, x0 + 1); FAIL;
2104
2105   /* SYS_lwp_mutex_wakeup      168 */
2106   GO(SYS_lwp_mutex_wakeup, "2s 2m");
2107   SY(SYS_lwp_mutex_wakeup, x0, x0); FAIL;
2108
2109   /* SYS_lwp_cond_wait         170 */
2110   GO(SYS_lwp_cond_wait, "4s 5m");
2111   SY(SYS_lwp_cond_wait, x0 + 1, x0 + 1, x0 + 1, x0); FAIL;
2112
2113   /* SYS_lwp_cond_signal       171 */
2114   /* XXX Missing wrapper. */
2115
2116   /* SYS_lwp_cond_broadcast    172 */
2117   GO(SYS_lwp_cond_broadcast, "1s 2m");
2118   SY(SYS_lwp_cond_broadcast, x0); FAIL;
2119
2120   /* SYS_pread                 173 */
2121   GO(SYS_pread, "4s 1m");
2122   SY(SYS_pread, x0 - 1, x0, x0 + 1, x0); FAILx(EBADF);
2123
2124   /* SYS_pwrite                174 */
2125   GO(SYS_pwrite, "4s 1m");
2126   SY(SYS_pwrite, x0 - 1, x0, x0 + 1, x0); FAILx(EBADF);
2127
2128   /* SYS_llseek                175 */
2129   /* Tested in x86-solaris/scalar.c. */
2130
2131   /* SYS_inst_sync             176 */
2132   /* XXX Missing wrapper. */
2133
2134   /* SYS_brand                 177 */
2135   /* XXX Missing wrapper. */
2136
2137   /* SYS_kaio                  178 */
2138   /* XXX Missing wrapper. */
2139
2140   /* SYS_cpc                   179 */
2141   /* XXX Missing wrapper. */
2142
2143   /* SYS_lgrpsys               180 */
2144   /* XXX Missing wrapper. */
2145
2146   /* SYS_rusagesys             181 */
2147   sys_rusagesys();
2148   sys_rusagesys2();
2149   sys_rusagesys3();
2150   sys_rusagesys4();
2151   sys_rusagesys5();
2152
2153   /* SYS_port                  182 */
2154   sys_port();
2155   sys_port2();
2156   sys_port3();
2157   sys_port4();
2158   sys_port5();
2159   sys_port6();
2160   sys_port7();
2161   sys_port8();
2162   sys_port9();
2163   sys_port10();
2164   sys_port11();
2165
2166   /* SYS_pollsys               183 */
2167   GO(SYS_pollsys, "4s 5m");
2168   SY(SYS_pollsys, x0, x0 + 1, x0 + 1, x0 + 1); FAIL;
2169
2170   /* SYS_labelsys              184 */
2171   sys_labelsys();
2172   sys_labelsys2();
2173   sys_labelsys3();
2174   sys_labelsys4();
2175   sys_labelsys5();
2176   sys_labelsys6();
2177
2178   /* SYS_acl                   185 */
2179   sys_acl();
2180   sys_acl2();
2181   sys_acl3();
2182   sys_acl4();
2183   sys_acl5();
2184   sys_acl6();
2185
2186   /* SYS_auditsys              186 */
2187   sys_auditsys();
2188   sys_auditsys2();
2189   sys_auditsys3();
2190   sys_auditsys4();
2191   sys_auditsys5();
2192   sys_auditsys6();
2193   sys_auditsys7();
2194   sys_auditsys8();
2195   sys_auditsys9();
2196   sys_auditsys10();
2197   sys_auditsys11();
2198   sys_auditsys12();
2199   sys_auditsys13();
2200   sys_auditsys14();
2201   sys_auditsys15();
2202   sys_auditsys16();
2203   sys_auditsys17();
2204   sys_auditsys18();
2205   sys_auditsys19();
2206   sys_auditsys20();
2207   sys_auditsys21();
2208   sys_auditsys22();
2209   sys_auditsys23();
2210   sys_auditsys24();
2211   sys_auditsys25();
2212   sys_auditsys26();
2213   sys_auditsys27();
2214   sys_auditsys28();
2215   sys_auditsys29();
2216   sys_auditsys30();
2217   sys_auditsys31();
2218   sys_auditsys32();
2219
2220   /* SYS_processor_bind        187 */
2221   /* XXX Missing wrapper. */
2222
2223   /* SYS_processor_info        188 */
2224   /* XXX Missing wrapper. */
2225
2226   /* SYS_p_online              189 */
2227   GO(SYS_p_online, "2s 0m");
2228   SY(SYS_p_online, x0, x0); FAILx(EINVAL);
2229
2230   /* SYS_sigqueue              190 */
2231   GO(SYS_sigqueue, "5s 1m");
2232   SY(SYS_sigqueue, x0 - 1, x0, x0 + 1, x0, x0 - 1); FAIL;
2233
2234   /* SYS_clock_gettime         191 */
2235   GO(SYS_clock_gettime, "2s 1m");
2236   SY(SYS_clock_gettime, x0, x0); FAIL;
2237
2238   /* SYS_clock_settime         192 */
2239   GO(SYS_clock_settime, "2s 1m");
2240   SY(SYS_clock_settime, x0, x0);  FAIL;
2241
2242   /* SYS_clock_getres          193 */
2243   GO(SYS_clock_getres, "2s 1m");
2244   SY(SYS_clock_getres, x0 + 1, x0 + 1); FAIL;
2245
2246   /* SYS_timer_create          194 */
2247   sys_timer_create();
2248   sys_timer_create2();
2249
2250   /* SYS_timer_delete          195 */
2251   GO(SYS_timer_delete, "1s 0m");
2252   SY(SYS_timer_delete, x0 + 1); FAIL;
2253
2254   /* SYS_timer_settime         196 */
2255   GO(SYS_timer_settime, "4s 2m");
2256   SY(SYS_timer_settime, x0, x0, x0 + 1, x0 + 2); FAIL;
2257
2258   /* SYS_timer_gettime         197 */
2259   GO(SYS_timer_gettime, "2s 1m");
2260   SY(SYS_timer_gettime, x0, x0 + 1); FAIL;
2261
2262   /* SYS_timer_getoverrun      198 */
2263   GO(SYS_timer_getoverrun, "1s 0m");
2264   SY(SYS_timer_getoverrun, x0); FAIL;
2265
2266   /* SYS_nanosleep             199 */
2267   GO(SYS_nanosleep, "2s 2m");
2268   SY(SYS_nanosleep, x0, x0 + 1); FAIL;
2269
2270   /* SYS_facl                  200 */
2271   sys_facl();
2272   sys_facl2();
2273   sys_facl3();
2274   sys_facl4();
2275   sys_facl5();
2276   sys_facl6();
2277
2278   /* SYS_door                  201 */
2279   sys_door();
2280   sys_door2();
2281   sys_door3();
2282   sys_door4();
2283   sys_door5();
2284   /* XXX Additional sys_door variants still unimplemented. */
2285
2286   /* SYS_setreuid              202 */
2287   GO(SYS_setreuid, "2s 0m");
2288   SY(SYS_setreuid, x0 - 1, x0 - 1); SUCC;
2289
2290   /* SYS_setregid              203 */
2291   GO(SYS_setregid, "2s 0m");
2292   SY(SYS_setregid, x0 - 1, x0 - 1); SUCC;
2293
2294   /* SYS_install_utrap         204 */
2295   /* XXX Missing wrapper. */
2296
2297   /* SYS_signotify             205 */
2298   /* XXX Missing wrapper. */
2299
2300   /* SYS_schedctl              206 */
2301   GO(SYS_schedctl, "0s 0m");
2302   SY(SYS_schedctl); SUCC;
2303
2304   /* SYS_pset                  207 */
2305   sys_pset();
2306   sys_pset2();
2307   sys_pset3();
2308   sys_pset4();
2309   sys_pset5();
2310   sys_pset6();
2311   sys_pset7();
2312   sys_pset8();
2313   sys_pset9();
2314   sys_pset10();
2315   sys_pset11();
2316   sys_pset12();
2317   sys_pset13();
2318
2319   /* SYS_sparc_utrap_install   208 */
2320   /* XXX Missing wrapper. */
2321
2322   /* SYS_resolvepath           209 */
2323   GO(SYS_resolvepath, "3s 2m");
2324   SY(SYS_resolvepath, x0, x0, x0 + 1); FAIL;
2325
2326   /* SYS_lwp_mutex_timedlock   210 */
2327   GO(SYS_lwp_mutex_timedlock, "3s 7m");
2328   SY(SYS_lwp_mutex_timedlock, x0, x0 + 1, x0); FAIL;
2329
2330   /* SYS_lwp_sema_timedwait    211 */
2331   GO(SYS_lwp_sema_timedwait, "3s 4m");
2332   SY(SYS_lwp_sema_timedwait, x0, x0 + 1, x0); FAIL;
2333
2334   /* SYS_lwp_rwlock_sys        212 */
2335   sys_lwp_rwlock();
2336   sys_lwp_rwlock2();
2337   sys_lwp_rwlock3();
2338   sys_lwp_rwlock4();
2339   sys_lwp_rwlock5();
2340
2341   /* SYS_getdents64            213 */
2342   /* Tested in x86-solaris/scalar.c. */
2343
2344   /* SYS_mmap64                214 */
2345   /* Tested in x86-solaris/scalar.c. */
2346
2347   /* SYS_stat64                215 */
2348   /* Tested in x86-solaris/scalar_obsolete.c. */
2349
2350   /* SYS_lstat64               216 */
2351   /* Tested in x86-solaris/scalar_obsolete.c. */
2352
2353   /* SYS_fstat64               217 */
2354   /* Tested in x86-solaris/scalar_obsolete.c. */
2355
2356   /* SYS_statvfs64             218 */
2357   /* Tested in x86-solaris/scalar.c. */
2358
2359   /* SYS_fstatvfs64            219 */
2360   /* Tested in x86-solaris/scalar.c. */
2361
2362   /* SYS_setrlimit64           220 */
2363   /* Tested in x86-solaris/scalar.c. */
2364
2365   /* SYS_getrlimit64           221 */
2366   /* Tested in x86-solaris/scalar.c. */
2367
2368   /* SYS_pread64               222 */
2369   /* Tested in x86-solaris/scalar.c. */
2370
2371   /* SYS_pwrite64              223 */
2372   /* Tested in x86-solaris/scalar.c. */
2373
2374   /* SYS_open64                225 */
2375   /* Tested in x86-solaris/scalar_obsolete.c. */
2376
2377   /* SYS_rpcsys                226 */
2378   /* XXX Missing wrapper. */
2379
2380   /* SYS_zone                  227 */
2381   sys_zone();
2382   sys_zone2();
2383   sys_zone3();
2384   sys_zone4();
2385   sys_zone5();
2386   sys_zone6();
2387   sys_zone7();
2388   sys_zone8();
2389   sys_zone9();
2390   sys_zone10();
2391   sys_zone11();
2392   /*
2393   2013-09-22 Petr Pavlu -- The following test crashes my system because of
2394   a kernel bug (illumos), commenting it out for now.
2395   sys_zone12();
2396   */
2397   sys_zone13();
2398   /*
2399   2013-09-22 Petr Pavlu -- The following test provides an incorrect result
2400   because of a kernel bug (illumos), commenting it out for now.
2401   sys_zone14();
2402   */
2403   sys_zone15();
2404   /*
2405   2013-09-22 Petr Pavlu -- The following test provides an incorrect result
2406   because of a kernel bug (illumos), commenting it out for now.
2407   sys_zone16();
2408   */
2409
2410   /* SYS_autofssys             228 */
2411   /* XXX Missing wrapper. */
2412
2413   /* SYS_getcwd                229 */
2414   GO(SYS_getcwd, "2s 1m");
2415   SY(SYS_getcwd, x0, x0 + 1); FAIL;
2416
2417   /* SYS_so_socket             230 */
2418   GO(SYS_so_socket, "5s 1m");
2419   SY(SYS_so_socket, x0, x0, x0, x0 + 1, x0); FAIL;
2420
2421   /* SYS_so_socketpair         231 */
2422   GO(SYS_so_socketpair, "1s 1m");
2423   SY(SYS_so_socketpair, x0); FAIL;
2424
2425   /* SYS_bind                  232 */
2426   GO(SYS_bind, "4s 0m");
2427   SY(SYS_bind, x0, x0, x0, x0); FAIL;
2428
2429   /* SYS_listen                233 */
2430   GO(SYS_listen, "3s 0m");
2431   SY(SYS_listen, x0, x0, x0); FAIL;
2432
2433   /* SYS_accept                234 */
2434   /* Illumos added a new version of the accept() syscall which takes an extra
2435      flag parameter.  This is trivially handled in the syscall wrapper but it
2436      is not tested here so it is not necessary to have two versions of the
2437      stderr.exp file. */
2438   GO(SYS_accept, "4s 0m");
2439   SY(SYS_accept, x0, x0, x0, x0, 0); FAIL;
2440
2441   /* SYS_connect               235 */
2442   GO(SYS_connect, "4s 0m");
2443   SY(SYS_connect, x0, x0, x0, x0); FAIL;
2444
2445   /* SYS_shutdown              236 */
2446   GO(SYS_shutdown, "3s 0m");
2447   SY(SYS_shutdown, x0 - 1, x0, x0); FAILx(EBADF);
2448
2449   /* SYS_recv                  237 */
2450   GO(SYS_recv, "4s 1m");
2451   SY(SYS_recv, x0, x0, x0 + 1, x0); FAIL;
2452
2453   /* SYS_recvfrom              238 */
2454   GO(SYS_recvfrom, "6s 1m");
2455   SY(SYS_recvfrom, x0, x0, x0 + 1, x0, x0, x0); FAIL;
2456
2457   /* SYS_recvmsg               239 */
2458   GO(SYS_recvmsg, "3s 0m");
2459   SY(SYS_recvmsg, x0, x0, x0); FAIL;
2460
2461   /* SYS_send                  240 */
2462   GO(SYS_send, "4s 1m");
2463   SY(SYS_send, x0, x0, x0 + 1, x0); FAIL;
2464
2465   /* SYS_sendmsg               241 */
2466   GO(SYS_sendmsg, "3s 0m");
2467   SY(SYS_sendmsg, x0, x0, x0); FAIL;
2468
2469   /* SYS_sendto                242 */
2470   GO(SYS_sendto, "6s 1m");
2471   SY(SYS_sendto, x0, x0, x0 + 1, x0, x0, x0); FAIL;
2472
2473   /* SYS_getpeername           243 */
2474   sys_getpeername();
2475   sys_getpeername2();
2476
2477   /* SYS_getsockname           244 */
2478   GO(SYS_getsockname, "4s 1m");
2479   SY(SYS_getsockname, x0, x0, x0, x0); FAIL;
2480
2481   /* SYS_getsockopt            245 */
2482   GO(SYS_getsockopt, "6s 0m");
2483   SY(SYS_getsockopt, x0, x0, x0, x0, x0, x0); FAIL;
2484
2485   /* SYS_setsockopt            246 */
2486   GO(SYS_setsockopt, "6s 1m");
2487   SY(SYS_setsockopt, x0, x0, x0, x0, x0 + 1, x0); FAIL;
2488
2489   /* SYS_sockconfig            247 */
2490   /* XXX Missing wrapper. */
2491
2492   /* SYS_ntp_gettime           248 */
2493   /* XXX Missing wrapper. */
2494
2495   /* SYS_ntp_adjtime           249 */
2496   /* XXX Missing wrapper. */
2497
2498   /* SYS_lwp_mutex_unlock      250 */
2499   /* XXX Missing wrapper. */
2500
2501   /* SYS_lwp_mutex_trylock     251 */
2502   /* XXX Missing wrapper. */
2503
2504   /* SYS_lwp_mutex_register    252 */
2505   GO(SYS_lwp_mutex_register, "2s 1m");
2506   SY(SYS_lwp_mutex_register, x0, x0); FAIL;
2507
2508   /* SYS_cladm                 253 */
2509   /* XXX Missing wrapper. */
2510
2511   /* SYS_uucopy                254 */
2512   GO(SYS_uucopy, "3s 2m");
2513   SY(SYS_uucopy, x0, x0, x0 + 1); FAIL;
2514
2515   /* SYS_umount2               255 */
2516   GO(SYS_umount2, "2s 1m");
2517   SY(SYS_umount2, x0, x0); FAIL;
2518
2519   /* No such syscall... */
2520#if 0
2521   GO(9999, "1e");
2522   SY(9999); FAIL;
2523#endif
2524
2525   /* SYS_exit                    1 */
2526   GO(SYS_exit, "1s 0m");
2527   SY(SYS_exit, x0); FAIL;
2528
2529   assert(0);
2530   return 0;
2531}
2532
2533