big <utmp.h>-inspired netbsd switch
import/switch of: init, getty, reboot, halt, shutdown, wall, last changes: . change reboot() call to netbsd prototype and args . allows pristine <utmp.h> . use clean <sys/reboot.h> instead of <minix/reboot.h> . implement TIOCSCTTY for use by getty so getty can get controlling terminal from init's child(ren) . allow NULL envp for exec Change-Id: I5ca02cb4230857140c08794bbfeba7df982c58a3
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
#include <machine/vm.h>
|
||||
#include <io.h>
|
||||
|
||||
#include <minix/reboot.h>
|
||||
#include <minix/board.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "archconst.h"
|
||||
@@ -51,25 +52,23 @@ poweroff(void)
|
||||
__dead void
|
||||
arch_shutdown(int how)
|
||||
{
|
||||
switch (how) {
|
||||
case RBT_HALT:
|
||||
/* Hang */
|
||||
for (; ; ) halt_cpu();
|
||||
NOT_REACHABLE;
|
||||
|
||||
case RBT_POWEROFF:
|
||||
if((how & RB_POWERDOWN) == RB_POWERDOWN) {
|
||||
/* Power off if possible, hang otherwise */
|
||||
poweroff();
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
default:
|
||||
case RBT_DEFAULT:
|
||||
case RBT_REBOOT:
|
||||
case RBT_RESET:
|
||||
/* Reset the system */
|
||||
reset();
|
||||
if(how & RB_HALT) {
|
||||
/* Hang */
|
||||
for (; ; ) halt_cpu();
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
/* Reset the system */
|
||||
reset();
|
||||
NOT_REACHABLE;
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <minix/com.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <minix/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include "string.h"
|
||||
#include "arch_proto.h"
|
||||
#include "direct_utils.h"
|
||||
@@ -412,7 +412,7 @@ kinfo_t *pre_init(int argc, char **argv)
|
||||
* longer used and the "real" implementations are visible
|
||||
*/
|
||||
void send_diag_sig(void) { }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(0); }
|
||||
void busy_delay_ms(int x) { }
|
||||
int raise(int n) { panic("raise(%d)\n", n); }
|
||||
int kern_phys_map_ptr( phys_bytes base_address, vir_bytes io_size,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <machine/cpu.h>
|
||||
#include <minix/portio.h>
|
||||
#include <minix/cpufeature.h>
|
||||
#include <minix/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
#include <machine/vm.h>
|
||||
@@ -134,30 +134,24 @@ __dead void arch_shutdown(int how)
|
||||
;
|
||||
reset();
|
||||
}
|
||||
|
||||
switch (how) {
|
||||
case RBT_HALT:
|
||||
/* Hang */
|
||||
for (; ; ) halt_cpu();
|
||||
NOT_REACHABLE;
|
||||
|
||||
case RBT_POWEROFF:
|
||||
/* Power off if possible, hang otherwise */
|
||||
poweroff();
|
||||
NOT_REACHABLE;
|
||||
|
||||
default:
|
||||
case RBT_DEFAULT:
|
||||
case RBT_REBOOT:
|
||||
case RBT_RESET:
|
||||
/* Reset the system by forcing a processor shutdown.
|
||||
* First stop the BIOS memory test by setting a soft
|
||||
* reset flag.
|
||||
*/
|
||||
reset();
|
||||
NOT_REACHABLE;
|
||||
|
||||
if((how & RB_POWERDOWN) == RB_POWERDOWN) {
|
||||
/* Power off if possible, hang otherwise */
|
||||
poweroff();
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
if(how & RB_HALT) {
|
||||
/* Hang */
|
||||
for (; ; ) halt_cpu();
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
/* Reset the system by forcing a processor shutdown.
|
||||
* First stop the BIOS memory test by setting a soft
|
||||
* reset flag.
|
||||
*/
|
||||
reset();
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <minix/com.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <minix/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/partition.h>
|
||||
#include "string.h"
|
||||
#include "arch_proto.h"
|
||||
@@ -246,6 +246,6 @@ kinfo_t *pre_init(u32_t magic, u32_t ebx)
|
||||
}
|
||||
|
||||
void send_diag_sig(void) { }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(0); }
|
||||
void busy_delay_ms(int x) { }
|
||||
int raise(int sig) { panic("raise(%d)\n", sig); }
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <minix/u64.h>
|
||||
#include <minix/board.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include "clock.h"
|
||||
#include "direct_utils.h"
|
||||
#include "hw_intr.h"
|
||||
@@ -357,8 +357,7 @@ void prepare_shutdown(const int how)
|
||||
void minix_shutdown(minix_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_RESET (hard reset).
|
||||
* down MINIX.
|
||||
*/
|
||||
int how;
|
||||
|
||||
@@ -376,25 +375,17 @@ void minix_shutdown(minix_timer_t *tp)
|
||||
hw_intr_disable_all();
|
||||
stop_local_timer();
|
||||
|
||||
how = tp ? tmr_arg(tp)->ta_int : RBT_PANIC;
|
||||
how = tp ? tmr_arg(tp)->ta_int : 0;
|
||||
|
||||
/* Show shutdown message */
|
||||
direct_cls();
|
||||
switch(how) {
|
||||
case RBT_HALT:
|
||||
if((how & RB_POWERDOWN) == RB_POWERDOWN)
|
||||
direct_print("MINIX has halted and will now power off.\n");
|
||||
else if(how & RB_HALT)
|
||||
direct_print("MINIX has halted. "
|
||||
"It is safe to turn off your computer.\n");
|
||||
break;
|
||||
case RBT_POWEROFF:
|
||||
direct_print("MINIX has halted and will now power off.\n");
|
||||
break;
|
||||
case RBT_DEFAULT:
|
||||
case RBT_REBOOT:
|
||||
case RBT_RESET:
|
||||
default:
|
||||
else
|
||||
direct_print("MINIX will now reset.\n");
|
||||
break;
|
||||
}
|
||||
arch_shutdown(how);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user