1 /* $OpenBSD: init_main.c,v 1.139 2007/04/12 22:14:15 tedu Exp $ */ 2 /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Christopher G. Demetriou. All rights reserved. 6 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 7 * The Regents of the University of California. All rights reserved. 8 * (c) UNIX System Laboratories, Inc. 9 * All or some portions of this file are derived from material licensed 10 * to the University of California by American Telephone and Telegraph 11 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 12 * the permission of UNIX System Laboratories, Inc. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions 16 * are met: 17 * 1. Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 3. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * @(#)init_main.c 8.9 (Berkeley) 1/21/94 39 */ 40 41 #include <sys/param.h> 42 #include <sys/filedesc.h> 43 #include <sys/file.h> 44 #include <sys/errno.h> 45 #include <sys/exec.h> 46 #include <sys/kernel.h> 47 #include <sys/kthread.h> 48 #include <sys/mount.h> 49 #include <sys/proc.h> 50 #include <sys/resourcevar.h> 51 #include <sys/signalvar.h> 52 #include <sys/systm.h> 53 #include <sys/namei.h> 54 #include <sys/vnode.h> 55 #include <sys/tty.h> 56 #include <sys/conf.h> 57 #include <sys/buf.h> 58 #include <sys/device.h> 59 #include <sys/socketvar.h> 60 #include <sys/lockf.h> 61 #include <sys/protosw.h> 62 #include <sys/reboot.h> 63 #include <sys/user.h> 64 #ifdef SYSVSHM 65 #include <sys/shm.h> 66 #endif 67 #ifdef SYSVSEM 68 #include <sys/sem.h> 69 #endif 70 #ifdef SYSVMSG 71 #include <sys/msg.h> 72 #endif 73 #include <sys/domain.h> 74 #include <sys/mbuf.h> 75 #include <sys/pipe.h> 76 77 #include <sys/syscall.h> 78 #include <sys/syscallargs.h> 79 80 #include <dev/rndvar.h> 81 82 #include <ufs/ufs/quota.h> 83 84 #include <machine/cpu.h> 85 86 #include <uvm/uvm.h> 87 88 #include <net/if.h> 89 #include <net/raw_cb.h> 90 91 #if defined(CRYPTO) 92 #include <crypto/cryptodev.h> 93 #include <crypto/cryptosoft.h> 94 #endif 95 96 #if defined(NFSSERVER) || defined(NFSCLIENT) 97 extern void nfs_init(void); 98 #endif 99 100 #include "softraid.h" 101 102 const char copyright[] = 103 "Copyright (c) 1982, 1986, 1989, 1991, 1993\n" 104 "\tThe Regents of the University of California. All rights reserved.\n" 105 "Copyright (c) 1995-2007 OpenBSD. All rights reserved. http://www.OpenBSD.org\n"; 106 107 /* Components of the first process -- never freed. */ 108 struct session session0; 109 struct pgrp pgrp0; 110 struct proc proc0; 111 struct process process0; 112 struct pcred cred0; 113 struct plimit limit0; 114 struct vmspace vmspace0; 115 struct sigacts sigacts0; 116 #if !defined(__HAVE_CPUINFO) && !defined(curproc) 117 struct proc *curproc; 118 #endif 119 struct proc *initproc; 120 121 int cmask = CMASK; 122 extern struct user *proc0paddr; 123 124 void (*md_diskconf)(void) = NULL; 125 struct vnode *rootvp, *swapdev_vp; 126 int boothowto; 127 struct timeval boottime; 128 #ifndef __HAVE_CPUINFO 129 struct timeval runtime; 130 #endif 131 int ncpus = 1; 132 __volatile int start_init_exec; /* semaphore for start_init() */ 133 134 #if !defined(NO_PROPOLICE) 135 long __guard[8]; 136 #endif 137 138 /* XXX return int so gcc -Werror won't complain */ 139 int main(void *); 140 void check_console(struct proc *); 141 void start_init(void *); 142 void start_cleaner(void *); 143 void start_update(void *); 144 void start_reaper(void *); 145 void start_crypto(void *); 146 void init_exec(void); 147 void kqueue_init(void); 148 149 extern char sigcode[], esigcode[]; 150 #ifdef SYSCALL_DEBUG 151 extern char *syscallnames[]; 152 #endif 153 154 struct emul emul_native = { 155 "native", 156 NULL, 157 sendsig, 158 SYS_syscall, 159 SYS_MAXSYSCALL, 160 sysent, 161 #ifdef SYSCALL_DEBUG 162 syscallnames, 163 #else 164 NULL, 165 #endif 166 0, 167 copyargs, 168 setregs, 169 NULL, 170 sigcode, 171 esigcode, 172 EMUL_ENABLED | EMUL_NATIVE, 173 }; 174 175 176 /* 177 * System startup; initialize the world, create process 0, mount root 178 * filesystem, and fork to create init and pagedaemon. Most of the 179 * hard work is done in the lower-level initialization routines including 180 * startup(), which does memory initialization and autoconfiguration. 181 */ 182 /* XXX return int, so gcc -Werror won't complain */ 183 int 184 main(void *framep) 185 { 186 struct proc *p; 187 struct pdevinit *pdev; 188 struct timeval rtv; 189 quad_t lim; 190 int s, i; 191 extern struct pdevinit pdevinit[]; 192 extern void scheduler_start(void); 193 extern void disk_init(void); 194 extern void endtsleep(void *); 195 extern void realitexpire(void *); 196 197 /* 198 * Initialize the current process pointer (curproc) before 199 * any possible traps/probes to simplify trap processing. 200 */ 201 curproc = p = &proc0; 202 #ifdef __HAVE_CPUINFO 203 p->p_cpu = curcpu(); 204 #endif 205 206 /* 207 * Initialize timeouts. 208 */ 209 timeout_startup(); 210 211 /* 212 * Attempt to find console and initialize 213 * in case of early panic or other messages. 214 */ 215 config_init(); /* init autoconfiguration data structures */ 216 consinit(); 217 218 printf("%s\n", copyright); 219 220 KERNEL_LOCK_INIT(); 221 222 uvm_init(); 223 disk_init(); /* must come before autoconfiguration */ 224 tty_init(); /* initialise tty's */ 225 cpu_startup(); 226 227 /* 228 * Initialize mbuf's. Do this now because we might attempt to 229 * allocate mbufs or mbuf clusters during autoconfiguration. 230 */ 231 mbinit(); 232 233 /* Initialize sockets. */ 234 soinit(); 235 236 /* 237 * Initialize process and pgrp structures. 238 */ 239 procinit(); 240 241 /* Initialize file locking. */ 242 lf_init(); 243 244 /* 245 * Initialize filedescriptors. 246 */ 247 filedesc_init(); 248 249 /* 250 * Initialize pipes. 251 */ 252 pipe_init(); 253 254 /* 255 * Initialize kqueues. 256 */ 257 kqueue_init(); 258 259 /* 260 * Create process 0 (the swapper). 261 */ 262 263 process0.ps_mainproc = p; 264 TAILQ_INIT(&process0.ps_threads); 265 TAILQ_INSERT_TAIL(&process0.ps_threads, p, p_thr_link); 266 p->p_p = &process0; 267 268 LIST_INSERT_HEAD(&allproc, p, p_list); 269 p->p_pgrp = &pgrp0; 270 LIST_INSERT_HEAD(PIDHASH(0), p, p_hash); 271 LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash); 272 LIST_INIT(&pgrp0.pg_members); 273 LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist); 274 275 pgrp0.pg_session = &session0; 276 session0.s_count = 1; 277 session0.s_leader = p; 278 279 atomic_setbits_int(&p->p_flag, P_SYSTEM | P_NOCLDWAIT); 280 p->p_stat = SONPROC; 281 p->p_nice = NZERO; 282 p->p_emul = &emul_native; 283 bcopy("swapper", p->p_comm, sizeof ("swapper")); 284 285 /* Init timeouts. */ 286 timeout_set(&p->p_sleep_to, endtsleep, p); 287 timeout_set(&p->p_realit_to, realitexpire, p); 288 289 /* Create credentials. */ 290 cred0.p_refcnt = 1; 291 p->p_cred = &cred0; 292 p->p_ucred = crget(); 293 p->p_ucred->cr_ngroups = 1; /* group 0 */ 294 295 /* Initialize signal state for process 0. */ 296 signal_init(); 297 p->p_sigacts = &sigacts0; 298 siginit(p); 299 300 /* Create the file descriptor table. */ 301 p->p_fd = fdinit(NULL); 302 303 TAILQ_INIT(&p->p_selects); 304 305 /* Create the limits structures. */ 306 p->p_p->ps_limit = &limit0; 307 for (i = 0; i < sizeof(p->p_rlimit)/sizeof(p->p_rlimit[0]); i++) 308 limit0.pl_rlimit[i].rlim_cur = 309 limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY; 310 limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur = NOFILE; 311 limit0.pl_rlimit[RLIMIT_NOFILE].rlim_max = MIN(NOFILE_MAX, 312 (maxfiles - NOFILE > NOFILE) ? maxfiles - NOFILE : NOFILE); 313 limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = MAXUPRC; 314 lim = ptoa(uvmexp.free); 315 limit0.pl_rlimit[RLIMIT_RSS].rlim_max = lim; 316 limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim; 317 limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3; 318 limit0.p_refcnt = 1; 319 320 /* Allocate a prototype map so we have something to fork. */ 321 uvmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS), 322 trunc_page(VM_MAX_ADDRESS), TRUE); 323 p->p_vmspace = &vmspace0; 324 325 p->p_addr = proc0paddr; /* XXX */ 326 327 /* 328 * We continue to place resource usage info in the 329 * user struct so they're pageable. 330 */ 331 p->p_stats = &p->p_addr->u_stats; 332 333 /* 334 * Charge root for one process. 335 */ 336 (void)chgproccnt(0, 1); 337 338 /* Initialize run queues */ 339 rqinit(); 340 341 /* Configure the devices */ 342 cpu_configure(); 343 344 /* Configure virtual memory system, set vm rlimits. */ 345 uvm_init_limits(p); 346 347 /* Initialize the file systems. */ 348 #if defined(NFSSERVER) || defined(NFSCLIENT) 349 nfs_init(); /* initialize server/shared data */ 350 #endif 351 vfsinit(); 352 353 /* Start real time and statistics clocks. */ 354 initclocks(); 355 356 /* Lock the kernel on behalf of proc0. */ 357 KERNEL_PROC_LOCK(p); 358 359 #ifdef SYSVSHM 360 /* Initialize System V style shared memory. */ 361 shminit(); 362 #endif 363 364 #ifdef SYSVSEM 365 /* Initialize System V style semaphores. */ 366 seminit(); 367 #endif 368 369 #ifdef SYSVMSG 370 /* Initialize System V style message queues. */ 371 msginit(); 372 #endif 373 374 /* Attach pseudo-devices. */ 375 randomattach(); 376 for (pdev = pdevinit; pdev->pdev_attach != NULL; pdev++) 377 if (pdev->pdev_count > 0) 378 (*pdev->pdev_attach)(pdev->pdev_count); 379 380 #ifdef CRYPTO 381 swcr_init(); 382 #endif /* CRYPTO */ 383 384 /* 385 * Initialize protocols. Block reception of incoming packets 386 * until everything is ready. 387 */ 388 s = splnet(); 389 ifinit(); 390 domaininit(); 391 if_attachdomain(); 392 splx(s); 393 394 #ifdef GPROF 395 /* Initialize kernel profiling. */ 396 kmstartup(); 397 #endif 398 399 #if !defined(NO_PROPOLICE) 400 { 401 volatile long newguard[8]; 402 int i; 403 404 arc4random_bytes((long *)newguard, sizeof(newguard)); 405 406 for (i = sizeof(__guard)/sizeof(__guard[0]) - 1; i; i--) 407 __guard[i] = newguard[i]; 408 } 409 #endif 410 411 /* init exec and emul */ 412 init_exec(); 413 414 /* Start the scheduler */ 415 scheduler_start(); 416 417 /* 418 * Create process 1 (init(8)). We do this now, as Unix has 419 * historically had init be process 1, and changing this would 420 * probably upset a lot of people. 421 * 422 * Note that process 1 won't immediately exec init(8), but will 423 * wait for us to inform it that the root file system has been 424 * mounted. 425 */ 426 if (fork1(p, SIGCHLD, FORK_FORK, NULL, 0, start_init, NULL, NULL, 427 &initproc)) 428 panic("fork init"); 429 430 /* 431 * Create any kernel threads whose creation was deferred because 432 * initproc had not yet been created. 433 */ 434 kthread_run_deferred_queue(); 435 436 /* 437 * Now that device driver threads have been created, wait for 438 * them to finish any deferred autoconfiguration. Note we don't 439 * need to lock this semaphore, since we haven't booted any 440 * secondary processors, yet. 441 */ 442 while (config_pending) 443 (void) tsleep((void *)&config_pending, PWAIT, "cfpend", 0); 444 445 dostartuphooks(); 446 447 #if NSOFTRAID > 0 448 config_rootfound("softraid", NULL); 449 #endif 450 451 /* Configure root/swap devices */ 452 if (md_diskconf) 453 (*md_diskconf)(); 454 455 /* Mount the root file system. */ 456 if (vfs_mountroot()) 457 panic("cannot mount root"); 458 CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS; 459 460 /* Get the vnode for '/'. Set p->p_fd->fd_cdir to reference it. */ 461 if (VFS_ROOT(CIRCLEQ_FIRST(&mountlist), &rootvnode)) 462 panic("cannot find root vnode"); 463 p->p_fd->fd_cdir = rootvnode; 464 VREF(p->p_fd->fd_cdir); 465 VOP_UNLOCK(rootvnode, 0, p); 466 p->p_fd->fd_rdir = NULL; 467 468 /* 469 * Now that root is mounted, we can fixup initproc's CWD 470 * info. All other processes are kthreads, which merely 471 * share proc0's CWD info. 472 */ 473 initproc->p_fd->fd_cdir = rootvnode; 474 VREF(initproc->p_fd->fd_cdir); 475 initproc->p_fd->fd_rdir = NULL; 476 477 /* 478 * Now can look at time, having had a chance to verify the time 479 * from the file system. Reset p->p_rtime as it may have been 480 * munched in mi_switch() after the time got set. 481 */ 482 #ifdef __HAVE_TIMECOUNTER 483 microtime(&boottime); 484 #else 485 boottime = mono_time = time; 486 #endif 487 #ifndef __HAVE_CPUINFO 488 microuptime(&runtime); 489 #endif 490 LIST_FOREACH(p, &allproc, p_list) { 491 p->p_stats->p_start = boottime; 492 #ifdef __HAVE_CPUINFO 493 microuptime(&p->p_cpu->ci_schedstate.spc_runtime); 494 #endif 495 p->p_rtime.tv_sec = p->p_rtime.tv_usec = 0; 496 } 497 498 uvm_swap_init(); 499 500 /* Create the pageout daemon kernel thread. */ 501 if (kthread_create(uvm_pageout, NULL, NULL, "pagedaemon")) 502 panic("fork pagedaemon"); 503 504 /* Create the reaper daemon kernel thread. */ 505 if (kthread_create(start_reaper, NULL, NULL, "reaper")) 506 panic("fork reaper"); 507 508 /* Create the cleaner daemon kernel thread. */ 509 if (kthread_create(start_cleaner, NULL, NULL, "cleaner")) 510 panic("fork cleaner"); 511 512 /* Create the update daemon kernel thread. */ 513 if (kthread_create(start_update, NULL, NULL, "update")) 514 panic("fork update"); 515 516 /* Create the aiodone daemon kernel thread. */ 517 if (kthread_create(uvm_aiodone_daemon, NULL, NULL, "aiodoned")) 518 panic("fork aiodoned"); 519 520 #ifdef CRYPTO 521 /* Create the crypto kernel thread. */ 522 if (kthread_create(start_crypto, NULL, NULL, "crypto")) 523 panic("crypto thread"); 524 #endif /* CRYPTO */ 525 526 microtime(&rtv); 527 srandom((u_long)(rtv.tv_sec ^ rtv.tv_usec)); 528 529 randompid = 1; 530 531 #if defined(MULTIPROCESSOR) 532 /* Boot the secondary processors. */ 533 cpu_boot_secondary_processors(); 534 #endif 535 536 domountroothooks(); 537 538 /* 539 * Okay, now we can let init(8) exec! It's off to userland! 540 */ 541 start_init_exec = 1; 542 wakeup((void *)&start_init_exec); 543 544 /* The scheduler is an infinite loop. */ 545 uvm_scheduler(); 546 /* NOTREACHED */ 547 } 548 549 /* 550 * List of paths to try when searching for "init". 551 */ 552 static char *initpaths[] = { 553 "/sbin/init", 554 "/sbin/oinit", 555 "/sbin/init.bak", 556 NULL, 557 }; 558 559 void 560 check_console(struct proc *p) 561 { 562 struct nameidata nd; 563 int error; 564 565 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console", p); 566 error = namei(&nd); 567 if (error) { 568 if (error == ENOENT) 569 printf("warning: /dev/console does not exist\n"); 570 else 571 printf("warning: /dev/console error %d\n", error); 572 } else 573 vrele(nd.ni_vp); 574 } 575 576 /* 577 * Start the initial user process; try exec'ing each pathname in "initpaths". 578 * The program is invoked with one argument containing the boot flags. 579 */ 580 void 581 start_init(void *arg) 582 { 583 struct proc *p = arg; 584 vaddr_t addr; 585 struct sys_execve_args /* { 586 syscallarg(const char *) path; 587 syscallarg(char *const *) argp; 588 syscallarg(char *const *) envp; 589 } */ args; 590 int options, error; 591 long i; 592 register_t retval[2]; 593 char flags[4], *flagsp; 594 char **pathp, *path, *ucp, **uap, *arg0, *arg1 = NULL; 595 596 /* 597 * Now in process 1. 598 */ 599 600 /* 601 * Wait for main() to tell us that it's safe to exec. 602 */ 603 while (start_init_exec == 0) 604 (void) tsleep((void *)&start_init_exec, PWAIT, "initexec", 0); 605 606 check_console(p); 607 608 /* 609 * Need just enough stack to hold the faked-up "execve()" arguments. 610 */ 611 #ifdef MACHINE_STACK_GROWS_UP 612 addr = USRSTACK; 613 #else 614 addr = USRSTACK - PAGE_SIZE; 615 #endif 616 if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, 617 NULL, UVM_UNKNOWN_OFFSET, 0, 618 UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_ALL, UVM_INH_COPY, 619 UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))) 620 panic("init: couldn't allocate argument space"); 621 p->p_vmspace->vm_maxsaddr = (caddr_t)addr; 622 623 for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) { 624 #ifdef MACHINE_STACK_GROWS_UP 625 ucp = (char *)addr; 626 #else 627 ucp = (char *)(addr + PAGE_SIZE); 628 #endif 629 /* 630 * Construct the boot flag argument. 631 */ 632 flagsp = flags; 633 *flagsp++ = '-'; 634 options = 0; 635 636 if (boothowto & RB_SINGLE) { 637 *flagsp++ = 's'; 638 options = 1; 639 } 640 #ifdef notyet 641 if (boothowto & RB_FASTBOOT) { 642 *flagsp++ = 'f'; 643 options = 1; 644 } 645 #endif 646 647 /* 648 * Move out the flags (arg 1), if necessary. 649 */ 650 if (options != 0) { 651 *flagsp++ = '\0'; 652 i = flagsp - flags; 653 #ifdef DEBUG 654 printf("init: copying out flags `%s' %d\n", flags, i); 655 #endif 656 #ifdef MACHINE_STACK_GROWS_UP 657 arg1 = ucp; 658 (void)copyout((caddr_t)flags, (caddr_t)ucp, i); 659 ucp += i; 660 #else 661 (void)copyout((caddr_t)flags, (caddr_t)(ucp -= i), i); 662 arg1 = ucp; 663 #endif 664 } 665 666 /* 667 * Move out the file name (also arg 0). 668 */ 669 i = strlen(path) + 1; 670 #ifdef DEBUG 671 printf("init: copying out path `%s' %d\n", path, i); 672 #endif 673 #ifdef MACHINE_STACK_GROWS_UP 674 arg0 = ucp; 675 (void)copyout((caddr_t)path, (caddr_t)ucp, i); 676 ucp += i; 677 ucp = (caddr_t)ALIGN((u_long)ucp); 678 uap = (char **)ucp + 3; 679 #else 680 (void)copyout((caddr_t)path, (caddr_t)(ucp -= i), i); 681 arg0 = ucp; 682 uap = (char **)((u_long)ucp & ~ALIGNBYTES); 683 #endif 684 685 /* 686 * Move out the arg pointers. 687 */ 688 i = 0; 689 copyout(&i, (caddr_t)--uap, sizeof(register_t)); /* terminator */ 690 if (options != 0) 691 copyout(&arg1, (caddr_t)--uap, sizeof(register_t)); 692 copyout(&arg0, (caddr_t)--uap, sizeof(register_t)); 693 694 /* 695 * Point at the arguments. 696 */ 697 SCARG(&args, path) = arg0; 698 SCARG(&args, argp) = uap; 699 SCARG(&args, envp) = NULL; 700 701 /* 702 * Now try to exec the program. If can't for any reason 703 * other than it doesn't exist, complain. 704 */ 705 if ((error = sys_execve(p, &args, retval)) == 0) { 706 KERNEL_PROC_UNLOCK(p); 707 return; 708 } 709 if (error != ENOENT) 710 printf("exec %s: error %d\n", path, error); 711 } 712 printf("init: not found\n"); 713 panic("no init"); 714 } 715 716 void 717 start_update(void *arg) 718 { 719 sched_sync(curproc); 720 /* NOTREACHED */ 721 } 722 723 void 724 start_cleaner(void *arg) 725 { 726 buf_daemon(curproc); 727 /* NOTREACHED */ 728 } 729 730 void 731 start_reaper(void *arg) 732 { 733 reaper(); 734 /* NOTREACHED */ 735 } 736 737 #ifdef CRYPTO 738 void 739 start_crypto(void *arg) 740 { 741 crypto_thread(); 742 /* NOTREACHED */ 743 } 744 #endif /* CRYPTO */ 745