7 #include "../memcheck.h"
9 /* Check that a syscall's POST function gets called if it completes
10 due to being interrupted. nanosleep is used here, because it
11 writes a result even if it fails. wait*() could also be used,
12 because they successfully complete if interrupted by SIGCHLD.
14 static void handler(int s
)
20 struct timespec req
, rem
;
26 signal(SIGALRM
, handler
);
29 ret
= nanosleep(&req
, &rem
);
31 if (ret
!= -1 || errno
!= EINTR
) {
32 fprintf(stderr
, "FAILED: expected nanosleep to be interrupted\n");
34 (void) VALGRIND_CHECK_VALUE_IS_DEFINED(rem
);
35 fprintf(stderr
, "PASSED\n"); /* assuming CHECK_VALUE_IS_DEFINED doesn't print anything */