5-1.c

来自「fsmlabs的real time linux的内核」· C语言 代码 · 共 49 行

C
49
字号
/*    * 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_delete() returns -1 and sets errno==EINVAL if * timerid is not a valid timer ID. */#include <time.h>#include "compat.h"#include <errno.h>#include "posixtest.h"#define BOGUSTIMERID (PAGE_OFFSET+99999)#define printf printkvoid init_module(void){	timer_t tid;	tid = BOGUSTIMERID;	if (timer_delete(tid) == -1) {		if (errno==EINVAL) {			printf("Test PASSED\n");			return PTS_PASS;		} else {			printf("errno!=EINVAL when bogus timer ID sent\n");			return PTS_FAIL;		}	} else {		printf("timer_delete() did not return -1 for bogus timer ID\n");		return PTS_FAIL;	}	printf("This code should never be executed\n");	return PTS_UNRESOLVED;}void cleanup_module(void){}

⌨️ 快捷键说明

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