network/uinet/sys/kern/kern_proc.c
/*
 * This sysctl allows a process to retrieve umask of another process.
 */
This sysctl allows a process to retrieve umask of another process.
This sysctl allows a process to retrieve umask of another process .
static int
sysctl_kern_proc_umask(SYSCTL_HANDLER_ARGS)
{
	int *name = (int *)arg1;
	u_int namelen = arg2;
	struct proc *p;
	int error;
	u_short fd_cmask;
	if (namelen != 1)
		return (EINVAL);
	error = pget((pid_t)name[0], PGET_WANTREAD, &p);
	if (error != 0)
		return (error);
	FILEDESC_SLOCK(p->p_fd);
	fd_cmask = p->p_fd->fd_cmask;
	FILEDESC_SUNLOCK(p->p_fd);
	PRELE(p);
	error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask));
	return (error);
}
static int sysctl_kern_proc_umask ( SYSCTL_HANDLER_ARGS ) { int * name = ( int * ) arg1 ; u_int namelen = arg2 ; struct proc * p ; int error ; u_short fd_cmask ; if ( namelen != 1 ) return ( EINVAL ) ; error = pget ( ( pid_t ) name [ 0 ] , PGET_WANTREAD , & p ) ; if ( error != 0 ) return ( error ) ; FILEDESC_SLOCK ( p -> p_fd ) ; fd_cmask = p -> p_fd -> fd_cmask ; FILEDESC_SUNLOCK ( p -> p_fd ) ; PRELE ( p ) ; error = SYSCTL_OUT ( req , & fd_cmask , sizeof ( fd_cmask ) ) ; return ( error ) ; }
This sysctl allows a process to retrieve umask of another process.
This sysctl allows a process to retrieve umask of another process .