summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2018-11-29 22:33:59 +0200
committerToomas Soome <tsoome@me.com>2019-02-27 08:25:22 +0200
commitcb03d0d71ecf6972a7bbca09782a54430f482431 (patch)
treeab33b21fceff77066d509cd1237e56dc5e0694c4
parent257e498f8b87ab41b7de15a76a08f79919b47fcb (diff)
downloadillumos-joyent-cb03d0d71ecf6972a7bbca09782a54430f482431.tar.gz
10446 loader: split panic routine
Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Andy Stormont <astormont@racktopsystems.com> Reviewed by: Gergő Doma <domag02@gmail.com> Reviewed by: John Levon <john.levon@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/lib/libstand/panic.c19
-rw-r--r--usr/src/boot/lib/libstand/stand.h2
-rw-r--r--usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c2
4 files changed, 17 insertions, 8 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index c5bcb01763..46d94fffb8 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2019.02.23.1
+BOOT_VERSION = $(LOADER_VERSION)-2019.02.26.1
diff --git a/usr/src/boot/lib/libstand/panic.c b/usr/src/boot/lib/libstand/panic.c
index 14a7c4d8dd..8a3730ce6b 100644
--- a/usr/src/boot/lib/libstand/panic.c
+++ b/usr/src/boot/lib/libstand/panic.c
@@ -38,7 +38,18 @@
#include <stand.h>
#include <machine/stdarg.h>
-extern void exit(int) __dead2;
+/*
+ * Boot loaders and other standalone programs that wish to have a
+ * different panic policy can provide their own panic_action rotuine.
+ */
+__weak_symbol void
+panic_action(void)
+{
+ printf("--> Press a key on the console to reboot <--\n");
+ getchar();
+ printf("Rebooting...\n");
+ exit(1);
+}
void
panic(const char *fmt, ...)
@@ -50,9 +61,5 @@ panic(const char *fmt, ...)
vprintf(fmt, ap);
va_end(ap);
printf("\n");
-
- printf("--> Press a key on the console to reboot <--\n");
- getchar();
- printf("Rebooting...\n");
- exit(1);
+ panic_action();
}
diff --git a/usr/src/boot/lib/libstand/stand.h b/usr/src/boot/lib/libstand/stand.h
index 5039803d6d..b2cdcc18e0 100644
--- a/usr/src/boot/lib/libstand/stand.h
+++ b/usr/src/boot/lib/libstand/stand.h
@@ -377,12 +377,14 @@ extern int null_readdir(struct open_file *f, struct dirent *d);
* Machine dependent functions and data, must be provided or stubbed by
* the consumer
*/
+extern void exit(int) __dead2;
extern int getchar(void);
extern int ischar(void);
extern void putchar(int);
extern int devopen(struct open_file *, const char *, const char **);
extern int devclose(struct open_file *f);
extern void panic(const char *, ...) __dead2 __printflike(1, 2);
+extern void panic_action(void) __weak_symbol __dead2;
extern time_t getsecs(void);
extern struct fs_ops *file_system[];
extern struct fs_ops *exclusive_file_system;
diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
index 5d57d909ce..6c52d8e279 100644
--- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
+++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
@@ -107,7 +107,6 @@ static char *heap_top;
static char *heap_bottom;
static void i386_zfs_probe(void);
-void exit(int);
static void load(void);
static int parse_cmd(void);
@@ -272,6 +271,7 @@ main(void)
void
exit(int x)
{
+ while (1);
}
static void