Julian Seward 7c542ccd39 Add new files resulting from merging in the 2.4.0 line. Many of these
seem to be simply duplication of the x86 instruction set tests into
the addrcheck and helgrind trees.  I'm not sure what this duplication
achieves.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3264
2005-03-10 23:23:45 +00:00

40 lines
808 B
C

#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include "../memcheck.h"
/* Check that a syscall's POST function gets called if it completes
due to being interrupted. nanosleep is used here, because it
writes a result even if it fails. wait*() could also be used,
because they successully complete if interrupted by SIGCHLD.
*/
static void handler(int s)
{
}
int main()
{
struct timespec req, rem;
int ret;
req.tv_sec = 2;
req.tv_nsec = 0;
signal(SIGALRM, handler);
alarm(1);
ret = nanosleep(&req, &rem);
if (ret != -1 || errno != EINTR) {
printf("FAILED: expected nanosleep to be interrupted\n");
} else {
VALGRIND_CHECK_DEFINED(rem);
printf("PASSED\n"); /* assuming CHECK_DEFINED doesn't print anything */
}
return 0;
}