/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test that timer_create() returns a unique timer ID for the current * process. * For this test, signal SIGALRM will be used, clock CLOCK_REALTIME * will be used. */ #include #include #include #include #include #include #include #include #include "posixtest.h" int compare(const void *key, const void *amemb) { if (*(timer_t *)key == *(timer_t *)amemb) { return 0; } else { return 1; } } int main(int argc, char *argv[]) { struct sigevent ev; timer_t tid; timer_t *tids; size_t i; ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGALRM; #if defined DEBUG && defined TIMER_MAX printf("Max timers is %ld\n", (long) TIMER_MAX); int max = TIMER_MAX; #else int max = 256; #endif tids = (timer_t *) malloc (max * sizeof (timer_t)); if (tids == NULL) { perror("malloc failed\n"); return PTS_UNRESOLVED; } for (i=0; i