1 /* Test for syscalls that are available on illumos but are removed on
2    Solaris 11.  This test is compiled only on illumos. */
3 
4 #include "../solaris/scalar.h"
5 
6 #include <sys/fcntl.h>
7 
8 /* Helper functions.  These are necessary if we've got two tests for a single
9    syscall.  In that case, Memcheck can sometimes merge error messages.  Doing
10    each test in its own function prevents that. */
11 __attribute__((noinline))
sys_open64(void)12 static void sys_open64(void)
13 {
14    GO(SYS_open64, "(2-args) 2s 1m");
15    SY(SYS_open64, x0, x0); FAIL;
16 }
17 
18 __attribute__((noinline))
sys_open642(void)19 static void sys_open642(void)
20 {
21    GO(SYS_open64, "(3-args) 3s 1m");
22    SY(SYS_open64, x0, x0 | O_CREAT, x0); FAIL;
23 }
24 
main(void)25 int main(void)
26 {
27    /* Uninitialised, but we know px[0] is 0x0. */
28    long *px = malloc(sizeof(long));
29    x0 = px[0];
30 
31    /* SYS_stat64                215 */
32    GO(SYS_stat64, "2s 2m");
33    SY(SYS_stat64, x0, x0); FAIL;
34 
35    /* SYS_lstat64               216 */
36    GO(SYS_lstat64, "2s 2m");
37    SY(SYS_lstat64, x0, x0); FAIL;
38 
39    /* SYS_fstat64               217 */
40    GO(SYS_fstat64, "2s 1m");
41    SY(SYS_fstat64, x0, x0); FAIL;
42 
43    /* SYS_open64                225 */
44    sys_open64();
45    sys_open642();
46 
47    return 0;
48 }
49 
50