Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / memcheck / tests / x86-solaris / scalar.c
blobf23a0f9dc0da663fa71ec809c6908b0a857f94ff
1 /* Basic syscall test for Solaris/x86 specific syscalls. */
3 #include "scalar.h"
5 #include <string.h>
6 #include <sys/fcntl.h>
7 #include <sys/lwp.h>
8 #include <sys/statvfs.h>
10 /* Helper functions. These are necessary if we've got two tests for a single
11 syscall. In that case, Memcheck can sometimes merge error messages. Doing
12 each test in its own function prevents that. */
13 __attribute__((noinline))
14 static void sys_openat64(void)
16 GO(SYS_openat64, "(3-args) 3s 1m");
17 SY(SYS_openat64, x0 - 1, x0, x0); FAILx(EBADF);
20 __attribute__((noinline))
21 static void sys_openat642(void)
23 GO(SYS_openat64, "(4-args) 4s 1m");
24 SY(SYS_openat64, x0 - 1, x0, x0 | O_CREAT, x0); FAILx(EBADF);
27 __attribute__((noinline))
28 static void sys_statvfs64(void)
30 GO(SYS_statvfs64, "2s 2m");
31 SY(SYS_statvfs64, x0 + 1, x0 + 1); FAIL;
34 __attribute__((noinline))
35 static int sys_statvfs642(void)
37 const char path[] = "/";
38 struct statvfs64 stats;
40 GO(SYS_statvfs64, "4s 0m");
41 SY(SYS_statvfs64, x0 + path, x0 + &stats); SUCC;
43 size_t basetype_len = strlen(stats.f_basetype);
44 size_t fstr_len = strlen(stats.f_fstr);
46 /* Now check that memory after the strings is reported uninitialized. */
47 int x = 0;
48 if (stats.f_basetype[basetype_len + 2] != ' ') x = -1; else x = -2;
49 if (stats.f_fstr[fstr_len + 2] != ' ') x = -3; else x = -4;
50 return x;
53 int main(void)
55 /* Uninitialised, but we know px[0] is 0x0. */
56 long *px = malloc(sizeof(long));
57 x0 = px[0];
59 /* SYS_fstatat64 67 */
60 GO(SYS_fstatat64, "4s 2m");
61 SY(SYS_fstatat64, x0 - 1, x0 + 1, x0, x0); FAILx(EBADF);
63 /* SYS_openat64 69 */
64 sys_openat64();
65 sys_openat642();
67 /* SYS_lwp_private 166 */
68 GO(SYS_lwp_private, "3s 1m");
69 SY(SYS_lwp_private, x0 + _LWP_GETPRIVATE, x0 + _LWP_GSBASE, x0); FAIL;
71 /* SYS_llseek 175 */
72 GO(SYS_llseek, "4s 0m");
73 SY(SYS_llseek, x0 - 1, x0, x0, x0); FAILx(EBADF);
75 /* SYS_getdents64 213 */
76 GO(SYS_getdents64, "3s 1m");
77 SY(SYS_getdents64, x0, x0, x0 + 1); FAIL;
79 /* SYS_mmap64 214 */
80 GO(SYS_mmap64, "7s 0m");
81 SY(SYS_mmap64, x0, x0, x0, x0, x0, x0, x0); FAILx(EINVAL);
83 /* SYS_stat64 215 */
84 /* Tested in x86-solaris/scalar_obsolete.c. */
86 /* SYS_lstat64 216 */
87 /* Tested in x86-solaris/scalar_obsolete.c. */
89 /* SYS_fstat64 217 */
90 /* Tested in x86-solaris/scalar_obsolete.c. */
92 /* SYS_statvfs64 218 */
93 sys_statvfs64();
94 sys_statvfs642();
96 /* SYS_fstatvfs64 219 */
97 GO(SYS_fstatvfs64, "2s 1m");
98 SY(SYS_fstatvfs64, x0 - 1, x0 + 1); FAILx(EBADF);
100 /* SYS_setrlimit64 220 */
101 GO(SYS_setrlimit64, "2s 1m");
102 SY(SYS_setrlimit64, x0, x0); FAIL;
104 /* SYS_getrlimit64 221 */
105 GO(SYS_getrlimit64, "2s 1m");
106 SY(SYS_getrlimit64, x0, x0); FAIL;
108 /* SYS_pread64 222 */
109 GO(SYS_pread64, "5s 1m");
110 SY(SYS_pread64, x0 - 1, x0, x0 + 1, x0, x0); FAILx(EBADF);
112 /* SYS_pwrite64 223 */
113 GO(SYS_pwrite64, "5s 1m");
114 SY(SYS_pwrite64, x0 - 1, x0, x0 + 1, x0, x0); FAILx(EBADF);
116 /* SYS_open64 225 */
117 /* Tested in x86-solaris/scalar_obsolete.c. */
119 return 0;