⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 12-1.c

📁 最新rtlinux内核源码
💻 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_settime() sets errno = EINVAL if no timers have been * created yet. */#include <time.h>#include <errno.h>#include "compat.h"#define PASS 0#define FAIL 1#define UNRESOLVED 2// RTLinux doesn't provide memory protection. Simply ensure to pass a valid memory position.#define BOGUSTID (9999 + PAGE_OFFSET)void *th_code(void *arg){	timer_t tid;	struct itimerspec its;	tid = BOGUSTID;	its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0;	its.it_value.tv_sec = 0; its.it_value.tv_nsec = 0;	if (timer_settime(tid, 0, &its, NULL) == -1) {		if (EINVAL == errno) {			printf("Test PASSED\n");			return PASS;		} else {			printf("returned -1, but errno not set\n");			return FAIL;		}	} else {		printf("timer_settime() did not return failure\n");		return UNRESOLVED;	}	return UNRESOLVED;}pthread_t th;int init_module(void){  int err;    err=pthread_create(&th,NULL,th_code,0);  return err;}void cleanup_module(void){  pthread_delete_np(th);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -