Messages in this thread Patch in this message | | | From | cd_smith@ou ... | Date | Thu, 29 Jul 1999 21:09:07 -0500 (CDT) | Subject | Re: [PATCH] New version of mmid patch, against 2.3.12 |
| |
On Thu, 29 Jul 1999, Jeff Garzik wrote: > If you are casting mmid to a long, it should be a long, not an int. Not > good for 64-bit platforms...
Okay, yeah. I'm dumb. And the fix is obvious, but here's the new patch just for the record.
Chris Smith <cd_smith@ou.edu>
diff -Nru linux-save/fs/proc/array.c linux/fs/proc/array.c --- linux-save/fs/proc/array.c Thu Jul 29 08:55:55 1999 +++ linux/fs/proc/array.c Thu Jul 29 15:31:46 1999 @@ -1079,6 +1079,23 @@ size, resident, share, trs, lrs, drs, dt); } +static int get_mm_id(int pid, char * buffer) +{ + struct task_struct *tsk; + unsigned long mm_id = 0; + + read_lock(&tasklist_lock); + tsk = find_task_by_pid(pid); + read_unlock(&tasklist_lock); + + if (!tsk) + return 0; + if (tsk->mm && tsk->mm != &init_mm) + mm_id = (unsigned long) tsk->mm; + + return sprintf(buffer,"%lu\n", mm_id); +} + /* * The way we support synthetic files > 4K * - without storing their contents in some buffer and @@ -1441,6 +1458,8 @@ return get_stat(pid, page); case PROC_PID_STATM: return get_statm(pid, page); + case PROC_PID_MM_ID: + return get_mm_id(pid, page); #ifdef __SMP__ case PROC_PID_CPU: return get_pidcpu(pid, page); diff -Nru linux-save/fs/proc/base.c linux/fs/proc/base.c --- linux-save/fs/proc/base.c Sat Jun 26 14:04:39 1999 +++ linux/fs/proc/base.c Thu Jul 29 09:12:08 1999 @@ -159,6 +159,12 @@ 0, &proc_arraylong_inode_operations, NULL, proc_pid_fill_inode, }; +static struct proc_dir_entry proc_pid_mm_id = { + PROC_PID_MM_ID, 5, "mm_id", + S_IFREG | S_IRUGO, 1, 0, 0, + 0, &proc_array_inode_operations, + NULL, proc_pid_fill_inode, +}; #if CONFIG_AP1000 static struct proc_dir_entry proc_pid_ringbuf = { @@ -194,6 +200,7 @@ proc_register(&proc_pid, &proc_pid_stat); proc_register(&proc_pid, &proc_pid_statm); proc_register(&proc_pid, &proc_pid_maps); + proc_register(&proc_pid, &proc_pid_mm_id); #ifdef __SMP__ proc_register(&proc_pid, &proc_pid_cpu); #endif diff -Nru linux-save/include/linux/proc_fs.h linux/include/linux/proc_fs.h --- linux-save/include/linux/proc_fs.h Wed Jul 7 11:21:05 1999 +++ linux/include/linux/proc_fs.h Thu Jul 29 15:31:55 1999 @@ -70,6 +70,7 @@ PROC_PID_STAT, PROC_PID_STATM, PROC_PID_MAPS, + PROC_PID_MM_ID, #if CONFIG_AP1000 PROC_PID_RINGBUF, #endif
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |