?? 6-2.c
字號:
/* * 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_gettime() sets errno = EINVAL timerid != a timer ID * created via timer_create(). [Try to set timerid to a timer ID * created + 1.] * * For this test, signal SIGCONT will be used, clock CLOCK_REALTIME * will be used. */#include <time.h>#include <signal.h>#include <errno.h>#include "compat.h"#include "posixtest.h"timer_t tid;pthread_t th;void *th_code(void *arg){ struct itimerspec its; if (timer_gettime(tid+1, &its) == -1) { if (EINVAL == errno) { printf("Test PASSED\n"); return PTS_PASS; } else { printf("returned -1, but errno not set\n"); return PTS_FAIL; } } else { printf("timer_settime() did not return failure\n"); return PTS_UNRESOLVED; } return PTS_UNRESOLVED;}int init_module(void){ struct sigevent ev; int err=0; ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGCONT; if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } err=pthread_create(&th,NULL,th_code,0); return err;}void cleanup_module(void){ timer_delete(tid); pthread_delete_np(th);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -