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_settime() sets errno = EINVAL if no timers have been 9 * created yet. Since this is a "may" assertion, either way is a pass. 10 */ 11 12 #include <time.h> 13 #include <stdio.h> 14 #include <errno.h> 15 #include "posixtest.h" 16 17 #define BOGUSTID 9999 18 19 int main(void) 20 { 21 timer_t tid; 22 struct itimerspec its; 23 int tval = BOGUSTID; 24 tid = (timer_t) & tval; 25 its.it_interval.tv_sec = 0; 26 its.it_interval.tv_nsec = 0; 27 its.it_value.tv_sec = 0; 28 its.it_value.tv_nsec = 0; 29 30 if (timer_settime(tid, 0, &its, NULL) == -1) { 31 if (EINVAL == errno) { 32 printf("fcn returned -1 and errno==EINVAL\n"); 33 return PTS_PASS; 34 } else { 35 printf("fcn returned -1, but errno!=EINVAL\n"); 36 printf("Test FAILED\n"); 37 return PTS_FAIL; 38 } 39 } 40 printf("fcn did not return -1\n"); 41 return PTS_PASS; 42 } 43