summaryrefslogtreecommitdiff
path: root/usr/src/cmd/init/init.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2020-05-26 13:57:13 +0000
committerJohn Levon <john.levon@joyent.com>2020-05-26 13:57:13 +0000
commit5b2acc0949194447bba6e45a0fa44d0b5f42f208 (patch)
tree7ea9eb87bc68fee386dd39035ce715e87a0e673c /usr/src/cmd/init/init.c
parent8ca018083101bf1cb175869679bc123187fb1bab (diff)
parent2a1277d3064386cd5c4e372301007aa330bf1d5e (diff)
downloadillumos-joyent-gcc9.tar.gz
mergegcc9
Diffstat (limited to 'usr/src/cmd/init/init.c')
-rw-r--r--usr/src/cmd/init/init.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/usr/src/cmd/init/init.c b/usr/src/cmd/init/init.c
index b37322aa5c..86f717d54a 100644
--- a/usr/src/cmd/init/init.c
+++ b/usr/src/cmd/init/init.c
@@ -20,6 +20,7 @@
*/
/*
+ * Copyright 2020 Oxide Computer Company
* Copyright (c) 2013 Gary Mills
*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
@@ -100,6 +101,7 @@
#include <sys/tty.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <sys/bootbanner.h>
#include <bsm/adt_event.h>
#include <bsm/libbsm.h>
@@ -605,6 +607,7 @@ static int startd_failure_rate_critical();
static char *audit_boot_msg();
static int audit_put_record(int, int, char *);
static void update_boot_archive(int new_state);
+static void init_bootbanner_print(const char *, uint_t);
int
main(int argc, char *argv[])
@@ -674,34 +677,33 @@ main(int argc, char *argv[])
st_init();
if (booting && print_banner) {
- struct utsname un;
- char buf[BUFSIZ], *isa;
- long ret;
- int bits = 32;
-
/*
* We want to print the boot banner as soon as
* possible. In the global zone, the kernel does it,
* but we do not have that luxury in non-global zones,
* so we will print it here.
*/
+#ifdef LEGACY_BANNER
+ struct utsname un;
+ char buf[BUFSIZ];
+ const char *bits;
+ int r;
+
(void) uname(&un);
- ret = sysinfo(SI_ISALIST, buf, sizeof (buf));
- if (ret != -1L && ret <= sizeof (buf)) {
- for (isa = strtok(buf, " "); isa;
- isa = strtok(NULL, " ")) {
- if (strcmp(isa, "sparcv9") == 0 ||
- strcmp(isa, "amd64") == 0) {
- bits = 64;
- break;
- }
- }
+ if ((r = sysinfo(SI_ADDRESS_WIDTH, buf, sizeof (buf))) > 0 &&
+ r < sizeof (buf)) {
+ bits = buf;
+ } else {
+ bits = "64";
}
console(B_FALSE,
- "\n\n%s Release %s Version %s %d-bit\r\n",
+ "\n\n%s Release %s Version %s %s-bit\r\n",
un.sysname, un.release, un.version, bits);
console(B_FALSE, "Copyright 2010-2020 Joyent, Inc.\r\n");
+#else
+ bootbanner_print(init_bootbanner_print, 0);
+#endif
}
/*
@@ -918,6 +920,14 @@ main(int argc, char *argv[])
}
static void
+init_bootbanner_print(const char *line, uint_t num)
+{
+ const char *pfx = (num == 0) ? "\n\n" : "";
+
+ console(B_FALSE, "%s%s\r\n", pfx, line);
+}
+
+static void
update_boot_archive(int new_state)
{
if (new_state != LVL0 && new_state != LVL5 && new_state != LVL6)