X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0b4e3aa066abc0728aacb4bbeb86f53f9737156e..d52fe63fc81f7e44faaae711812a211a78434976:/bsd/kern/bsd_init.c diff --git a/bsd/kern/bsd_init.c b/bsd/kern/bsd_init.c index 3042dfd67..6a055af65 100644 --- a/bsd/kern/bsd_init.c +++ b/bsd/kern/bsd_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -107,6 +107,13 @@ #include #include +#include +#include +#include +#include +#include +#include + extern shared_region_mapping_t system_shared_region; char copyright[] = @@ -171,8 +178,10 @@ int lbolt; /* awoken once a second */ struct vnode *rootvp; int boothowto = RB_DEBUG; +#define BSD_PAGABLE_MAP_SIZE (4 * 512 * 1024) vm_map_t bsd_pageable_map; vm_map_t mb_map; +semaphore_t execve_semaphore; int cmask = CMASK; @@ -204,7 +213,8 @@ int enable_funnel = 0; /* disables split funnel */ /* * Sets the name for the given task. */ -void proc_name(s, p) +void +proc_name(s, p) char *s; struct proc *p; { @@ -265,7 +275,7 @@ bsd_init() kernel_flock = funnel_alloc(KERNEL_FUNNEL); if (kernel_flock == (funnel_t *)0 ) { - panic("fail to allocate kernel mutex lock\n"); + panic("bsd_init: Fail to allocate kernel mutex lock"); } @@ -274,7 +284,7 @@ bsd_init() if (!disable_funnel) { network_flock = funnel_alloc(NETWORK_FUNNEL); if (network_flock == (funnel_t *)0 ) { - panic("fail to allocate network mutex lock\n"); + panic("bds_init: Fail to allocate network mutex lock"); } } else { network_flock = kernel_flock; @@ -370,19 +380,32 @@ bsd_init() /* * Allocate a kernel submap for pageable memory - * for temporary copying (table(), execve()). + * for temporary copying (execve()). */ { vm_offset_t min; ret = kmem_suballoc(kernel_map, &min, - (vm_size_t)512*1024, + (vm_size_t)BSD_PAGABLE_MAP_SIZE, TRUE, TRUE, &bsd_pageable_map); if (ret != KERN_SUCCESS) - panic("Failed to allocare bsd pageable map\n"); + panic("bsd_init: Failed to allocare bsd pageable map"); + } + + /* Initialize the execve() semaphore */ + { + kern_return_t kret; + int value; + + value = BSD_PAGABLE_MAP_SIZE / NCARGS; + + kret = semaphore_create(kernel_task, &execve_semaphore, + SYNC_POLICY_FIFO, value); + if (kret != KERN_SUCCESS) + panic("bsd_init: Failed to create execve semaphore"); } /* @@ -472,9 +495,9 @@ bsd_init() /* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */ if (VFS_ROOT(mountlist.cqh_first, &rootvnode)) - panic("cannot find root vnode"); - filedesc0.fd_cdir = rootvnode; + panic("bsd_init: cannot find root vnode"); VREF(rootvnode); + filedesc0.fd_cdir = rootvnode; VOP_UNLOCK(rootvnode, 0, p);