svn commit: r232455 - head/sys/kern
Mikolaj Golub
trociny at FreeBSD.org
Sat Mar 3 11:53:36 UTC 2012
Author: trociny
Date: Sat Mar 3 11:53:35 2012
New Revision: 232455
URL: http://svn.freebsd.org/changeset/base/232455
Log:
Make kern.proc.umask sysctl readonly.
Requested by: src
MFC after: 1 week
Modified:
head/sys/kern/kern_proc.c
Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c Sat Mar 3 11:50:48 2012 (r232454)
+++ head/sys/kern/kern_proc.c Sat Mar 3 11:53:35 2012 (r232455)
@@ -2473,8 +2473,7 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL
}
/*
- * This sysctl allows a process to retrieve or/and set umask of
- * another process.
+ * This sysctl allows a process to retrieve umask of another process.
*/
static int
sysctl_kern_proc_umask(SYSCTL_HANDLER_ARGS)
@@ -2488,9 +2487,6 @@ sysctl_kern_proc_umask(SYSCTL_HANDLER_AR
if (namelen != 1)
return (EINVAL);
- if (req->newptr != NULL && req->newlen != sizeof(fd_cmask))
- return (EINVAL);
-
error = pget((pid_t)name[0], PGET_WANTREAD, &p);
if (error != 0)
return (error);
@@ -2498,20 +2494,8 @@ sysctl_kern_proc_umask(SYSCTL_HANDLER_AR
FILEDESC_SLOCK(p->p_fd);
fd_cmask = p->p_fd->fd_cmask;
FILEDESC_SUNLOCK(p->p_fd);
- error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask));
- if (error != 0)
- goto errout;
-
- if (req->newptr != NULL) {
- error = SYSCTL_IN(req, &fd_cmask, sizeof(fd_cmask));
- if (error == 0) {
- FILEDESC_XLOCK(p->p_fd);
- p->p_fd->fd_cmask = fd_cmask & ALLPERMS;
- FILEDESC_XUNLOCK(p->p_fd);
- }
- }
-errout:
PRELE(p);
+ error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask));
return (error);
}
@@ -2617,6 +2601,5 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC
CTLFLAG_MPSAFE, sysctl_kern_proc_ps_strings,
"Process ps_strings location");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RW |
- CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_umask,
- "Process umask");
+static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RD |
+ CTLFLAG_MPSAFE, sysctl_kern_proc_umask, "Process umask");
More information about the svn-src-head
mailing list