Move MINIX reboot definitions into minix/reboot.h
Also fix a buffer overflow in commands/reboot/sh_wall.c. Change-Id: I3a61057c4f0221d1700e14d44520b4ad17f1dbe1
This commit is contained in:
parent
3be9c7c33b
commit
50e46307de
16 changed files with 31 additions and 34 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <minix/reboot.h>
|
||||
|
||||
#include "wtmp.h"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,9 +32,11 @@
|
|||
#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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#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"
|
||||
|
|
|
@ -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 \
|
||||
|
|
15
include/minix/reboot.h
Normal file
15
include/minix/reboot.h
Normal file
|
@ -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 */
|
|
@ -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 <unistd.h> */
|
||||
#include <sys/reboot.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_UNISTD_H_ */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#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"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
#include "kernel/kernel.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <machine/cmos.h>
|
||||
|
@ -9,6 +8,7 @@
|
|||
#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>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#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"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "kernel/kernel.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <libexec.h>
|
||||
#include <a.out.h>
|
||||
|
@ -20,6 +19,7 @@
|
|||
#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"
|
||||
|
|
|
@ -4,9 +4,7 @@ reboot \- close down the system or reboot
|
|||
.SH SYNTAX
|
||||
.ft B
|
||||
.nf
|
||||
#define _NETBSD_SOURCE 1
|
||||
|
||||
#include <unistd.h>
|
||||
#include <minix/reboot.h>
|
||||
|
||||
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.
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#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", "-"};
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#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>
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue