1 /* 2 * Copyright (c) 2002, Intel Corporation. All rights reserved. 3 * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 * 8 * Test to see if timer_getoverrun() sets errno = EINVAL for timerid != a 9 * timer ID created via timer_create(). [Try to set timerid to a timer ID 10 * created + 1.] 11 * Since this assertion is a "may," either option is a pass. 12 * 13 * For this test, signal SIGCONT will be used, clock CLOCK_REALTIME 14 * will be used. 15 */ 16 17 #include <sys/types.h> 18 #include <errno.h> 19 #include <signal.h> 20 #include <stdio.h> 21 #include <time.h> 22 #include "posixtest.h" 23 24 int main(void) 25 { 26 struct sigevent ev; 27 timer_t tid; 28 29 ev.sigev_notify = SIGEV_SIGNAL; 30 ev.sigev_signo = SIGCONT; 31 32 if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { 33 perror("timer_create() did not return success\n"); 34 return PTS_UNRESOLVED; 35 } 36 37 if (timer_getoverrun(tid + 1) == -1) { 38 if (EINVAL == errno) { 39 printf("fcn returned -1 and errno==EINVAL\n"); 40 return PTS_PASS; 41 } else { 42 printf("fcn returned -1 but errno!=EINVAL\n"); 43 printf("Test FAILED\n"); 44 return PTS_FAIL; 45 } 46 } 47 48 printf("fcn did not return -1\n"); 49 return PTS_PASS; 50 } 51