Deleted Added
full compact
kern_fork.c (124979) kern_fork.c (125454)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
39 */
40
41#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sys/kern/kern_fork.c 124979 2004-01-25 18:42:18Z rwatson $");
42__FBSDID("$FreeBSD: head/sys/kern/kern_fork.c 125454 2004-02-04 21:52:57Z jhb $");
43
44#include "opt_ktrace.h"
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/sysproto.h>
50#include <sys/eventhandler.h>

--- 252 unchanged lines hidden (view full) ---

303 }
304
305 /*
306 * Increment the count of procs running with this uid. Don't allow
307 * a nonprivileged user to exceed their current limit.
308 */
309 PROC_LOCK(p1);
310 ok = chgproccnt(td->td_ucred->cr_ruidinfo, 1,
43
44#include "opt_ktrace.h"
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/sysproto.h>
50#include <sys/eventhandler.h>

--- 252 unchanged lines hidden (view full) ---

303 }
304
305 /*
306 * Increment the count of procs running with this uid. Don't allow
307 * a nonprivileged user to exceed their current limit.
308 */
309 PROC_LOCK(p1);
310 ok = chgproccnt(td->td_ucred->cr_ruidinfo, 1,
311 (uid != 0) ? p1->p_rlimit[RLIMIT_NPROC].rlim_cur : 0);
311 (uid != 0) ? lim_cur(p1, RLIMIT_NPROC) : 0);
312 PROC_UNLOCK(p1);
313 if (!ok) {
314 error = EAGAIN;
315 goto fail;
316 }
317
318 /*
319 * Increment the nprocs resource before blocking can occur. There

--- 203 unchanged lines hidden (view full) ---

523 p2->p_sigparent = SIGCHLD;
524
525 /* Bump references to the text vnode (for procfs) */
526 p2->p_textvp = p1->p_textvp;
527 if (p2->p_textvp)
528 VREF(p2->p_textvp);
529 p2->p_fd = fd;
530 p2->p_fdtol = fdtol;
312 PROC_UNLOCK(p1);
313 if (!ok) {
314 error = EAGAIN;
315 goto fail;
316 }
317
318 /*
319 * Increment the nprocs resource before blocking can occur. There

--- 203 unchanged lines hidden (view full) ---

523 p2->p_sigparent = SIGCHLD;
524
525 /* Bump references to the text vnode (for procfs) */
526 p2->p_textvp = p1->p_textvp;
527 if (p2->p_textvp)
528 VREF(p2->p_textvp);
529 p2->p_fd = fd;
530 p2->p_fdtol = fdtol;
531 PROC_UNLOCK(p1);
532 PROC_UNLOCK(p2);
533
534 /*
535 * p_limit is copy-on-write, bump refcnt,
536 */
531
532 /*
533 * p_limit is copy-on-write, bump refcnt,
534 */
537 p2->p_limit = p1->p_limit;
538 p2->p_limit->p_refcnt++;
535 p2->p_limit = lim_hold(p1->p_limit);
536 PROC_UNLOCK(p1);
537 PROC_UNLOCK(p2);
539
540 /*
541 * Setup linkage for kernel based threading
542 */
543 if((flags & RFTHREAD) != 0) {
544 mtx_lock(&ppeers_lock);
545 p2->p_peers = p1->p_peers;
546 p1->p_peers = p2;

--- 292 unchanged lines hidden ---
538
539 /*
540 * Setup linkage for kernel based threading
541 */
542 if((flags & RFTHREAD) != 0) {
543 mtx_lock(&ppeers_lock);
544 p2->p_peers = p1->p_peers;
545 p1->p_peers = p2;

--- 292 unchanged lines hidden ---