sys/kern/kern_plimit.c
void
plimit_init0(struct plimit *limit)
{
	int i;
	rlim_t lim;

	for (i = 0; i < RLIM_NLIMITS; ++i) {
		limit->pl_rlimit[i].rlim_cur = RLIM_INFINITY;
		limit->pl_rlimit[i].rlim_max = RLIM_INFINITY;
	}
	limit->pl_rlimit[RLIMIT_NOFILE].rlim_cur = maxfiles;
	limit->pl_rlimit[RLIMIT_NOFILE].rlim_max = maxfiles;
	limit->pl_rlimit[RLIMIT_NPROC].rlim_cur = maxproc;
	limit->pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc;
	lim = ptoa((rlim_t)vmstats.v_free_count);
	limit->pl_rlimit[RLIMIT_RSS].rlim_max = lim;
	limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim;
	limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
	limit->p_cpulimit = RLIM_INFINITY;
	limit->p_refcnt = 1;
	spin_init(&limit->p_spin);
}
/*
 * Initialize proc0's plimit structure.  All later plimit structures
 * are inherited through fork.
 */
Initialize proc0's plimit structure.  All later plimit structures
are inherited through fork.
Initialize proc0 ' s plimit structure . All later plimit structures are inherited through fork .
void
plimit_init0(struct plimit *limit)
{
	int i;
	rlim_t lim;
	for (i = 0; i < RLIM_NLIMITS; ++i) {
		limit->pl_rlimit[i].rlim_cur = RLIM_INFINITY;
		limit->pl_rlimit[i].rlim_max = RLIM_INFINITY;
	}
	limit->pl_rlimit[RLIMIT_NOFILE].rlim_cur = maxfiles;
	limit->pl_rlimit[RLIMIT_NOFILE].rlim_max = maxfiles;
	limit->pl_rlimit[RLIMIT_NPROC].rlim_cur = maxproc;
	limit->pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc;
	lim = ptoa((rlim_t)vmstats.v_free_count);
	limit->pl_rlimit[RLIMIT_RSS].rlim_max = lim;
	limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim;
	limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
	limit->p_cpulimit = RLIM_INFINITY;
	limit->p_refcnt = 1;
	spin_init(&limit->p_spin);
}
void plimit_init0 ( struct plimit * limit ) { int i ; rlim_t lim ; for ( i = 0 ; i < RLIM_NLIMITS ; ++ i ) { limit -> pl_rlimit [ i ] . rlim_cur = RLIM_INFINITY ; limit -> pl_rlimit [ i ] . rlim_max = RLIM_INFINITY ; } limit -> pl_rlimit [ RLIMIT_NOFILE ] . rlim_cur = maxfiles ; limit -> pl_rlimit [ RLIMIT_NOFILE ] . rlim_max = maxfiles ; limit -> pl_rlimit [ RLIMIT_NPROC ] . rlim_cur = maxproc ; limit -> pl_rlimit [ RLIMIT_NPROC ] . rlim_max = maxproc ; lim = ptoa ( ( rlim_t ) vmstats . v_free_count ) ; limit -> pl_rlimit [ RLIMIT_RSS ] . rlim_max = lim ; limit -> pl_rlimit [ RLIMIT_MEMLOCK ] . rlim_max = lim ; limit -> pl_rlimit [ RLIMIT_MEMLOCK ] . rlim_cur = lim / 3 ; limit -> p_cpulimit = RLIM_INFINITY ; limit -> p_refcnt = 1 ; spin_init ( & limit -> p_spin ) ; }
Initialize proc0's plimit structure.
Initialize proc0 ' s plimit structure .