init_main.c (8af5d536ffbd13a97c1332dc307ebf3a8a64c6f4) | init_main.c (4590fd3a2a5539b8a1ce2ad488707123c8b7c8c8) |
---|---|
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 --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 | 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 --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * $Id: init_main.c,v 1.28 1995/08/29 23:59:22 bde Exp $ | 42 * $Id: init_main.c,v 1.29 1995/09/03 05:43:35 julian Exp $ |
43 */ 44 45#include <sys/param.h> 46#include <sys/filedesc.h> 47#include <sys/errno.h> 48#include <sys/exec.h> 49#include <sys/kernel.h> 50#ifdef GPROF --- 166 unchanged lines hidden (view full) --- 217/* 218 * Start a kernel process. This is called after a fork() call in 219 * main() in the file kern/init_main.c. 220 * 221 * This function is used to start "internal" daemons. 222 */ 223/* ARGSUSED*/ 224void | 43 */ 44 45#include <sys/param.h> 46#include <sys/filedesc.h> 47#include <sys/errno.h> 48#include <sys/exec.h> 49#include <sys/kernel.h> 50#ifdef GPROF --- 166 unchanged lines hidden (view full) --- 217/* 218 * Start a kernel process. This is called after a fork() call in 219 * main() in the file kern/init_main.c. 220 * 221 * This function is used to start "internal" daemons. 222 */ 223/* ARGSUSED*/ 224void |
225kproc_start( udata) 226caddr_t udata; /* pointer to a 'kproc_desc' ? */ | 225kproc_start(udata) 226 void *udata; /* pointer to a 'kproc_desc' ? */ |
227{ 228 struct kproc_desc *kp = (struct kproc_desc *)udata; 229 struct proc *p = curproc; 230 231 /* save a global descriptor, if desired*/ 232 if( kp->global_procpp != NULL) 233 *kp->global_procpp = p; 234 --- 32 unchanged lines hidden (view full) --- 267 */ 268#ifdef HPFPLIB 269char copyright[] = 270"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California.\nCopyright (c) 1992 Hewlett-Packard Company\nCopyright (c) 1992 Motorola Inc.\nAll rights reserved.\n\n"; 271#else 272char copyright[] = 273"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California. All rights reserved.\n\n"; 274#endif | 227{ 228 struct kproc_desc *kp = (struct kproc_desc *)udata; 229 struct proc *p = curproc; 230 231 /* save a global descriptor, if desired*/ 232 if( kp->global_procpp != NULL) 233 *kp->global_procpp = p; 234 --- 32 unchanged lines hidden (view full) --- 267 */ 268#ifdef HPFPLIB 269char copyright[] = 270"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California.\nCopyright (c) 1992 Hewlett-Packard Company\nCopyright (c) 1992 Motorola Inc.\nAll rights reserved.\n\n"; 271#else 272char copyright[] = 273"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California. All rights reserved.\n\n"; 274#endif |
275static void print_caddr_t __P((caddr_t data)); | 275static void print_caddr_t __P((void *data)); |
276static void 277print_caddr_t(data) | 276static void 277print_caddr_t(data) |
278 caddr_t data; | 278 void *data; |
279{ 280 printf("%s", (char *)data); 281} 282SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, | 279{ 280 printf("%s", (char *)data); 281} 282SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, |
283 (caddr_t)copyright) | 283 copyright) |
284 285 286/* 287 *************************************************************************** 288 **** 289 **** The two following SYSINT's are proc0 specific glue code. I am not 290 **** convinced that they can not be safely combined, but their order of 291 **** operation has been maintained as the same as the original init_main.c 292 **** for right now. 293 **** 294 **** These probably belong in init_proc.c or kern_proc.c, since they 295 **** deal with proc0 (the fork template process). 296 **** 297 *************************************************************************** 298 */ 299/* ARGSUSED*/ | 284 285 286/* 287 *************************************************************************** 288 **** 289 **** The two following SYSINT's are proc0 specific glue code. I am not 290 **** convinced that they can not be safely combined, but their order of 291 **** operation has been maintained as the same as the original init_main.c 292 **** for right now. 293 **** 294 **** These probably belong in init_proc.c or kern_proc.c, since they 295 **** deal with proc0 (the fork template process). 296 **** 297 *************************************************************************** 298 */ 299/* ARGSUSED*/ |
300void proc0_init __P((caddr_t udata)); | 300void proc0_init __P((void *udata)); |
301void | 301void |
302proc0_init( udata) 303caddr_t udata; /* not used*/ | 302proc0_init(udata) 303 void *udata; /* not used*/ |
304{ 305 register struct proc *p; 306 register struct filedesc0 *fdp; 307 register int i; 308 309 /* 310 * Initialize the current process pointer (curproc) before 311 * any possible traps/probes to simplify trap processing. --- 83 unchanged lines hidden (view full) --- 395 * root for one process. 396 */ 397 usrinfoinit(); 398 (void)chgproccnt(0, 1); 399} 400SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL) 401 402/* ARGSUSED*/ | 304{ 305 register struct proc *p; 306 register struct filedesc0 *fdp; 307 register int i; 308 309 /* 310 * Initialize the current process pointer (curproc) before 311 * any possible traps/probes to simplify trap processing. --- 83 unchanged lines hidden (view full) --- 395 * root for one process. 396 */ 397 usrinfoinit(); 398 (void)chgproccnt(0, 1); 399} 400SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL) 401 402/* ARGSUSED*/ |
403void proc0_post __P((caddr_t udata)); | 403void proc0_post __P((void *udata)); |
404void | 404void |
405proc0_post( udata) 406caddr_t udata; /* not used*/ | 405proc0_post(udata) 406 void *udata; /* not used*/ |
407{ 408 /* 409 * Now can look at time, having had a chance to verify the time 410 * from the file system. Reset p->p_rtime as it may have been 411 * munched in mi_switch() after the time got set. 412 */ 413 proc0.p_stats->p_start = runtime = mono_time = boottime = time; 414 proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0; --- 10 unchanged lines hidden (view full) --- 425 *************************************************************************** 426 **** 427 **** The following SYSINIT's and glue code should be moved to the 428 **** respective files on a per subsystem basis. 429 **** 430 *************************************************************************** 431 */ 432/* ARGSUSED*/ | 407{ 408 /* 409 * Now can look at time, having had a chance to verify the time 410 * from the file system. Reset p->p_rtime as it may have been 411 * munched in mi_switch() after the time got set. 412 */ 413 proc0.p_stats->p_start = runtime = mono_time = boottime = time; 414 proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0; --- 10 unchanged lines hidden (view full) --- 425 *************************************************************************** 426 **** 427 **** The following SYSINIT's and glue code should be moved to the 428 **** respective files on a per subsystem basis. 429 **** 430 *************************************************************************** 431 */ 432/* ARGSUSED*/ |
433void sched_setup __P((caddr_t udata)); | 433void sched_setup __P((void *udata)); |
434void | 434void |
435sched_setup( udata) 436caddr_t udata; /* not used*/ | 435sched_setup(udata) 436 void *udata; /* not used*/ |
437{ 438 /* Kick off timeout driven events by calling first time. */ 439 roundrobin(NULL); 440 schedcpu(NULL); 441} 442SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL) 443 444/* ARGSUSED*/ | 437{ 438 /* Kick off timeout driven events by calling first time. */ 439 roundrobin(NULL); 440 schedcpu(NULL); 441} 442SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL) 443 444/* ARGSUSED*/ |
445void xxx_vfs_mountroot __P((caddr_t udata)); | 445void xxx_vfs_mountroot __P((void *udata)); |
446void | 446void |
447xxx_vfs_mountroot( udata) 448caddr_t udata; /* not used*/ | 447xxx_vfs_mountroot(udata) 448 void *udata; /* not used*/ |
449{ 450 /* Mount the root file system. */ | 449{ 450 /* Mount the root file system. */ |
451 if ((*mountroot)( (caddr_t)mountrootvfsops)) | 451 if ((*mountroot)(mountrootvfsops)) |
452 panic("cannot mount root"); 453} 454SYSINIT(mountroot, SI_SUB_ROOT, SI_ORDER_FIRST, xxx_vfs_mountroot, NULL) 455 456/* ARGSUSED*/ | 452 panic("cannot mount root"); 453} 454SYSINIT(mountroot, SI_SUB_ROOT, SI_ORDER_FIRST, xxx_vfs_mountroot, NULL) 455 456/* ARGSUSED*/ |
457void xxx_vfs_root_fdtab __P((caddr_t udata)); | 457void xxx_vfs_root_fdtab __P((void *udata)); |
458void | 458void |
459xxx_vfs_root_fdtab( udata) 460caddr_t udata; /* not used*/ | 459xxx_vfs_root_fdtab(udata) 460 void *udata; /* not used*/ |
461{ 462 register struct filedesc0 *fdp = &filedesc0; 463 464 /* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */ 465 if (VFS_ROOT(mountlist.cqh_first, &rootvnode)) 466 panic("cannot find root vnode"); 467 fdp->fd_fd.fd_cdir = rootvnode; 468 VREF(fdp->fd_fd.fd_cdir); --- 11 unchanged lines hidden (view full) --- 480 **** 481 **** 1) This code returns to startup the system; this is 482 **** abnormal for a kernel thread. 483 **** 2) This code promiscuously uses init_frame 484 **** 485 *************************************************************************** 486 */ 487 | 461{ 462 register struct filedesc0 *fdp = &filedesc0; 463 464 /* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */ 465 if (VFS_ROOT(mountlist.cqh_first, &rootvnode)) 466 panic("cannot find root vnode"); 467 fdp->fd_fd.fd_cdir = rootvnode; 468 VREF(fdp->fd_fd.fd_cdir); --- 11 unchanged lines hidden (view full) --- 480 **** 481 **** 1) This code returns to startup the system; this is 482 **** abnormal for a kernel thread. 483 **** 2) This code promiscuously uses init_frame 484 **** 485 *************************************************************************** 486 */ 487 |
488static void kthread_init __P(( caddr_t udata)); | 488static void kthread_init __P((void *udata)); |
489SYSINIT_KT(init,SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kthread_init, NULL) 490 491 492static void start_init __P((struct proc *p, void *framep)); 493 494/* ARGSUSED*/ 495static void | 489SYSINIT_KT(init,SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kthread_init, NULL) 490 491 492static void start_init __P((struct proc *p, void *framep)); 493 494/* ARGSUSED*/ 495static void |
496kthread_init( udata) 497caddr_t udata; /* not used*/ | 496kthread_init(udata) 497 void *udata; /* not used*/ |
498{ 499 500 /* Create process 1 (init(8)). */ 501 start_init(curproc, init_framep); 502 503 /* 504 * This is the only kernel thread allowed to return yo the 505 * caller!!! --- 114 unchanged lines hidden --- | 498{ 499 500 /* Create process 1 (init(8)). */ 501 start_init(curproc, init_framep); 502 503 /* 504 * This is the only kernel thread allowed to return yo the 505 * caller!!! --- 114 unchanged lines hidden --- |