
From: pmeda@akamai.com

A while back we added the PR_SET_NAME prctl, but no PR_GET_NAME.  I guess
we should add this, if only to enable testing of PR_SET_NAME.

Signed-off-by: Prasanna Meda <pmeda@akamai.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/prctl.h |    1 +
 25-akpm/kernel/sys.c          |    9 +++++++++
 2 files changed, 10 insertions(+)

diff -puN include/linux/prctl.h~add-pr_get_name include/linux/prctl.h
--- 25/include/linux/prctl.h~add-pr_get_name	2004-12-03 20:56:02.036450600 -0800
+++ 25-akpm/include/linux/prctl.h	2004-12-03 20:56:02.041449840 -0800
@@ -50,5 +50,6 @@
                                                    process timing */
 
 #define PR_SET_NAME    15		/* Set process name */
+#define PR_GET_NAME    16		/* Get process name */
 
 #endif /* _LINUX_PRCTL_H */
diff -puN kernel/sys.c~add-pr_get_name kernel/sys.c
--- 25/kernel/sys.c~add-pr_get_name	2004-12-03 20:56:02.038450296 -0800
+++ 25-akpm/kernel/sys.c	2004-12-03 20:56:02.042449688 -0800
@@ -1689,6 +1689,15 @@ asmlinkage long sys_prctl(int option, un
 			set_task_comm(me, ncomm);
 			return 0;
 		}
+		case PR_GET_NAME: {
+			struct task_struct *me = current;
+			unsigned char tcomm[sizeof(me->comm)];
+
+			get_task_comm(tcomm, me);
+			if (copy_to_user((char __user *)arg2, tcomm, sizeof(tcomm)))
+				return -EFAULT;
+			return 0;
+		}
 		default:
 			error = -EINVAL;
 			break;
_
