diff --git a/commands/reboot/halt.c b/commands/reboot/halt.c index 60d1ad9c2..dd0bff28b 100644 --- a/commands/reboot/halt.c +++ b/commands/reboot/halt.c @@ -29,12 +29,11 @@ void usage( void ); int main( int argc, char *argv[] ); char *prog; -char *reboot_code = "delay; boot"; void usage() { - fprintf(stderr, "Usage: %s [-hrRfpd] [-x reboot-code]\n", prog); + fprintf(stderr, "Usage: %s [-hrRfpd]\n", prog); exit(1); } @@ -47,7 +46,6 @@ char **argv; int fast = 0; /* fast halt/reboot, don't bother being nice. */ int i; struct stat dummy; - char *monitor_code = ""; pid_t pid; if ((prog = strrchr(argv[0],'/')) == NULL) prog = argv[0]; else prog++; @@ -68,15 +66,6 @@ char **argv; case 'd': flag = RBT_DEFAULT; break; case 'p': flag = RBT_POWEROFF; break; case 'f': fast = 1; break; - case 'x': - flag = RBT_MONITOR; - if (*opt == 0) { - if (i == argc) usage(); - opt = argv[i++]; - } - monitor_code = opt; - opt = ""; - break; default: usage(); } @@ -89,11 +78,6 @@ char **argv; exit(1); } - if (flag == RBT_REBOOT) { - flag = RBT_MONITOR; /* set monitor code for reboot */ - monitor_code = reboot_code; - } - if (stat("/usr/bin", &dummy) < 0) { /* It seems that /usr isn't present, let's assume "-f." */ fast = 1; @@ -135,7 +119,7 @@ char **argv; sync(); - reboot(flag, monitor_code, strlen(monitor_code)); + reboot(flag); fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno)); return 1; } diff --git a/commands/reboot/shutdown.c b/commands/reboot/shutdown.c index 57e00f132..c5e40873a 100644 --- a/commands/reboot/shutdown.c +++ b/commands/reboot/shutdown.c @@ -18,7 +18,6 @@ New Minix options: -C: crash check, i.e. is the last wtmp entry a shutdown entry? - -x: let the monitor execute the given code -R: reset the system -d: default CTRL-ALT-DEL shutdown for current bootloader */ @@ -63,7 +62,6 @@ long wait_time=0L; char message[1024]; char info[80]; int reboot_flag='h'; /* default is halt */ -char *reboot_code=""; /* optional monitor code */ int info_min, info_hour; char *prog; @@ -132,7 +130,7 @@ char *argv[]; char *opt; int tty; static char HALT1[] = "-?"; - static char *HALT[] = { "shutdown", HALT1, NULL, NULL }; + static char *HALT[] = { "shutdown", HALT1, NULL }; /* Parse options. */ for (i = 1; i < argc && argv[i][0] == '-'; i++) { @@ -149,23 +147,9 @@ char *argv[]; case 'h': case 'r': case 'p': - case 'x': case 'd': - reboot_flag = *opt; - if (reboot_flag == 'x') { - if (*++opt == 0) { - if (++i == argc) { - fprintf (stderr,"shutdown: option '-x' requires an argument\n"); - usage(); - } - opt=argv[i]; - } - reboot_code=opt; - opt+=strlen(opt)-1; - } - break; case 'R': - reboot_flag = 'R'; + reboot_flag = *opt; break; case 'm': want_message = 1; @@ -256,7 +240,6 @@ char *argv[]; unlink(NOLOGIN); HALT[1][1] = reboot_flag; - if (reboot_flag == 'x') HALT[2] = reboot_code; #if __minix_vmd execv("/usr/sbin/halt", HALT); #else @@ -274,16 +257,14 @@ char *argv[]; void usage() { - fputs("Usage: shutdown [-hrRpmkd] [-x code] [time [message]]\n", stderr); + fputs("Usage: shutdown [-hrRpmkd] [time [message]]\n", stderr); fputs(" -h -> halt system after shutdown\n", stderr); fputs(" -r -> reboot system after shutdown\n", stderr); fputs(" -R -> reset system after shutdown\n", stderr); fputs(" -p -> power system off after shutdown\n", stderr); - fputs(" -x -> return to the monitor doing...\n", stderr); fputs(" -d -> default CTRL-ALT-DEL shutdown for current bootloader\n", stderr); fputs(" -m -> read a shutdown message from standard input\n", stderr); fputs(" -k -> stop an already running shutdown\n", stderr); - fputs(" code -> boot monitor code to be executed\n", stderr); fputs(" time -> keyword ``now'', minutes before shutdown ``+5'',\n", stderr); fputs(" or absolute time specification ``11:20''\n", stderr); fputs(" message -> short shutdown message\n", stderr); diff --git a/include/minix/com.h b/include/minix/com.h index 8c3ade401..7d57e7b34 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -420,9 +420,6 @@ /* Field names for SYS_ABORT. */ #define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */ -#define ABRT_MON_ENDPT m1_i2 /* process where monitor params are */ -#define ABRT_MON_LEN m1_i3 /* length of monitor params */ -#define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */ /* Field names for SYS_IOPENABLE. */ #define IOP_ENDPT m2_l1 /* target endpoint */ diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 8a8a05710..38cea2e49 100644 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -33,7 +33,7 @@ struct rs_pci; int _taskcall(endpoint_t who, int syscallnr, message *msgptr); int _kernel_call(int syscallnr, message *msgptr); -int sys_abort(int how, ...); +int sys_abort(int how); int sys_enable_iop(endpoint_t proc_ep); int sys_exec(endpoint_t proc_ep, char *ptr, char *aout, vir_bytes initpc); diff --git a/include/sys/reboot.h b/include/sys/reboot.h index 3e8f6d44e..90d36ea17 100644 --- a/include/sys/reboot.h +++ b/include/sys/reboot.h @@ -5,10 +5,9 @@ #define RBT_HALT 0 /* shutdown and return to monitor */ #define RBT_REBOOT 1 /* reboot the system through the monitor */ #define RBT_PANIC 2 /* a server panics */ -#define RBT_MONITOR 3 /* let the monitor do this */ +#define RBT_POWEROFF 3 /* power off, reset if not possible */ #define RBT_RESET 4 /* hard reset the system */ #define RBT_DEFAULT 5 /* return to monitor, reset if not possible */ -#define RBT_POWEROFF 6 /* power off, reset if not possible */ -#define RBT_INVALID 7 /* first invalid reboot flag */ +#define RBT_INVALID 6 /* first invalid reboot flag */ #endif diff --git a/include/unistd.h b/include/unistd.h index 505f9ac23..ef0a30a8e 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -356,7 +356,7 @@ void psignal(int, const char *); #endif /* __PSIGNAL_DECLARED */ int rcmd(char **, int, const char *, const char *, const char *, int *); #ifdef __minix -int reboot(int, ...); +int reboot(int); #else int reboot(int, char *); #endif diff --git a/kernel/arch/i386/arch_reset.c b/kernel/arch/i386/arch_reset.c index 565a542f7..c78e8746d 100644 --- a/kernel/arch/i386/arch_reset.c +++ b/kernel/arch/i386/arch_reset.c @@ -118,10 +118,6 @@ __dead void arch_shutdown(int how) reset(); } - if (how == RBT_DEFAULT) { - how = RBT_RESET; - } - switch (how) { case RBT_HALT: /* Stop */ @@ -133,7 +129,8 @@ __dead void arch_shutdown(int how) poweroff(); NOT_REACHABLE; - default: + default: + case RBT_DEFAULT: case RBT_REBOOT: case RBT_RESET: /* Reset the system by forcing a processor shutdown. diff --git a/kernel/main.c b/kernel/main.c index 45fbe2d4a..f107079e3 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -349,7 +349,7 @@ void minix_shutdown(timer_t *tp) { /* This function is called from prepare_shutdown or stop_sequence to bring * down MINIX. How to shutdown is in the argument: RBT_HALT (return to the - * monitor), RBT_MONITOR (execute given code), RBT_RESET (hard reset). + * monitor), RBT_RESET (hard reset). */ #ifdef CONFIG_SMP /* diff --git a/kernel/system/do_abort.c b/kernel/system/do_abort.c index 8208af524..c95a5d28e 100644 --- a/kernel/system/do_abort.c +++ b/kernel/system/do_abort.c @@ -3,9 +3,6 @@ * * The parameters for this kernel call are: * m1_i1: ABRT_HOW (how to abort, possibly fetch monitor params) - * m1_i2: ABRT_MON_ENDPT (proc nr to get monitor params from) - * m1_i3: ABRT_MON_LEN (length of monitor params) - * m1_p1: ABRT_MON_ADDR (virtual address of params) */ #include "kernel/system.h" @@ -23,20 +20,6 @@ int do_abort(struct proc * caller, message * m_ptr) */ int how = m_ptr->ABRT_HOW; - /* See if the monitor is to run the specified instructions. */ - if (how == RBT_MONITOR) { - int p; - static char paramsbuffer[512]; - int len; - len = MIN(m_ptr->ABRT_MON_LEN, sizeof(paramsbuffer)-1); - - if((p=data_copy(m_ptr->ABRT_MON_ENDPT, (vir_bytes) m_ptr->ABRT_MON_ADDR, - KERNEL, (vir_bytes) paramsbuffer, len)) != OK) { - return p; - } - paramsbuffer[len] = '\0'; - } - /* Now prepare to shutdown MINIX. */ prepare_shutdown(how); return(OK); /* pro-forma (really EDISASTER) */ diff --git a/lib/libc/sys-minix/reboot.c b/lib/libc/sys-minix/reboot.c index 7b81b9d43..393757b3c 100644 --- a/lib/libc/sys-minix/reboot.c +++ b/lib/libc/sys-minix/reboot.c @@ -11,17 +11,10 @@ #include #include -int reboot(int how, ...) +int reboot(int how) { message m; - va_list ap; - - va_start(ap, how); - if ((m.m1_i1 = how) == RBT_MONITOR) { - m.m1_p1 = va_arg(ap, char *); - m.m1_i2 = va_arg(ap, size_t); - } - va_end(ap); + m.m1_i1 = how; return _syscall(PM_PROC_NR, REBOOT, &m); } diff --git a/lib/libsys/sys_abort.c b/lib/libsys/sys_abort.c index 747537b42..a9403e54f 100644 --- a/lib/libsys/sys_abort.c +++ b/lib/libsys/sys_abort.c @@ -2,20 +2,12 @@ #include #include -int sys_abort(int how, ...) +int sys_abort(int how) { /* Something awful has happened. Abandon ship. */ message m; - va_list ap; - - va_start(ap, how); - if ((m.ABRT_HOW = how) == RBT_MONITOR) { - m.ABRT_MON_ENDPT = va_arg(ap, int); - m.ABRT_MON_ADDR = va_arg(ap, char *); - m.ABRT_MON_LEN = va_arg(ap, size_t); - } - va_end(ap); + m.ABRT_HOW = how; return(_kernel_call(SYS_ABORT, &m)); } diff --git a/man/man2/reboot.2 b/man/man2/reboot.2 index 90c88897c..eee86c9b4 100644 --- a/man/man2/reboot.2 +++ b/man/man2/reboot.2 @@ -8,7 +8,7 @@ reboot \- close down the system or reboot #include -int reboot(int \fIhow\fP, ...) +int reboot(int \fIhow\fP) .fi .ft P .SH DESCRIPTION @@ -18,11 +18,12 @@ down depending on .IR how : .PP .TP 5 -.BI "reboot(RBT_HALT)" -Halt the system and return to the monitor prompt. +.BI "reboot(RBT_DEFAULT)" +Default shut-down action, the same as used when CTRL+ALT+DEL is pressed +on the keyboard. .TP -.BI "reboot(RBT_REBOOT)" -Reboot the system by letting the monitor execute the "boot" command. +.BI "reboot(RBT_HALT)" +Halt the system. .TP .BI "reboot(RBT_PANIC)" Cause a system panic. This is not normally done from user mode, but by @@ -30,16 +31,12 @@ servers using the .B sys_abort() kernel call. .TP -.BI "reboot(RBT_MONITOR" ", code, length" ")" -Halt the system and let the monitor execute the given code of the given -length. -.RI ( code -is of type -.B "char *" -and -.I length -of type -.BR size_t .) +.BI "reboot(RBT_POWEROFF)" +Power off the system if possible, reset otherwise. +.TP +.BI "reboot(RBT_REBOOT)" +Reboot the system with a software reset (currently not supported, so +a hardware reset is used). .TP .BI "reboot(RBT_RESET)" Reboot the system with a hardware reset. @@ -55,8 +52,5 @@ the return value is -1 and an error is indicated by .BR reboot (8), .BR halt (8), .BR sync (2). -.SH NOTES -MINIX 3 can not return to the monitor if running in real mode. This means -that most of the reboot functions will change to a system reset. .SH AUTHOR Edvard Tuinder (v892231@si.hhs.NL) diff --git a/man/man8/shutdown.8 b/man/man8/shutdown.8 index 691e2bfbe..ec532123d 100644 --- a/man/man8/shutdown.8 +++ b/man/man8/shutdown.8 @@ -3,9 +3,7 @@ shutdown \- graciously close the system down .SH SYNOPSIS .B shutdown -.RB [ \-hrRmkd ] -.RB [ \-x -.IR code ] +.RB [ \-hrRmkpd ] .RI [ time-specification .RI [ message ]] .SH DESCRIPTION @@ -55,20 +53,16 @@ system can now be powered off. This is the default. This flag indicates that the system should reboot after shutting down. .TP .B \-R -Reboot the system by resetting it. Normally the kernel will try to return -to the Boot Monitor. With +Reboot the system by resetting it. With .B \-R the system will receive a hardware reset. .TP -.B \-d -Default CTRL-ALT-DEL shutdown for current bootloader; drops to the boot -monitor is possible and resets otherwise. +.B \-p +Attempt to power off the machine after shutting down; reset if that +is not possible on the current hardware. .TP -.BI \-x " code" -Halt the system and let the Monitor execute the given code as if typed at -the monitor prompt. You can for instance use -.B "\-x 'boot hd0'" -as a very fast way to reboot "from the top." +.B \-d +Default CTRL-ALT-DEL shutdown. .TP .B \-m Allows the operator to type a shutdown message on standard input, that will diff --git a/servers/pm/param.h b/servers/pm/param.h index a4a2d9742..a659ff11d 100644 --- a/servers/pm/param.h +++ b/servers/pm/param.h @@ -27,8 +27,6 @@ #define sig_how m2_i1 #define sig_context m2_p1 #define reboot_flag m1_i1 -#define reboot_code m1_p1 -#define reboot_strlen m1_i2 #define svrctl_req m2_i1 #define svrctl_argp m2_p1 #define stime m2_l1