Also fix a buffer overflow in commands/reboot/sh_wall.c.
Change-Id: I3a61057c4f0221d1700e14d44520b4ad17f1dbe1
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <minix/reboot.h>
#include "wtmp.h"
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;
#include <stdlib.h>
#include <signal.h>
#include <string.h>
+#include <strings.h>
#include <unistd.h>
#include <utmp.h>
#include <errno.h>
+#include <minix/reboot.h>
#include "wtmp.h"
./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
#include <sys/select.h>
#include <termios.h>
#include <signal.h>
-#include <unistd.h>
#include <machine/archtypes.h>
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/input.h>
#include <minix/keymap.h>
+#include <minix/reboot.h>
#include "tty.h"
#include "kernel/const.h"
#include "kernel/config.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 \
--- /dev/null
+#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 */
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 *);
__END_DECLS
-#ifdef __minix
-/* Minix expects RBT_* flags to be included with <unistd.h> */
-#include <sys/reboot.h>
-#endif
-
#endif /* !_UNISTD_H_ */
#include <minix/com.h>
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/reboot.h>
+#include <minix/reboot.h>
#include "string.h"
#include "arch_proto.h"
#include "libexec.h"
#include "kernel/kernel.h"
-#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <machine/cmos.h>
#include <machine/cpu.h>
#include <minix/portio.h>
#include <minix/cpufeature.h>
+#include <minix/reboot.h>
#include <assert.h>
#include <signal.h>
#include <machine/vm.h>
#include <minix/com.h>
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/reboot.h>
+#include <minix/reboot.h>
#include <machine/partition.h>
#include "string.h"
#include "arch_proto.h"
#include "kernel/kernel.h"
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include <assert.h>
#include <libexec.h>
#include <a.out.h>
#include <machine/vmparam.h>
#include <minix/u64.h>
#include <minix/type.h>
+#include <minix/reboot.h>
#include "clock.h"
#include "direct_utils.h"
#include "hw_intr.h"
.SH SYNTAX
.ft B
.nf
-#define _NETBSD_SOURCE 1
-
-#include <unistd.h>
+#include <minix/reboot.h>
int reboot(int \fIhow\fP)
.fi
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.
#include <stdlib.h>
#include <unistd.h>
#include <utmp.h>
+#include <minix/reboot.h>
/* Different ttyent structure. */
struct ttyent TT_REBOOT = { "console", "shutdown -d now CTRL-ALT_DEL", "-"};
#include <sys/utsname.h>
#include <minix/com.h>
#include <minix/config.h>
+#include <minix/reboot.h>
#include <minix/sysinfo.h>
#include <minix/type.h>
#include <minix/vm.h>
#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.