patch-kernel_exmap_c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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-10-24 12:27:35.000000000 +0200
  4. @@ -392,7 +392,11 @@ int setup_from_pid(pid_t pid)
  5. struct task_struct *tsk;
  6. int errcode = -EINVAL;
  7. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
  8. + tsk = find_task_by_vpid(pid);
  9. +#else
  10. tsk = find_task_by_pid(pid);
  11. +#endif
  12. if (tsk == NULL) {
  13. printk (KERN_ALERT
  14. "/proc/%s: can't find task for pid %d\n",
  15. @@ -497,40 +501,29 @@ static int procfile_read (char *buffer,
  16. return ret;
  17. }
  18. +static const struct file_operations proc_file_fops = {
  19. + .owner = THIS_MODULE,
  20. + .write = procfile_write,
  21. + .read = procfile_read,
  22. +};
  23. +
  24. +
  25. int init_module ()
  26. {
  27. struct proc_dir_entry *exmap_proc_file;
  28. printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME);
  29. - exmap_proc_file = create_proc_entry (PROCFS_NAME,
  30. + exmap_proc_file = proc_create (PROCFS_NAME,
  31. 0644,
  32. - NULL);
  33. + NULL,
  34. + &proc_file_fops);
  35. if (exmap_proc_file == NULL) {
  36. - remove_proc_entry (PROCFS_NAME, &proc_root);
  37. printk (KERN_ALERT "/proc/%s: could not initialize\n",
  38. PROCFS_NAME);
  39. return -ENOMEM;
  40. }
  41. - exmap_proc_file->read_proc = procfile_read;
  42. - exmap_proc_file->write_proc = procfile_write;
  43. - exmap_proc_file->owner = THIS_MODULE;
  44. -
  45. - /* exmap_proc_file->mode = S_IFREG | S_IRUGO; */
  46. - /* TODO - this is quite probably a security problem */
  47. - exmap_proc_file->mode = 0666;
  48. -
  49. - exmap_proc_file->uid = 0;
  50. - exmap_proc_file->gid = 0;
  51. - exmap_proc_file->size = 0;
  52. -
  53. init_local_data();
  54. return 0;
  55. }
  56. -
  57. -void cleanup_module ()
  58. -{
  59. - printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
  60. - remove_proc_entry (PROCFS_NAME, &proc_root);
  61. -}