393 struct pidrec {
394 int pd_type; /* Command type */
395 pid_t pd_pid; /* pid to add or remove */
396 };
397
398 /*
399 * pd_type's
400 */
401 #define ADDPID 1
402 #define REMPID 2
403
404 static struct pidlist {
405 pid_t pl_pid; /* pid to watch for */
406 int pl_dflag; /* Flag indicating SIGCLD from this pid */
407 short pl_exit; /* Exit status of proc */
408 struct pidlist *pl_next; /* Next in list */
409 } *Plhead, *Plfree;
410
411 /*
412 * The following structure contains a set of modes for /dev/syscon
413 * and should match the default contents of /etc/ioctl.syscon. It should also
414 * be kept in-sync with base_termios in uts/common/io/ttcompat.c.
415 */
416 static struct termios dflt_termios = {
417 BRKINT|ICRNL|IXON|IMAXBEL, /* iflag */
418 OPOST|ONLCR|TAB3, /* oflag */
419 CS8|CREAD|B9600, /* cflag */
420 ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN, /* lflag */
421 CINTR, CQUIT, CERASE, CKILL, CEOF, 0, 0, 0,
422 0, 0, 0, 0, 0, 0, 0, 0,
423 0, 0, 0
424 };
425
426 static struct termios stored_syscon_termios;
427 static int write_ioctl = 0; /* Rewrite /etc/ioctl.syscon */
428
429 static union WAKEUP {
430 struct WAKEFLAGS {
431 unsigned w_usersignal : 1; /* User sent signal to "init" */
432 unsigned w_childdeath : 1; /* An "init" child died */
433 unsigned w_powerhit : 1; /* OS experienced powerfail */
434 } w_flags;
435 int w_mask;
436 } wakeup;
437
438
439 struct init_state {
440 int ist_runlevel;
441 int ist_num_proc;
442 int ist_utmpx_ok;
443 struct PROC_TABLE ist_proc_table[1];
682 */
683 (void) uname(&un);
684 ret = sysinfo(SI_ISALIST, buf, sizeof (buf));
685 if (ret != -1L && ret <= sizeof (buf)) {
686 for (isa = strtok(buf, " "); isa;
687 isa = strtok(NULL, " ")) {
688 if (strcmp(isa, "sparcv9") == 0 ||
689 strcmp(isa, "amd64") == 0) {
690 bits = 64;
691 break;
692 }
693 }
694 }
695
696 console(B_FALSE,
697 "\n\n%s Release %s Version %s %d-bit\r\n",
698 un.sysname, un.release, un.version, bits);
699 console(B_FALSE,
700 "Copyright (c) 1983, 2010, Oracle and/or its affiliates."
701 " All rights reserved.\r\n");
702 }
703
704 /*
705 * Get the ioctl settings for /dev/syscon from /etc/ioctl.syscon
706 * so that it can be brought up in the state it was in when the
707 * system went down; or set to defaults if ioctl.syscon isn't
708 * valid.
709 *
710 * This needs to be done even if we're restarting so reset_modes()
711 * will work in case we need to go down to single user mode.
712 */
713 write_ioctl = get_ioctl_syscon();
714
715 /*
716 * Set up all signals to be caught or ignored as appropriate.
717 */
718 init_signals();
719
720 /* Load glob_envp from ENVFILE. */
721 init_env();
|
393 struct pidrec {
394 int pd_type; /* Command type */
395 pid_t pd_pid; /* pid to add or remove */
396 };
397
398 /*
399 * pd_type's
400 */
401 #define ADDPID 1
402 #define REMPID 2
403
404 static struct pidlist {
405 pid_t pl_pid; /* pid to watch for */
406 int pl_dflag; /* Flag indicating SIGCLD from this pid */
407 short pl_exit; /* Exit status of proc */
408 struct pidlist *pl_next; /* Next in list */
409 } *Plhead, *Plfree;
410
411 /*
412 * The following structure contains a set of modes for /dev/syscon
413 * and should match the default contents of /etc/ioctl.syscon.
414 */
415 static struct termios dflt_termios = {
416 .c_iflag = BRKINT|ICRNL|IXON|IMAXBEL,
417 .c_oflag = OPOST|ONLCR|TAB3,
418 .c_cflag = CS8|CREAD|B9600,
419 .c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN,
420 .c_cc = { CINTR, CQUIT, CERASE, CKILL, CEOF, 0, 0, 0,
421 CSTART, CSTOP, CSWTCH, CDSUSP, CRPRNT, CFLUSH, CWERASE, CLNEXT,
422 CSTATUS, CERASE2, 0
423 }
424 };
425
426 static struct termios stored_syscon_termios;
427 static int write_ioctl = 0; /* Rewrite /etc/ioctl.syscon */
428
429 static union WAKEUP {
430 struct WAKEFLAGS {
431 unsigned w_usersignal : 1; /* User sent signal to "init" */
432 unsigned w_childdeath : 1; /* An "init" child died */
433 unsigned w_powerhit : 1; /* OS experienced powerfail */
434 } w_flags;
435 int w_mask;
436 } wakeup;
437
438
439 struct init_state {
440 int ist_runlevel;
441 int ist_num_proc;
442 int ist_utmpx_ok;
443 struct PROC_TABLE ist_proc_table[1];
682 */
683 (void) uname(&un);
684 ret = sysinfo(SI_ISALIST, buf, sizeof (buf));
685 if (ret != -1L && ret <= sizeof (buf)) {
686 for (isa = strtok(buf, " "); isa;
687 isa = strtok(NULL, " ")) {
688 if (strcmp(isa, "sparcv9") == 0 ||
689 strcmp(isa, "amd64") == 0) {
690 bits = 64;
691 break;
692 }
693 }
694 }
695
696 console(B_FALSE,
697 "\n\n%s Release %s Version %s %d-bit\r\n",
698 un.sysname, un.release, un.version, bits);
699 console(B_FALSE,
700 "Copyright (c) 1983, 2010, Oracle and/or its affiliates."
701 " All rights reserved.\r\n");
702 console(B_FALSE, "Copyright 2019 Nexenta Systems, Inc.\r\n");
703 }
704
705 /*
706 * Get the ioctl settings for /dev/syscon from /etc/ioctl.syscon
707 * so that it can be brought up in the state it was in when the
708 * system went down; or set to defaults if ioctl.syscon isn't
709 * valid.
710 *
711 * This needs to be done even if we're restarting so reset_modes()
712 * will work in case we need to go down to single user mode.
713 */
714 write_ioctl = get_ioctl_syscon();
715
716 /*
717 * Set up all signals to be caught or ignored as appropriate.
718 */
719 init_signals();
720
721 /* Load glob_envp from ENVFILE. */
722 init_env();
|