commit fc35256099359b7df477b44fbe9dbfd32e759b0f
parent 2147918ce402f7a675121209510f1e9df0447392
Author: leitner <leitner>
Date: Fri, 9 Feb 2001 18:22:50 +0000
ctrl-alt-del will start the service "ctrlaltdel", the keyboard request
(normally alt-arrowup) will start the service "kbreq". Untested.
Diffstat:
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
all: minit msvc pidfilehack
CFLAGS=-pipe -march=i386 -fomit-frame-pointer -Os -I../dietlibc/include
-LDFLAGS=../dietlibc/start.o ../dietlibc/dietlibc.a
+#LDFLAGS=../dietlibc/start.o ../dietlibc/dietlibc.a
minit: minit.o split.o openreadclose.o
gcc -g $(LDFLAGS) -o minit $^
diff --git a/minit.c b/minit.c
@@ -11,6 +11,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <stdio.h>
+#include <linux/kd.h>
#define MINITROOT "/etc/minit"
@@ -265,8 +266,12 @@ void childhandler() {
}
static volatile int dowait=0;
+static volatile int dowinch=0;
+static volatile int doint=0;
void sigchild(int whatever) { dowait=1; }
+void sigwinch(int sig) { dowinch=1; }
+void sigint(int sig) { doint=1; }
main(int argc, char *argv[]) {
/* Schritt 1: argv[1] als Service nehmen und starten */
@@ -279,6 +284,19 @@ main(int argc, char *argv[]) {
exit(0); */
int nfds=1;
+ if (getpid()==1) {
+ int fd;
+ reboot(0);
+ if ((fd=open("/dev/tty0",O_RDWR|O_NOCTTY))) {
+ ioctl(fd, KDSIGACCEPT, SIGWINCH);
+ close(fd);
+ } else
+ ioctl(0, KDSIGACCEPT, SIGWINCH);
+ }
+/* signal(SIGPWR,sighandler); don't know what to do about it */
+/* signal(SIGHUP,sighandler); ??? */
+ signal(SIGWINCH,sigwinch); /* keyboard request, aka Alt-Up-Arrow */
+ signal(SIGINT,sigint); /* Ctrl-Alt-Del */
signal(SIGCHLD,sigchild);
if (infd<0 || outfd<0) {
puts("minit: could not open /etc/minit/in or /etc/minit/out\n");
@@ -297,6 +315,14 @@ main(int argc, char *argv[]) {
int status;
int i;
char buf[1501];
+ if (doint) {
+ doint=0;
+ startservice(loadservice("ctrlaltdel"),0);
+ }
+ if (dowinch) {
+ doint=0;
+ startservice(loadservice("kbreq"),0);
+ }
/* if (dowait) {
dowait=0; */
childhandler();