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