1 /* $OpenBSD: init_main.c,v 1.290 2019/06/21 09:39:48 visa 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/msgbuf.h> 75 #include <sys/mbuf.h> 76 #include <sys/pipe.h> 77 #include <sys/task.h> 78 #include <sys/witness.h> 79 #include <sys/smr.h> 80 81 #include <sys/syscall.h> 82 #include <sys/syscallargs.h> 83 84 #include <uvm/uvm_extern.h> 85 86 #include <dev/rndvar.h> 87 88 #include <ufs/ufs/quota.h> 89 90 #include <net/if.h> 91 #include <net/rtable.h> 92 #include <net/netisr.h> 93 94 #if defined(CRYPTO) 95 #include <crypto/cryptodev.h> 96 #include <crypto/cryptosoft.h> 97 #endif 98 99 #if defined(KUBSAN) 100 extern void kubsan_init(void); 101 extern void kubsan_start(void); 102 #endif 103 104 #if defined(NFSSERVER) || defined(NFSCLIENT) 105 extern void nfs_init(void); 106 #endif 107 108 #include "mpath.h" 109 #include "vscsi.h" 110 #include "softraid.h" 111 112 const char copyright[] = 113 "Copyright (c) 1982, 1986, 1989, 1991, 1993\n" 114 "\tThe Regents of the University of California. All rights reserved.\n" 115 "Copyright (c) 1995-2019 OpenBSD. All rights reserved. https://www.OpenBSD.org\n"; 116 117 /* Components of the first process -- never freed. */ 118 struct session session0; 119 struct pgrp pgrp0; 120 struct proc proc0; 121 struct process process0; 122 struct plimit limit0; 123 struct vmspace vmspace0; 124 struct sigacts sigacts0; 125 struct process *initprocess; 126 struct proc *reaperproc; 127 128 extern struct user *proc0paddr; 129 130 struct vnode *rootvp, *swapdev_vp; 131 int boothowto; 132 int db_active = 0; 133 int ncpus = 1; 134 int ncpusfound = 1; /* number of cpus we find */ 135 volatile int start_init_exec; /* semaphore for start_init() */ 136 137 #if !defined(NO_PROPOLICE) 138 long __guard_local __attribute__((section(".openbsd.randomdata"))); 139 #endif 140 141 /* XXX return int so gcc -Werror won't complain */ 142 int main(void *); 143 void check_console(struct proc *); 144 void start_init(void *); 145 void crypto_init(void); 146 void db_ctf_init(void); 147 void prof_init(void); 148 void init_exec(void); 149 void kqueue_init(void); 150 void futex_init(void); 151 void taskq_init(void); 152 void timeout_proc_init(void); 153 void pool_gc_pages(void *); 154 void percpu_init(void); 155 156 extern char sigcode[], esigcode[], sigcoderet[]; 157 #ifdef SYSCALL_DEBUG 158 extern char *syscallnames[]; 159 #endif 160 161 struct emul emul_native = { 162 "native", 163 NULL, 164 SYS_syscall, 165 SYS_MAXSYSCALL, 166 sysent, 167 #ifdef SYSCALL_DEBUG 168 syscallnames, 169 #else 170 NULL, 171 #endif 172 0, 173 copyargs, 174 setregs, 175 NULL, /* fixup */ 176 NULL, /* coredump */ 177 sigcode, 178 esigcode, 179 sigcoderet 180 }; 181 182 #ifdef DIAGNOSTIC 183 int pdevinit_done = 0; 184 #endif 185 186 /* 187 * System startup; initialize the world, create process 0, mount root 188 * filesystem, and fork to create init and pagedaemon. Most of the 189 * hard work is done in the lower-level initialization routines including 190 * startup(), which does memory initialization and autoconfiguration. 191 */ 192 /* XXX return int, so gcc -Werror won't complain */ 193 int 194 main(void *framep) 195 { 196 struct proc *p; 197 struct process *pr; 198 struct pdevinit *pdev; 199 extern struct pdevinit pdevinit[]; 200 extern void disk_init(void); 201 202 /* 203 * Initialize the current process pointer (curproc) before 204 * any possible traps/probes to simplify trap processing. 205 */ 206 curproc = p = &proc0; 207 p->p_cpu = curcpu(); 208 209 /* 210 * Initialize timeouts. 211 */ 212 timeout_startup(); 213 214 /* 215 * Attempt to find console and initialize 216 * in case of early panic or other messages. 217 */ 218 config_init(); /* init autoconfiguration data structures */ 219 consinit(); 220 221 printf("%s\n", copyright); 222 223 #ifdef KUBSAN 224 /* Initialize kubsan. */ 225 kubsan_init(); 226 #endif 227 228 WITNESS_INITIALIZE(); 229 230 KERNEL_LOCK_INIT(); 231 SCHED_LOCK_INIT(); 232 233 uvm_init(); 234 disk_init(); /* must come before autoconfiguration */ 235 tty_init(); /* initialise tty's */ 236 cpu_startup(); 237 238 random_start(); /* Start the flow */ 239 240 /* 241 * Initialize mbuf's. Do this now because we might attempt to 242 * allocate mbufs or mbuf clusters during autoconfiguration. 243 */ 244 mbinit(); 245 246 /* Initialize sockets. */ 247 soinit(); 248 249 /* Initialize SRP subsystem. */ 250 srp_startup(); 251 252 /* Initialize SMR subsystem. */ 253 smr_startup(); 254 255 /* 256 * Initialize process and pgrp structures. 257 */ 258 procinit(); 259 260 /* Initialize file locking. */ 261 lf_init(); 262 263 /* 264 * Initialize filedescriptors. 265 */ 266 filedesc_init(); 267 268 /* 269 * Initialize pipes. 270 */ 271 pipe_init(); 272 273 /* 274 * Initialize kqueues. 275 */ 276 kqueue_init(); 277 278 /* 279 * Initialize futexes. 280 */ 281 futex_init(); 282 283 /* Create credentials. */ 284 p->p_ucred = crget(); 285 p->p_ucred->cr_ngroups = 1; /* group 0 */ 286 287 /* 288 * Create process 0 (the swapper). 289 */ 290 pr = &process0; 291 process_initialize(pr, p); 292 293 LIST_INSERT_HEAD(&allprocess, pr, ps_list); 294 LIST_INSERT_HEAD(PIDHASH(0), pr, ps_hash); 295 atomic_setbits_int(&pr->ps_flags, PS_SYSTEM); 296 297 /* Set the default routing table/domain. */ 298 process0.ps_rtableid = 0; 299 300 LIST_INSERT_HEAD(&allproc, p, p_list); 301 pr->ps_pgrp = &pgrp0; 302 LIST_INSERT_HEAD(TIDHASH(0), p, p_hash); 303 LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash); 304 LIST_INIT(&pgrp0.pg_members); 305 LIST_INSERT_HEAD(&pgrp0.pg_members, pr, ps_pglist); 306 307 pgrp0.pg_session = &session0; 308 session0.s_count = 1; 309 session0.s_leader = pr; 310 311 atomic_setbits_int(&p->p_flag, P_SYSTEM); 312 p->p_stat = SONPROC; 313 pr->ps_nice = NZERO; 314 pr->ps_emul = &emul_native; 315 strlcpy(pr->ps_comm, "swapper", sizeof(pr->ps_comm)); 316 317 /* Init timeouts. */ 318 timeout_set(&p->p_sleep_to, endtsleep, p); 319 320 /* Initialize signal state for process 0. */ 321 signal_init(); 322 pr->ps_sigacts = &sigacts0; 323 siginit(pr); 324 325 /* Create the file descriptor table. */ 326 p->p_fd = pr->ps_fd = fdinit(); 327 328 /* Create the limits structures. */ 329 lim_startup(&limit0); 330 pr->ps_limit = &limit0; 331 332 /* Allocate a prototype map so we have something to fork. */ 333 uvmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS), 334 trunc_page(VM_MAX_ADDRESS), TRUE, TRUE); 335 p->p_vmspace = pr->ps_vmspace = &vmspace0; 336 337 p->p_addr = proc0paddr; /* XXX */ 338 339 /* 340 * Charge root for one process. 341 */ 342 (void)chgproccnt(0, 1); 343 344 /* Initialize run queues */ 345 sched_init_runqueues(); 346 sleep_queue_init(); 347 sched_init_cpu(curcpu()); 348 p->p_cpu->ci_randseed = (arc4random() & 0x7fffffff) + 1; 349 350 /* Initialize timeouts in process context. */ 351 timeout_proc_init(); 352 353 /* Initialize task queues */ 354 taskq_init(); 355 356 #ifdef KUBSAN 357 /* Start reporting kubsan findings. */ 358 kubsan_start(); 359 #endif 360 361 /* Initialize the interface/address trees */ 362 ifinit(); 363 364 /* Lock the kernel on behalf of proc0. */ 365 KERNEL_LOCK(); 366 367 #if NMPATH > 0 368 /* Attach mpath before hardware */ 369 config_rootfound("mpath", NULL); 370 #endif 371 372 /* Configure the devices */ 373 cpu_configure(); 374 375 /* Configure virtual memory system, set vm rlimits. */ 376 uvm_init_limits(&limit0); 377 378 /* Per CPU memory allocation */ 379 percpu_init(); 380 381 /* Initialize the file systems. */ 382 #if defined(NFSSERVER) || defined(NFSCLIENT) 383 nfs_init(); /* initialize server/shared data */ 384 #endif 385 vfsinit(); 386 387 /* Start real time and statistics clocks. */ 388 initclocks(); 389 390 #ifdef SYSVSHM 391 /* Initialize System V style shared memory. */ 392 shminit(); 393 #endif 394 395 #ifdef SYSVSEM 396 /* Initialize System V style semaphores. */ 397 seminit(); 398 #endif 399 400 #ifdef SYSVMSG 401 /* Initialize System V style message queues. */ 402 msginit(); 403 #endif 404 405 /* Create default routing table before attaching lo0. */ 406 rtable_init(); 407 408 /* Attach pseudo-devices. */ 409 for (pdev = pdevinit; pdev->pdev_attach != NULL; pdev++) 410 if (pdev->pdev_count > 0) 411 (*pdev->pdev_attach)(pdev->pdev_count); 412 #ifdef DIAGNOSTIC 413 pdevinit_done = 1; 414 #endif 415 416 #ifdef CRYPTO 417 crypto_init(); 418 swcr_init(); 419 #endif /* CRYPTO */ 420 421 /* 422 * Initialize protocols. 423 */ 424 domaininit(); 425 426 initconsbuf(); 427 428 #if defined(GPROF) || defined(DDBPROF) 429 /* Initialize kernel profiling. */ 430 prof_init(); 431 #endif 432 433 mbcpuinit(); /* enable per cpu mbuf data */ 434 435 /* init exec and emul */ 436 init_exec(); 437 438 /* Start the scheduler */ 439 scheduler_start(); 440 441 /* 442 * Create process 1 (init(8)). We do this now, as Unix has 443 * historically had init be process 1, and changing this would 444 * probably upset a lot of people. 445 * 446 * Note that process 1 won't immediately exec init(8), but will 447 * wait for us to inform it that the root file system has been 448 * mounted. 449 */ 450 { 451 struct proc *initproc; 452 453 if (fork1(p, FORK_FORK, start_init, NULL, NULL, &initproc)) 454 panic("fork init"); 455 initprocess = initproc->p_p; 456 } 457 458 randompid = 1; 459 460 /* 461 * Create any kernel threads whose creation was deferred because 462 * initprocess had not yet been created. 463 */ 464 kthread_run_deferred_queue(); 465 466 /* 467 * Now that device driver threads have been created, wait for 468 * them to finish any deferred autoconfiguration. Note we don't 469 * need to lock this semaphore, since we haven't booted any 470 * secondary processors, yet. 471 */ 472 while (config_pending) 473 (void) tsleep((void *)&config_pending, PWAIT, "cfpend", 0); 474 475 dostartuphooks(); 476 477 #if NVSCSI > 0 478 config_rootfound("vscsi", NULL); 479 #endif 480 #if NSOFTRAID > 0 481 config_rootfound("softraid", NULL); 482 #endif 483 484 /* Configure root/swap devices */ 485 diskconf(); 486 487 #ifdef DDB 488 /* Make debug symbols available in ddb. */ 489 db_ctf_init(); 490 #endif 491 492 if (mountroot == NULL || ((*mountroot)() != 0)) 493 panic("cannot mount root"); 494 495 TAILQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS; 496 497 /* Get the vnode for '/'. Set p->p_fd->fd_cdir to reference it. */ 498 if (VFS_ROOT(TAILQ_FIRST(&mountlist), &rootvnode)) 499 panic("cannot find root vnode"); 500 p->p_fd->fd_cdir = rootvnode; 501 vref(p->p_fd->fd_cdir); 502 VOP_UNLOCK(rootvnode); 503 p->p_fd->fd_rdir = NULL; 504 505 /* 506 * Now that root is mounted, we can fixup initprocess's CWD 507 * info. All other processes are kthreads, which merely 508 * share proc0's CWD info. 509 */ 510 initprocess->ps_fd->fd_cdir = rootvnode; 511 vref(initprocess->ps_fd->fd_cdir); 512 initprocess->ps_fd->fd_rdir = NULL; 513 514 /* 515 * Now can look at time, having had a chance to verify the time 516 * from the file system. Reset p->p_rtime as it may have been 517 * munched in mi_switch() after the time got set. 518 */ 519 LIST_FOREACH(pr, &allprocess, ps_list) { 520 getnanotime(&pr->ps_start); 521 TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) { 522 nanouptime(&p->p_cpu->ci_schedstate.spc_runtime); 523 timespecclear(&p->p_rtime); 524 } 525 } 526 527 uvm_swap_init(); 528 529 /* Create the pageout daemon kernel thread. */ 530 if (kthread_create(uvm_pageout, NULL, NULL, "pagedaemon")) 531 panic("fork pagedaemon"); 532 533 /* Create the reaper daemon kernel thread. */ 534 if (kthread_create(reaper, NULL, &reaperproc, "reaper")) 535 panic("fork reaper"); 536 537 /* Create the cleaner daemon kernel thread. */ 538 if (kthread_create(buf_daemon, NULL, &cleanerproc, "cleaner")) 539 panic("fork cleaner"); 540 541 /* Create the update daemon kernel thread. */ 542 if (kthread_create(syncer_thread, NULL, &syncerproc, "update")) 543 panic("fork update"); 544 545 /* Create the aiodone daemon kernel thread. */ 546 if (kthread_create(uvm_aiodone_daemon, NULL, NULL, "aiodoned")) 547 panic("fork aiodoned"); 548 549 #if !defined(__hppa__) 550 /* Create the page zeroing kernel thread. */ 551 if (kthread_create(uvm_pagezero_thread, NULL, NULL, "zerothread")) 552 panic("fork zerothread"); 553 #endif 554 555 #if defined(MULTIPROCESSOR) 556 /* Boot the secondary processors. */ 557 cpu_boot_secondary_processors(); 558 #endif 559 560 config_process_deferred_mountroot(); 561 562 /* 563 * Okay, now we can let init(8) exec! It's off to userland! 564 */ 565 start_init_exec = 1; 566 wakeup((void *)&start_init_exec); 567 568 /* 569 * Start the idle pool page garbage collector 570 */ 571 #if !(defined(__m88k__) && defined(MULTIPROCESSOR)) /* XXX */ 572 pool_gc_pages(NULL); 573 #endif 574 575 start_periodic_resettodr(); 576 577 /* 578 * proc0: nothing to do, back to sleep 579 */ 580 while (1) 581 tsleep(&proc0, PVM, "scheduler", 0); 582 /* NOTREACHED */ 583 } 584 585 /* 586 * List of paths to try when searching for "init". 587 */ 588 static char *initpaths[] = { 589 "/sbin/init", 590 "/sbin/oinit", 591 "/sbin/init.bak", 592 NULL, 593 }; 594 595 void 596 check_console(struct proc *p) 597 { 598 struct nameidata nd; 599 int error; 600 601 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console", p); 602 error = namei(&nd); 603 if (error) { 604 if (error == ENOENT) 605 printf("warning: /dev/console does not exist\n"); 606 else 607 printf("warning: /dev/console error %d\n", error); 608 } else 609 vrele(nd.ni_vp); 610 } 611 612 /* 613 * Start the initial user process; try exec'ing each pathname in "initpaths". 614 * The program is invoked with one argument containing the boot flags. 615 */ 616 void 617 start_init(void *arg) 618 { 619 struct proc *p = arg; 620 vaddr_t addr; 621 struct sys_execve_args /* { 622 syscallarg(const char *) path; 623 syscallarg(char *const *) argp; 624 syscallarg(char *const *) envp; 625 } */ args; 626 int options, error; 627 long i; 628 register_t retval[2]; 629 char flags[4], *flagsp; 630 char **pathp, *path, *ucp, **uap, *arg0, *arg1 = NULL; 631 632 /* 633 * Now in process 1. 634 */ 635 636 /* 637 * Wait for main() to tell us that it's safe to exec. 638 */ 639 while (start_init_exec == 0) 640 (void) tsleep((void *)&start_init_exec, PWAIT, "initexec", 0); 641 642 check_console(p); 643 644 /* process 0 ignores SIGCHLD, but we can't */ 645 p->p_p->ps_sigacts->ps_flags = 0; 646 647 /* 648 * Need just enough stack to hold the faked-up "execve()" arguments. 649 */ 650 #ifdef MACHINE_STACK_GROWS_UP 651 addr = USRSTACK; 652 #else 653 addr = USRSTACK - PAGE_SIZE; 654 #endif 655 p->p_vmspace->vm_maxsaddr = (caddr_t)addr; 656 p->p_vmspace->vm_minsaddr = (caddr_t)(addr + PAGE_SIZE); 657 if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, 658 NULL, UVM_UNKNOWN_OFFSET, 0, 659 UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY, 660 MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW|UVM_FLAG_STACK))) 661 panic("init: couldn't allocate argument space"); 662 663 for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) { 664 #ifdef MACHINE_STACK_GROWS_UP 665 ucp = (char *)addr; 666 #else 667 ucp = (char *)(addr + PAGE_SIZE); 668 #endif 669 /* 670 * Construct the boot flag argument. 671 */ 672 flagsp = flags; 673 *flagsp++ = '-'; 674 options = 0; 675 676 if (boothowto & RB_SINGLE) { 677 *flagsp++ = 's'; 678 options = 1; 679 } 680 #ifdef notyet 681 if (boothowto & RB_FASTBOOT) { 682 *flagsp++ = 'f'; 683 options = 1; 684 } 685 #endif 686 687 /* 688 * Move out the flags (arg 1), if necessary. 689 */ 690 if (options != 0) { 691 *flagsp++ = '\0'; 692 i = flagsp - flags; 693 #ifdef DEBUG 694 printf("init: copying out flags `%s' %ld\n", flags, i); 695 #endif 696 #ifdef MACHINE_STACK_GROWS_UP 697 arg1 = ucp; 698 (void)copyout((caddr_t)flags, (caddr_t)ucp, i); 699 ucp += i; 700 #else 701 (void)copyout((caddr_t)flags, (caddr_t)(ucp -= i), i); 702 arg1 = ucp; 703 #endif 704 } 705 706 /* 707 * Move out the file name (also arg 0). 708 */ 709 i = strlen(path) + 1; 710 #ifdef DEBUG 711 printf("init: copying out path `%s' %ld\n", path, i); 712 #endif 713 #ifdef MACHINE_STACK_GROWS_UP 714 arg0 = ucp; 715 (void)copyout((caddr_t)path, (caddr_t)ucp, i); 716 ucp += i; 717 ucp = (caddr_t)ALIGN((u_long)ucp); 718 uap = (char **)ucp + 3; 719 #else 720 (void)copyout((caddr_t)path, (caddr_t)(ucp -= i), i); 721 arg0 = ucp; 722 uap = (char **)((u_long)ucp & ~ALIGNBYTES); 723 #endif 724 725 /* 726 * Move out the arg pointers. 727 */ 728 i = 0; 729 copyout(&i, (caddr_t)--uap, sizeof(register_t)); /* terminator */ 730 if (options != 0) 731 copyout(&arg1, (caddr_t)--uap, sizeof(register_t)); 732 copyout(&arg0, (caddr_t)--uap, sizeof(register_t)); 733 734 /* 735 * Point at the arguments. 736 */ 737 SCARG(&args, path) = arg0; 738 SCARG(&args, argp) = uap; 739 SCARG(&args, envp) = NULL; 740 741 /* 742 * Now try to exec the program. If can't for any reason 743 * other than it doesn't exist, complain. 744 */ 745 if ((error = sys_execve(p, &args, retval)) == 0) { 746 KERNEL_UNLOCK(); 747 return; 748 } 749 if (error != ENOENT) 750 printf("exec %s: error %d\n", path, error); 751 } 752 printf("init: not found\n"); 753 panic("no init"); 754 } 755