File: checks.c

package info (click to toggle)
kernel-source-2.4.27 2.4.27-10sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 191,224 kB
  • ctags: 610,077
  • sloc: ansic: 3,299,602; asm: 164,708; makefile: 10,962; sh: 3,725; perl: 2,273; yacc: 1,651; cpp: 820; lex: 752; tcl: 577; awk: 251; lisp: 218; sed: 79
file content (55 lines) | stat: -rw-r--r-- 1,271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#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/slab.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;
}