12c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include "../../memcheck.h" 22c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include "scalar.h" 32c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include <unistd.h> 42c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include <sched.h> 52c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include <signal.h> 62c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn#include <sys/shm.h> 72c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 82c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn// See memcheck/tests/x86-linux/scalar.c for an explanation of what this test 92c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn// is doing. 102c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 112c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njnint main(void) 122c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn{ 132c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // uninitialised, but we know px[0] is 0x0 142c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn long* px = malloc(sizeof(long)); 152c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn long x0 = px[0]; 162c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn long res; 172c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 182c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn VALGRIND_MAKE_MEM_NOACCESS(0, 0x1000); 192c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 202c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // The nocancel syscalls all use the same wrappers as the corresponding 212c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // non-nocancel syscall. This means that if we try to test both in the 222c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // same file, the nocancel ones won't result in errors being generated 232c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // because errors are too similar. So we test them in this separate file. 242c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 252c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_read_nocancel 396 262c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_write_nocancel 397 272c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_open_nocancel 398 282c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_close_nocancel 399 292c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_wait4_nocancel 400 302c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_recvmsg_nocancel 401 312c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_sendmsg_nocancel 402 322c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_recvfrom_nocancel 403 332c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_accept_nocancel 404 342c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_msync_nocancel 405 352c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_fcntl_nocancel 406 362c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_select_nocancel 407 372c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_fsync_nocancel 408 382c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_connect_nocancel 409 392c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_sigsuspend_nocancel 410 409edbf75d3da31c7eb8e5c34fc1386dabcd823997rhyskidd 419edbf75d3da31c7eb8e5c34fc1386dabcd823997rhyskidd GO(__NR_sigsuspend_nocancel, 410, "ignore"); 429edbf75d3da31c7eb8e5c34fc1386dabcd823997rhyskidd // (I don't know how to test this...) 439edbf75d3da31c7eb8e5c34fc1386dabcd823997rhyskidd 442c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_readv_nocancel 411 452c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_writev_nocancel 412 462c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_sendto_nocancel 413 472c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_pread_nocancel 414 482c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_pwrite_nocancel 415 492c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_waitid_nocancel 416 502c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_poll_nocancel 417 512c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_msgsnd_nocancel 418 522c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_msgrcv_nocancel 419 532c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 542c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // The error doesn't appear because it's a dup of the one from sem_wait. 55fde4707d003291930635fd04e28804524e8a77efnjn GO(__NR_sem_wait_nocancel, 420, "1s 0m"); 562c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn SY(__NR_sem_wait_nocancel, x0); FAIL; 572c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 582c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR_aio_suspend_nocancel 421 592c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR___sigwait_nocancel 422 602c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn // __NR___semwait_signal_nocancel 423 612c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 622c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn return 0; 632c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn} 642c7e5ca3d43afda2060c4f3a1ad43d945c05ff71njn 65