sys/kern/kern_plimit.c
int
kern_getrlimit(u_int which, struct rlimit *limp)
{
	struct proc *p = curproc;
	struct plimit *limit;

	/*
	 * p is NULL when kern_getrlimit is called from a
	 * kernel thread. In this case as the calling proc
	 * isn't available we just skip the limit check.
	 */
	if (p == NULL)
		return 0;

        if (which >= RLIM_NLIMITS)
                return (EINVAL);

	limit = p->p_limit;
	spin_lock(&limit->p_spin);
        *limp = p->p_rlimit[which];
	spin_unlock(&limit->p_spin);
        return (0);
}
/*
 * The rlimit indexed by which is returned in the second argument.
 *
 * MPSAFE
 */
The rlimit indexed by which is returned in the second argument.
MPSAFE
The rlimit indexed by which is returned in the second argument . MPSAFE
int
kern_getrlimit(u_int which, struct rlimit *limp)
{
	struct proc *p = curproc;
	struct plimit *limit;
	if (p == NULL)
		return 0;
        if (which >= RLIM_NLIMITS)
                return (EINVAL);
	limit = p->p_limit;
	spin_lock(&limit->p_spin);
        *limp = p->p_rlimit[which];
	spin_unlock(&limit->p_spin);
        return (0);
}
int kern_getrlimit ( u_int which , struct rlimit * limp ) { struct proc * p = curproc ; struct plimit * limit ; if ( p == NULL ) return 0 ; if ( which >= RLIM_NLIMITS ) return ( EINVAL ) ; limit = p -> p_limit ; spin_lock ( & limit -> p_spin ) ; * limp = p -> p_rlimit [ which ] ; spin_unlock ( & limit -> p_spin ) ; return ( 0 ) ; }
The rlimit indexed by which is returned in the second argument.
The rlimit indexed by which is returned in the second argument .
/*
	 * p is NULL when kern_getrlimit is called from a
	 * kernel thread. In this case as the calling proc
	 * isn't available we just skip the limit check.
	 */