1 $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
2 --- exmap-console-0.4.1.orig/kernel/exmap.c 2006-10-24 20:45:11.000000000 +0200
3 +++ exmap-console-0.4.1/kernel/exmap.c 2013-11-02 18:56:21.000000000 +0100
4 @@ -340,24 +340,22 @@ static int show_vma_start(struct exmap_v
8 -static int exmap_show_next(char *buffer, int length)
9 +static ssize_t exmap_show_next(char *buffer, size_t length)
13 struct exmap_vma_data *vma_data;
17 while (local_data.vma_cursor < local_data.num_vmas) {
18 vma_data = local_data.vma_data + local_data.vma_cursor;
20 -// "exmap: examining vma %08lx [%d/%d] %d\n",
21 -// vma_data->vm_start,
22 -// local_data.vma_cursor,
23 -// local_data.num_vmas,
24 -// vma_data->start_shown);
26 + "exmap: examining vma %08lx [%d/%d] %d\n",
28 + local_data.vma_cursor,
29 + local_data.num_vmas,
30 + vma_data->start_shown);
31 if (!vma_data->start_shown) {
34 line_len = show_vma_start(vma_data,
37 @@ -392,7 +390,11 @@ int setup_from_pid(pid_t pid)
38 struct task_struct *tsk;
39 int errcode = -EINVAL;
41 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
42 + tsk = find_task_by_vpid(pid);
44 tsk = find_task_by_pid(pid);
48 "/proc/%s: can't find task for pid %d\n",
49 @@ -445,10 +447,10 @@ Exit:
50 * where deadbeef is the hex addr of the vma to examine
51 * and pid is the (decimal) pid of the process to examine
53 -static int procfile_write (struct file *file,
54 +static ssize_t procfile_write (struct file *file,
55 const char __user *buffer,
56 - unsigned long count,
62 int errcode = -EINVAL;
63 @@ -475,14 +477,11 @@ static int procfile_write (struct file *
64 * Only support sequential reading of file from start to finish
65 * (following a write() to set the pid to examine
67 -static int procfile_read (char *buffer,
68 - char **buffer_location,
73 +static ssize_t procfile_read (struct file *filp,
80 if (local_data.vma_data == NULL) {
81 printk (KERN_ALERT "/proc/%s: vma data not set\n",
82 @@ -490,47 +489,40 @@ static int procfile_read (char *buffer,
86 - ret = exmap_show_next(buffer, buffer_length);
88 - *buffer_location = buffer;
91 + return exmap_show_next(buf, len);
95 +static const struct file_operations proc_file_fops = {
96 + .owner = THIS_MODULE,
97 + .write = procfile_write,
98 + .read = procfile_read,
102 +static int __init exmap_init(void)
104 struct proc_dir_entry *exmap_proc_file;
105 printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME);
107 - exmap_proc_file = create_proc_entry (PROCFS_NAME,
108 + exmap_proc_file = proc_create (PROCFS_NAME,
114 if (exmap_proc_file == NULL) {
115 - remove_proc_entry (PROCFS_NAME, &proc_root);
116 printk (KERN_ALERT "/proc/%s: could not initialize\n",
121 - exmap_proc_file->read_proc = procfile_read;
122 - exmap_proc_file->write_proc = procfile_write;
123 - exmap_proc_file->owner = THIS_MODULE;
125 - /* exmap_proc_file->mode = S_IFREG | S_IRUGO; */
126 - /* TODO - this is quite probably a security problem */
127 - exmap_proc_file->mode = 0666;
129 - exmap_proc_file->uid = 0;
130 - exmap_proc_file->gid = 0;
131 - exmap_proc_file->size = 0;
137 -void cleanup_module ()
138 +static void __exit exmap_exit(void)
140 - printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
141 - remove_proc_entry (PROCFS_NAME, &proc_root);
142 + remove_proc_entry(PROCFS_NAME, NULL);
145 +module_init(exmap_init);
146 +module_exit(exmap_exit);