mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
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
40 lines
808 B
C
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;
|
|
}
|