Deleted Added
full compact
init_main.c (124597) init_main.c (125454)
1/*
2 * Copyright (c) 1995 Terrence R. Lambert
3 * All rights reserved.
4 *
5 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 * (c) UNIX System Laboratories, Inc.
8 * All or some portions of this file are derived from material licensed

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

37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * @(#)init_main.c 8.9 (Berkeley) 1/21/94
42 */
43
44#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1995 Terrence R. Lambert
3 * All rights reserved.
4 *
5 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 * (c) UNIX System Laboratories, Inc.
8 * All or some portions of this file are derived from material licensed

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

37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * @(#)init_main.c 8.9 (Berkeley) 1/21/94
42 */
43
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sys/kern/init_main.c 124597 2004-01-16 20:29:23Z rwatson $");
45__FBSDID("$FreeBSD: head/sys/kern/init_main.c 125454 2004-02-04 21:52:57Z jhb $");
46
47#include "opt_init_path.h"
48#include "opt_mac.h"
49
50#include <sys/param.h>
51#include <sys/kernel.h>
52#include <sys/exec.h>
53#include <sys/file.h>

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

88/* Components of the first process -- never freed. */
89static struct session session0;
90static struct pgrp pgrp0;
91struct proc proc0;
92struct thread thread0;
93struct kse kse0;
94struct ksegrp ksegrp0;
95static struct filedesc0 filedesc0;
46
47#include "opt_init_path.h"
48#include "opt_mac.h"
49
50#include <sys/param.h>
51#include <sys/kernel.h>
52#include <sys/exec.h>
53#include <sys/file.h>

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

88/* Components of the first process -- never freed. */
89static struct session session0;
90static struct pgrp pgrp0;
91struct proc proc0;
92struct thread thread0;
93struct kse kse0;
94struct ksegrp ksegrp0;
95static struct filedesc0 filedesc0;
96static struct plimit limit0;
97struct vmspace vmspace0;
98struct proc *initproc;
99
100struct vnode *rootvp;
101int boothowto = 0; /* initialized so that it can be patched */
102SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
103int bootverbose;
104SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");

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

414 fdp->fd_fd.fd_refcnt = 1;
415 fdp->fd_fd.fd_cmask = CMASK;
416 fdp->fd_fd.fd_ofiles = fdp->fd_dfiles;
417 fdp->fd_fd.fd_ofileflags = fdp->fd_dfileflags;
418 fdp->fd_fd.fd_nfiles = NDFILE;
419 fdp->fd_fd.fd_map = fdp->fd_dmap;
420
421 /* Create the limits structures. */
96struct vmspace vmspace0;
97struct proc *initproc;
98
99struct vnode *rootvp;
100int boothowto = 0; /* initialized so that it can be patched */
101SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
102int bootverbose;
103SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");

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

413 fdp->fd_fd.fd_refcnt = 1;
414 fdp->fd_fd.fd_cmask = CMASK;
415 fdp->fd_fd.fd_ofiles = fdp->fd_dfiles;
416 fdp->fd_fd.fd_ofileflags = fdp->fd_dfileflags;
417 fdp->fd_fd.fd_nfiles = NDFILE;
418 fdp->fd_fd.fd_map = fdp->fd_dmap;
419
420 /* Create the limits structures. */
422 p->p_limit = &limit0;
423 for (i = 0; i < sizeof(p->p_rlimit)/sizeof(p->p_rlimit[0]); i++)
424 limit0.pl_rlimit[i].rlim_cur =
425 limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY;
426 limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur =
427 limit0.pl_rlimit[RLIMIT_NOFILE].rlim_max = maxfiles;
428 limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur =
429 limit0.pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc;
421 p->p_limit = lim_alloc();
422 for (i = 0; i < RLIM_NLIMITS; i++)
423 p->p_limit->pl_rlimit[i].rlim_cur =
424 p->p_limit->pl_rlimit[i].rlim_max = RLIM_INFINITY;
425 p->p_limit->pl_rlimit[RLIMIT_NOFILE].rlim_cur =
426 p->p_limit->pl_rlimit[RLIMIT_NOFILE].rlim_max = maxfiles;
427 p->p_limit->pl_rlimit[RLIMIT_NPROC].rlim_cur =
428 p->p_limit->pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc;
430 i = ptoa(cnt.v_free_count);
429 i = ptoa(cnt.v_free_count);
431 limit0.pl_rlimit[RLIMIT_RSS].rlim_max = i;
432 limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = i;
433 limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = i / 3;
434 limit0.p_refcnt = 1;
430 p->p_limit->pl_rlimit[RLIMIT_RSS].rlim_max = i;
431 p->p_limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_max = i;
432 p->p_limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = i / 3;
435 p->p_cpulimit = RLIM_INFINITY;
436
437 /* Allocate a prototype map so we have something to fork. */
438 pmap_pinit0(vmspace_pmap(&vmspace0));
439 p->p_vmspace = &vmspace0;
440 vmspace0.vm_refcnt = 1;
441 vm_map_init(&vmspace0.vm_map, p->p_sysent->sv_minuser,
442 p->p_sysent->sv_maxuser);

--- 279 unchanged lines hidden ---
433 p->p_cpulimit = RLIM_INFINITY;
434
435 /* Allocate a prototype map so we have something to fork. */
436 pmap_pinit0(vmspace_pmap(&vmspace0));
437 p->p_vmspace = &vmspace0;
438 vmspace0.vm_refcnt = 1;
439 vm_map_init(&vmspace0.vm_map, p->p_sysent->sv_minuser,
440 p->p_sysent->sv_maxuser);

--- 279 unchanged lines hidden ---