1#include "../../memcheck.h"
2#include "scalar.h"
3#include <unistd.h>
4#include <sched.h>
5#include <signal.h>
6#include <sys/shm.h>
7
8// See memcheck/tests/x86-linux/scalar.c for an explanation of what this test
9// is doing.
10
11int main(void)
12{
13   // uninitialised, but we know px[0] is 0x0
14   long* px  = malloc(sizeof(long));
15   long  x0  = px[0];
16   long  res;
17
18   VALGRIND_MAKE_MEM_NOACCESS(0, 0x1000);
19
20   // The nocancel syscalls all use the same wrappers as the corresponding
21   // non-nocancel syscall.  This means that if we try to test both in the
22   // same file, the nocancel ones won't result in errors being generated
23   // because errors are too similar.  So we test them in this separate file.
24
25   // __NR_read_nocancel 396
26   // __NR_write_nocancel 397
27   // __NR_open_nocancel 398
28   // __NR_close_nocancel 399
29   // __NR_wait4_nocancel 400
30   // __NR_recvmsg_nocancel 401
31   // __NR_sendmsg_nocancel 402
32   // __NR_recvfrom_nocancel 403
33   // __NR_accept_nocancel 404
34   // __NR_msync_nocancel 405
35   // __NR_fcntl_nocancel 406
36   // __NR_select_nocancel 407
37   // __NR_fsync_nocancel 408
38   // __NR_connect_nocancel 409
39   // __NR_sigsuspend_nocancel 410
40
41   GO(__NR_sigsuspend_nocancel, 410, "ignore");
42   // (I don't know how to test this...)
43
44   // __NR_readv_nocancel 411
45   // __NR_writev_nocancel 412
46   // __NR_sendto_nocancel 413
47   // __NR_pread_nocancel 414
48   // __NR_pwrite_nocancel 415
49   // __NR_waitid_nocancel 416
50   // __NR_poll_nocancel 417
51   // __NR_msgsnd_nocancel 418
52   // __NR_msgrcv_nocancel 419
53
54   // The error doesn't appear because it's a dup of the one from sem_wait.
55   GO(__NR_sem_wait_nocancel, 420, "1s 0m");
56   SY(__NR_sem_wait_nocancel, x0); FAIL;
57
58   // __NR_aio_suspend_nocancel 421
59   // __NR___sigwait_nocancel 422
60   // __NR___semwait_signal_nocancel 423
61
62   return 0;
63}
64
65