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 that timer_create() sets errno to EINVAL if clock_id is not 9 * a defined clock ID. 10 */ 11 12 #include <time.h> 13 #include <signal.h> 14 #include <stdio.h> 15 #include <errno.h> 16 #include "posixtest.h" 17 18 #define INVALIDCLOCKID 99999 19 20 int main(void) 21 { 22 struct sigevent ev; 23 timer_t tid; 24 25 ev.sigev_notify = SIGEV_SIGNAL; 26 ev.sigev_signo = SIGALRM; 27 28 if (timer_create(INVALIDCLOCKID, &ev, &tid) == -1) { 29 if (EINVAL == errno) { 30 printf("Test PASSED\n"); 31 return PTS_PASS; 32 } else { 33 printf("errno != EINVAL\n"); 34 printf("Test FAILED\n"); 35 return PTS_FAIL; 36 } 37 } else { 38 printf("timer_create returned success\n"); 39 return PTS_UNRESOLVED; 40 } 41 return PTS_UNRESOLVED; 42 } 43