Browse Source

fix build with newer kernel, needs runtime testing

Waldemar Brodkorb 10 years ago
parent
commit
06c8931fdb
2 changed files with 44 additions and 17 deletions
  1. 1 1
      package/exmap/Makefile
  2. 43 16
      package/exmap/patches/patch-kernel_exmap_c

+ 1 - 1
package/exmap/Makefile

@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		exmap
 PKG_VERSION:=		0.4.1
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_MD5SUM:=		55aec784e214037e61400287a55b5426
 PKG_DESCR:=		memory analysing client tool
 PKG_SECTION:=		debug

+ 43 - 16
package/exmap/patches/patch-kernel_exmap_c

@@ -1,6 +1,6 @@
 $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
 --- exmap-console-0.4.1.orig/kernel/exmap.c	2006-10-24 20:45:11.000000000 +0200
-+++ exmap-console-0.4.1/kernel/exmap.c	2009-06-11 12:31:45.000000000 +0200
++++ exmap-console-0.4.1/kernel/exmap.c	2013-10-24 12:27:35.000000000 +0200
 @@ -392,7 +392,11 @@ int setup_from_pid(pid_t pid)
  	struct task_struct *tsk;
  	int errcode = -EINVAL;
@@ -13,27 +13,54 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
  	if (tsk == NULL) {
  		printk (KERN_ALERT
  			"/proc/%s: can't find task for pid %d\n",
-@@ -507,7 +511,7 @@ int init_module ()
- 							NULL);
+@@ -497,40 +501,29 @@ static int procfile_read (char *buffer,
+ 	return ret;
+ }
+ 
++static const struct file_operations proc_file_fops = {
++ .owner = THIS_MODULE,
++ .write  = procfile_write,
++ .read  = procfile_read,
++};
++
++
+ int init_module ()
+ {
+ 	struct proc_dir_entry *exmap_proc_file;
+ 	printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME);
+ 	
+-	exmap_proc_file = create_proc_entry (PROCFS_NAME,
++	exmap_proc_file = proc_create (PROCFS_NAME,
+ 							0644,
+-							NULL);
++							NULL,
++					&proc_file_fops);
  
  	if (exmap_proc_file == NULL) {
 -		remove_proc_entry (PROCFS_NAME, &proc_root);
-+		remove_proc_entry (PROCFS_NAME, NULL);
  		printk (KERN_ALERT "/proc/%s: could not initialize\n",
  			PROCFS_NAME);
  		return -ENOMEM;
-@@ -515,7 +519,6 @@ int init_module ()
+ 	}
  	
- 	exmap_proc_file->read_proc = procfile_read;
- 	exmap_proc_file->write_proc = procfile_write;
+-	exmap_proc_file->read_proc = procfile_read;
+-	exmap_proc_file->write_proc = procfile_write;
 -	exmap_proc_file->owner = THIS_MODULE;
- 	
- 	/*     exmap_proc_file->mode         = S_IFREG | S_IRUGO; */
- 	/* TODO - this is quite probably a security problem */
-@@ -532,5 +535,5 @@ int init_module ()
- void cleanup_module ()
- {
- 	printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
--	remove_proc_entry (PROCFS_NAME, &proc_root);
-+	remove_proc_entry (PROCFS_NAME, NULL);
+-	
+-	/*     exmap_proc_file->mode         = S_IFREG | S_IRUGO; */
+-	/* TODO - this is quite probably a security problem */
+-	exmap_proc_file->mode = 0666;
+-	
+-	exmap_proc_file->uid = 0;
+-	exmap_proc_file->gid = 0;
+-	exmap_proc_file->size = 0;
+-
+ 	init_local_data();
+ 	return 0;
  }
+-
+-void cleanup_module ()
+-{
+-	printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
+-	remove_proc_entry (PROCFS_NAME, &proc_root);
+-}