Add bug 494246 to NEWS
[valgrind.git] / memcheck / tests / solaris / scalar_spawn.c
blob401b56e815ee5533d01252f6ef47a216c8d59afa
1 /* Scalar test for new spawn syscall available on Solaris 11. */
3 #include "scalar.h"
5 #include <sys/spawn_impl.h>
7 __attribute__((noinline))
8 static void sys_spawn(void)
10 GO(SYS_spawn, "5s 7m");
11 SY(SYS_spawn, x0 + 1, x0 + 1, x0 - 1, x0 + 1, x0 - 1); FAIL;
14 __attribute__((noinline))
15 static void sys_spawn2(void)
17 kspawn_attr_t ksa;
18 ksa.ksa_version = x0 + SPAWN_VERSION;
19 ksa.ksa_size = x0 + sizeof(ksa);
20 ksa.ksa_attr_off = x0 + 0;
21 ksa.ksa_path_off = x0 + 0;
22 ksa.ksa_shell_off = x0 + 0;
23 char *argenv = "";
25 GO(SYS_spawn, "9s 1m");
26 SY(SYS_spawn, x0 + 1, x0 + &ksa, sizeof(ksa), x0 + argenv, x0 + 1); FAIL;
29 __attribute__((noinline))
30 static void sys_spawn3(void)
32 kspawn_attr_t ksa;
33 ksa.ksa_version = x0 + SPAWN_VERSION;
34 ksa.ksa_size = x0 + 0xbadcaffe;
35 ksa.ksa_attr_off = x0 + 0xbadcaffe;
36 ksa.ksa_attr_size = x0 + 1;
37 ksa.ksa_path_off = x0 + 0xdeadcaffe;
38 ksa.ksa_path_size = x0 + 2;
39 ksa.ksa_shell_off = x0 + 0xdeadcaffe;
40 ksa.ksa_shell_size = x0 + 3;
41 char *argenv = "\1arg1\0\1arg2\0\1arg3\0\0\1env1\0\1env2\0\0";
43 GO(SYS_spawn, "13s 4m");
44 SY(SYS_spawn, x0 + 1, x0 + &ksa, x0 + 0xbadcaffe,
45 x0 + argenv, x0 + sizeof(argenv)); FAIL;
48 __attribute__((noinline))
49 static void sys_spawn4(void)
51 char path[] = "/bin/sh";
52 char *argenv = "\2arg1\0\0";
54 GO(SYS_spawn, "4s 0m");
55 SY(SYS_spawn, path, x0, x0, x0 + argenv, x0 + sizeof(argenv));
56 FAILx(EINVAL);
59 int main(void)
61 /* Uninitialised, but we know px[0] is 0x0. */
62 long *px = malloc(sizeof(long));
63 x0 = px[0];
65 /* SYS_spawn 2 */
66 sys_spawn();
67 sys_spawn2();
68 sys_spawn3();
69 sys_spawn4();
71 return 0;