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:
Ben Gras
2013-09-09 13:20:18 +00:00
committed by Lionel Sambuc
parent fa06ff0ee3
commit a06e2ab395
93 changed files with 8096 additions and 2465 deletions

View File

@@ -16,7 +16,7 @@ INCS+= acpi.h audio_fw.h bitmap.h \
keymap.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 \
reboot.h rs.h safecopies.h sched.h sef.h sffs.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 \
u64.h usb.h usb_ch9.h vbox.h \

View File

@@ -1,15 +0,0 @@
#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 */

View File

@@ -152,6 +152,12 @@ int tcsetattr(int _filedes, int _opt_actions, const struct termios
#define VLNEXT 12 /* cc_c[VLNEXT] (^V) */
#define VDISCARD 13 /* cc_c[VDISCARD] (^O) */
/* Non-functional additions */
#define VDSUSP 14
#define VWERASE 15
#define VSTATUS 16
#define VEOL2 17
/* Extensions to baud rate settings. */
#if defined(__minix) && defined(_NETBSD_SOURCE)
#define B57600 0x0100 /* 57600 baud */

View File

@@ -22,6 +22,7 @@
#define TIOCSWINSZ _IOW('T', 17, struct winsize)
#define TIOCGPGRP _IOW('T', 18, int)
#define TIOCSPGRP _IOW('T', 19, int)
#define TIOCSCTTY _IO ('T', 20) /* controlling tty */
#define TIOCSFON _IOW_BIG(1, u8_t [8192])
/* Keyboard ioctls. */

View File

@@ -376,8 +376,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 *);
#ifndef __minix
int reboot(int, char *);
#ifndef __minix
int revoke(const char *);
#endif
int rresvport(int *);

View File

@@ -39,26 +39,12 @@
#ifndef _UTMP_H_
#define _UTMP_H_
#ifdef __minix
#define _PATH_UTMP "/etc/utmp"
#define _PATH_WTMP "/usr/adm/wtmp"
#define _PATH_BTMP "/usr/adm/btmp"
#define _PATH_LASTLOG "/usr/adm/lastlog"
#define UTMP _PATH_UTMP
#define WTMP _PATH_WTMP
#define BTMP _PATH_BTMP
#else
#define _PATH_UTMP "/var/run/utmp"
#define _PATH_WTMP "/var/log/wtmp"
#define _PATH_LASTLOG "/var/log/lastlog"
#endif
#define UT_NAMESIZE 8
#ifdef __minix
#define UT_LINESIZE 12
#else
#define UT_LINESIZE 8
#endif
#define UT_HOSTSIZE 16
struct lastlog {
@@ -67,34 +53,12 @@ struct lastlog {
char ll_host[UT_HOSTSIZE];
};
#ifdef __minix
struct utmp {
char ut_name[UT_NAMESIZE]; /* user name */
char ut_id[4]; /* /etc/inittab ID */
char ut_line[UT_LINESIZE]; /* terminal name */
char ut_host[UT_HOSTSIZE]; /* host name, when remote */
short ut_pid; /* process id */
short int ut_type; /* type of entry */
time_t ut_time; /* login/logout time */
};
/* Definitions for ut_type. */
#define RUN_LVL 1 /* this is a RUN_LEVEL record */
#define BOOT_TIME 2 /* this is a REBOOT record */
#define INIT_PROCESS 5 /* this process was spawned by INIT */
#define LOGIN_PROCESS 6 /* this is a 'getty' process waiting */
#define USER_PROCESS 7 /* any other user process */
#define DEAD_PROCESS 8 /* this process has died (wtmp only) */
#else /* !__minix */
struct utmp {
char ut_line[UT_LINESIZE];
char ut_name[UT_NAMESIZE];
char ut_host[UT_HOSTSIZE];
time_t ut_time;
};
#endif /* __minix */
__BEGIN_DECLS
int utmpname(const char *);