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
|
Tested with linux-2.6.16-gentoo-r13, linux-2.6.25-gentoo-r9, linux-2.6.26-gentoo-r4, linux-2.6.27-gentoo-r10,
linux-2.6.28-gentoo-r6, linux-2.6.29-gentoo-r6, linux-2.6.30-gentoo-r9, linux-2.6.32-gentoo-r4, linux-2.6.32-gentoo-r5
diff -ru exmap-0.10.orig/work/exmap-0.10/kernel/exmap.c exmap-0.10/work/exmap-0.10/kernel/exmap.c
--- kernel/exmap.c 2006-09-28 18:52:25.000000000 +0200
+++ kernel/exmap.c 2010-02-17 16:15:04.000000000 +0100
@@ -392,7 +392,11 @@
struct task_struct *tsk;
int errcode = -EINVAL;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ tsk = pid_task(find_pid_ns(pid, &init_pid_ns), PIDTYPE_PID);
+ #else
tsk = find_task_by_pid(pid);
+ #endif
if (tsk == NULL) {
printk (KERN_ALERT
"/proc/%s: can't find task for pid %d\n",
@@ -507,7 +511,11 @@
NULL);
if (exmap_proc_file == NULL) {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+ remove_proc_entry (PROCFS_NAME, NULL);
+ #else
remove_proc_entry (PROCFS_NAME, &proc_root);
+ #endif
printk (KERN_ALERT "/proc/%s: could not initialize\n",
PROCFS_NAME);
return -ENOMEM;
@@ -523,7 +523,9 @@
exmap_proc_file->read_proc = procfile_read;
exmap_proc_file->write_proc = procfile_write;
+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,29)
exmap_proc_file->owner = THIS_MODULE;
+ #endif
/* exmap_proc_file->mode = S_IFREG | S_IRUGO; */
/* TODO - this is quite probably a security problem */
@@ -532,5 +540,9 @@
void cleanup_module ()
{
printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+ remove_proc_entry (PROCFS_NAME, NULL);
+ #else
remove_proc_entry (PROCFS_NAME, &proc_root);
+ #endif
}
|