From: David van Moolenbroek Date: Wed, 20 Mar 2013 15:29:03 +0000 (+0000) Subject: Move MINIX reboot definitions into minix/reboot.h X-Git-Tag: v3.3.0~1079 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=50e46307de6f9b5199286c69836a66b20ae63425;p=minix.git Move MINIX reboot definitions into minix/reboot.h Also fix a buffer overflow in commands/reboot/sh_wall.c. Change-Id: I3a61057c4f0221d1700e14d44520b4ad17f1dbe1 --- diff --git a/commands/reboot/halt.c b/commands/reboot/halt.c index dd0bff28b..a03bbc148 100644 --- a/commands/reboot/halt.c +++ b/commands/reboot/halt.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "wtmp.h" diff --git a/commands/reboot/sh_wall.c b/commands/reboot/sh_wall.c index 6d836ec88..a84019493 100644 --- a/commands/reboot/sh_wall.c +++ b/commands/reboot/sh_wall.c @@ -29,7 +29,7 @@ char *when; /* When is shutdown */ char *extra; /* If non-nil, why is the shutdown */ { struct utmp utmp; - char utmptty[5 + sizeof(utmp.ut_line) + 1]; + char utmptty[5 + sizeof(utmp.ut_line) + 2]; char message[1024]; struct passwd *pw; int utmpfd, ttyfd; diff --git a/commands/reboot/shutdown.c b/commands/reboot/shutdown.c index 9c381415f..972f61804 100644 --- a/commands/reboot/shutdown.c +++ b/commands/reboot/shutdown.c @@ -32,9 +32,11 @@ #include #include #include +#include #include #include #include +#include #include "wtmp.h" diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index 40de49f87..6313ed291 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -654,6 +654,7 @@ ./usr/include/minix/procfs.h minix-sys ./usr/include/minix/profile.h minix-sys ./usr/include/minix/queryparam.h minix-sys +./usr/include/minix/reboot.h minix-sys ./usr/include/minix/rs.h minix-sys ./usr/include/minix/safecopies.h minix-sys ./usr/include/minix/sched.h minix-sys diff --git a/drivers/tty/arch/i386/keyboard.c b/drivers/tty/arch/i386/keyboard.c index 181cd29f1..fb02ce2a8 100644 --- a/drivers/tty/arch/i386/keyboard.c +++ b/drivers/tty/arch/i386/keyboard.c @@ -13,12 +13,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include "tty.h" #include "kernel/const.h" #include "kernel/config.h" diff --git a/include/minix/Makefile b/include/minix/Makefile index 5f801c963..f648464a3 100644 --- a/include/minix/Makefile +++ b/include/minix/Makefile @@ -15,7 +15,7 @@ INCS+= acpi.h audio_fw.h bitmap.h \ keymap.h limits.h log.h mmio.h mount.h mthread.h minlib.h \ netdriver.h optset.h padconf.h partition.h portio.h \ priv.h procfs.h profile.h queryparam.h \ - rs.h safecopies.h sched.h sef.h sffs.h \ + reboot.h rs.h safecopies.h sched.h sef.h sffs.h \ sound.h spin.h sys_config.h sysinfo.h \ syslib.h sysutil.h termios.h timers.h type.h \ tty.h u64.h usb.h usb_ch9.h vbox.h \ diff --git a/include/minix/reboot.h b/include/minix/reboot.h new file mode 100644 index 000000000..cdf8a596e --- /dev/null +++ b/include/minix/reboot.h @@ -0,0 +1,15 @@ +#ifndef _MINIX_REBOOT_H +#define _MINIX_REBOOT_H + +/* How to exit the system. */ +#define RBT_HALT 0 /* shut down the system */ +#define RBT_REBOOT 1 /* reboot the system */ +#define RBT_PANIC 2 /* the system panics */ +#define RBT_POWEROFF 3 /* power off, reset if not possible */ +#define RBT_RESET 4 /* hard reset the system */ +#define RBT_DEFAULT 5 /* perform the default action du jour */ +#define RBT_INVALID 6 /* first invalid reboot flag */ + +int reboot(int); + +#endif /* _MINIX_REBOOT_H */ diff --git a/include/unistd.h b/include/unistd.h index c2e93a087..efad00e23 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -387,12 +387,8 @@ int profil(char *, size_t, u_long, u_int); void psignal(int, const char *); #endif /* __PSIGNAL_DECLARED */ int rcmd(char **, int, const char *, const char *, const char *, int *); -#ifdef __minix -int reboot(int); -#else -int reboot(int, char *); -#endif #ifndef __minix +int reboot(int, char *); int revoke(const char *); #endif int rresvport(int *); @@ -439,9 +435,4 @@ extern char *suboptarg; /* getsubopt(3) external variable */ __END_DECLS -#ifdef __minix -/* Minix expects RBT_* flags to be included with */ -#include -#endif - #endif /* !_UNISTD_H_ */ diff --git a/kernel/arch/earm/pre_init.c b/kernel/arch/earm/pre_init.c index af878ce3e..972686d71 100644 --- a/kernel/arch/earm/pre_init.c +++ b/kernel/arch/earm/pre_init.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "string.h" #include "arch_proto.h" #include "libexec.h" diff --git a/kernel/arch/i386/arch_reset.c b/kernel/arch/i386/arch_reset.c index 2b4fc7fed..2aad6f08f 100644 --- a/kernel/arch/i386/arch_reset.c +++ b/kernel/arch/i386/arch_reset.c @@ -1,7 +1,6 @@ #include "kernel/kernel.h" -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index c2531b166..cd2509d71 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include "string.h" #include "arch_proto.h" diff --git a/kernel/main.c b/kernel/main.c index 6a8f42430..732d7a6de 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -11,7 +11,6 @@ #include "kernel/kernel.h" #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include #include "clock.h" #include "direct_utils.h" #include "hw_intr.h" diff --git a/man/man2/reboot.2 b/man/man2/reboot.2 index f6993f5ee..ed433ef95 100644 --- a/man/man2/reboot.2 +++ b/man/man2/reboot.2 @@ -4,9 +4,7 @@ reboot \- close down the system or reboot .SH SYNTAX .ft B .nf -#define _NETBSD_SOURCE 1 - -#include +#include int reboot(int \fIhow\fP) .fi @@ -26,10 +24,7 @@ on the keyboard. Halt the system. .TP .BI "reboot(RBT_PANIC)" -Cause a system panic. This is not normally done from user mode, but by -servers using the -.B sys_abort() -kernel call. +Cause a system panic. This is not normally done from user mode. .TP .BI "reboot(RBT_POWEROFF)" Power off the system if possible, reset otherwise. diff --git a/servers/init/init.c b/servers/init/init.c index f9f6499a6..4fc9bec45 100644 --- a/servers/init/init.c +++ b/servers/init/init.c @@ -28,6 +28,7 @@ #include #include #include +#include /* Different ttyent structure. */ struct ttyent TT_REBOOT = { "console", "shutdown -d now CTRL-ALT_DEL", "-"}; diff --git a/servers/pm/misc.c b/servers/pm/misc.c index dcf535e3b..c3a198b39 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index 6661e354b..93f7a2755 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -34,16 +34,6 @@ #ifndef _SYS_REBOOT_H_ #define _SYS_REBOOT_H_ -/* LSC FIXME: what about those flags */ -/* How to exit the system or stop a server process. */ -#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_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_INVALID 6 /* first invalid reboot flag */ - /* * Arguments to reboot system call. These are passed to the boot program, * and then on to init.