Commit e2901099 authored by Prasanna Meda's avatar Prasanna Meda Committed by Linus Torvalds

[PATCH] Add PR_GET_NAME

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: default avatarPrasanna Meda <pmeda@akamai.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4ffd90a1
......@@ -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 */
......@@ -1689,6 +1689,15 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment