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

📄 oops_test.c

📁 linux下记录系统日志代码以及记录内核日志代码
💻 C
字号:
/* * This is a small test program for generating a kernel protection fault * using the oops loadable module. * * Fri Apr 26 12:52:43 CDT 1996:  Dr. Wettstein *	Initial version. *//* Includes. */#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>/* Function prototypes. */extern int main(int, char **);extern int main(argc, argv)     int argc;     char *argv[];{	auto int fd;	if ( argc != 2 )	{		fprintf(stderr, "No oops device specified.\n");		return(1);	}	if ( (fd = open(argv[1], O_RDONLY)) < 0 )	{		fprintf(stderr, "Cannot open device: %s.\n", argv[1]);		return(1);	}	if ( ioctl(fd, 1, 0) < 0 )	{		fprintf(stderr, "Failed on oops.\n");		return(1);	}	printf("OOoops\n");	close(fd);	return(0);}

⌨️ 快捷键说明

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