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

📄 checks.c

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻 C
字号:
#include <linux/errno.h>#include <linux/sched.h>#include <linux/kernel.h>#include <linux/mm.h>#include <linux/smp.h>#include <linux/smp_lock.h>#include <linux/stddef.h>#include <linux/unistd.h>#include <linux/ptrace.h>#include <linux/malloc.h>#include <linux/user.h>#include <linux/a.out.h>#include <asm/pgtable.h>#include <asm/uaccess.h>#include <asm/system.h>#include <asm/io.h>/* * Do various before compile checks of data structures * -- Cort */int main(void){	int ret = 0;#if 0	if ( sizeof(struct thread_struct) % 16 )	{		printf("Thread struct is not modulo 16 bytes: "			"%d bytes total, %d bytes off\n",			sizeof(struct thread_struct),			sizeof(struct thread_struct)%16);		ret = -1;	}#endif		if ( sizeof(struct pt_regs) % 16 )	{		printf("pt_regs struct is not modulo 16 bytes: "			"%d bytes total, %d bytes off\n",			sizeof(struct pt_regs),			sizeof(struct pt_regs)%16);		ret = -1;			}	printf("Task size        : %d bytes\n"	       "Tss size         : %d bytes\n"	       "pt_regs size     : %d bytes\n"	       "Kernel stack size: %d bytes\n",	       sizeof(struct task_struct), sizeof(struct thread_struct),	       sizeof(struct pt_regs),	       sizeof(union task_union) - sizeof(struct task_struct));	return ret;}

⌨️ 快捷键说明

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