sys/kern/kern_plimit.c
void
plimit_lwp_fork(struct proc *p)
{
	struct plimit *olimit;

	for (;;) {
		olimit = p->p_limit;
		if (olimit->p_exclusive == 2) {
			KKASSERT(olimit->p_refcnt == 1);
			break;
		}
		if (olimit->p_refcnt == 1) {
			olimit->p_exclusive = 2;
			break;
		}
		plimit_modify(p, -1, NULL);
	}
}
/*
 * This routine is called when a new LWP is created for a process.  We
 * must force exclusivity (=2) so p->p_limit remains stable.
 *
 * LWPs share the same process structure so this does not bump refcnt.
 */
This routine is called when a new LWP is created for a process.  We
must force exclusivity (=2) so p->p_limit remains stable.

LWPs share the same process structure so this does not bump refcnt.
This routine is called when a new LWP is created for a process . We must force exclusivity ( = 2 ) so p - > p_limit remains stable . LWPs share the same process structure so this does not bump refcnt .
void
plimit_lwp_fork(struct proc *p)
{
	struct plimit *olimit;
	for (;;) {
		olimit = p->p_limit;
		if (olimit->p_exclusive == 2) {
			KKASSERT(olimit->p_refcnt == 1);
			break;
		}
		if (olimit->p_refcnt == 1) {
			olimit->p_exclusive = 2;
			break;
		}
		plimit_modify(p, -1, NULL);
	}
}
void plimit_lwp_fork ( struct proc * p ) { struct plimit * olimit ; for ( ; ; ) { olimit = p -> p_limit ; if ( olimit -> p_exclusive == 2 ) { KKASSERT ( olimit -> p_refcnt == 1 ) ; break ; } if ( olimit -> p_refcnt == 1 ) { olimit -> p_exclusive = 2 ; break ; } plimit_modify ( p , -1 , NULL ) ; } }
This routine is called when a new LWP is created for a process.
This routine is called when a new LWP is created for a process .