Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144362496
D12972.id34852.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12972.id34852.diff
View Options
Index: lib/libc/gen/setmode.c
===================================================================
--- lib/libc/gen/setmode.c
+++ lib/libc/gen/setmode.c
@@ -356,7 +356,7 @@
* security.bsd.unprivileged_proc_debug is set to 0.
*/
len = sizeof(smask);
- if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, getpid() },
+ if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, 0 },
4, &smask, &len, NULL, 0) == 0)
return (smask);
Index: sys/kern/kern_proc.c
===================================================================
--- sys/kern/kern_proc.c
+++ sys/kern/kern_proc.c
@@ -2770,11 +2770,19 @@
struct proc *p;
int error;
u_short fd_cmask;
+ pid_t pid;
if (namelen != 1)
return (EINVAL);
- error = pget((pid_t)name[0], PGET_WANTREAD, &p);
+ pid = (pid_t)name[0];
+ p = curproc;
+ if (pid == p->p_pid || pid == 0) {
+ fd_cmask = p->p_fd->fd_cmask;
+ goto out;
+ }
+
+ error = pget(pid, PGET_WANTREAD, &p);
if (error != 0)
return (error);
@@ -2782,6 +2790,7 @@
fd_cmask = p->p_fd->fd_cmask;
FILEDESC_SUNLOCK(p->p_fd);
PRELE(p);
+out:
error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask));
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 1:29 AM (18 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28521231
Default Alt Text
D12972.id34852.diff (1 KB)
Attached To
Mode
D12972: sysctl_kern_proc_umask: fast path when operating on curproc
Attached
Detach File
Event Timeline
Log In to Comment