smgl/simpleinit-msb: initial commit
[grimoire-witchcraft.git] / smgl / simpleinit-msb / patches / simpleinit.patch
blobfc15f17792831dd2522e709f1edc497e9ff9d147
1 diff -Nur simpleinit-msb-1.2/lib/pathnames.h simpleinit-msb-1.2-smgl/lib/pathnames.h
2 --- simpleinit-msb-1.2/lib/pathnames.h 2001-09-26 12:59:46.000000000 +0200
3 +++ simpleinit-msb-1.2-smgl/lib/pathnames.h 2004-02-20 14:33:35.000000000 +0100
4 @@ -130,7 +130,7 @@
5 #define _PATH_MTAB "/etc/mtab"
6 #define _PATH_PROC_MOUNTS "/proc/mounts"
7 #define _PATH_UMOUNT "/bin/umount"
8 -#define UMOUNT_ARGS "umount", "-a", "-t", "nodevfs,noproc"
9 +#define UMOUNT_ARGS "umount", "-a", "-t", "nodevfs,noproc,noramfs"
10 #define SWAPOFF_ARGS "swapoff", "-a"
12 /* used in login-utils/setpwnam.h and login-utils/islocal.c */
13 diff -Nur simpleinit-msb-1.2/login-utils/shutdown.c simpleinit-msb-1.2-smgl/login-utils/shutdown.c
14 --- simpleinit-msb-1.2/login-utils/shutdown.c 2001-09-26 12:59:46.000000000 +0200
15 +++ simpleinit-msb-1.2-smgl/login-utils/shutdown.c 2004-02-20 15:53:27.000000000 +0100
16 @@ -746,6 +746,7 @@
17 n = 0;
18 while (n < 100 && (mnt = getmntent(mtab))) {
19 if (strcmp (mnt->mnt_type, "devfs") == 0) continue;
20 + if (strcmp (mnt->mnt_type, "ramfs") == 0) continue;
21 mntlist[n++] = strdup(mnt->mnt_dir);
23 endmntent(mtab);
24 diff -Nur simpleinit-msb-1.2/login-utils/simpleinit.c simpleinit-msb-1.2-smgl/login-utils/simpleinit.c
25 --- simpleinit-msb-1.2/login-utils/simpleinit.c 2004-01-11 00:24:42.000000000 +0100
26 +++ simpleinit-msb-1.2-smgl/login-utils/simpleinit.c 2004-02-20 14:28:31.000000000 +0100
27 @@ -321,6 +321,8 @@
28 void sigquit_handler (int sig);
29 void userspace_sigquit_handler (int sig);
30 void sigterm_handler (int sig);
31 +void open_initctl_fifo (void);
32 +void sigusr_handler (int sig);
33 #ifdef SET_TZ
34 void set_tz (void);
35 #endif
36 @@ -396,6 +398,8 @@
37 sigaction (SIGCHLD, &sa, NULL);
38 sa.sa_handler = userspace_sigquit_handler;
39 sigaction (SIGQUIT, &sa, NULL);
40 + sa.sa_handler = sigusr_handler;
41 + sigaction (SIGUSR1, &sa, NULL);
42 if (userspace) fix_userspace_paths(); else
44 sa.sa_handler = sigtstp_handler;
45 @@ -440,12 +444,7 @@
49 - if ( ( initctl_fd = open (initctl_name, O_RDWR|O_NONBLOCK, 0) ) < 0 ) {
50 - mkfifo (initctl_name, S_IRUSR | S_IWUSR);
51 - if ( ( initctl_fd = open (initctl_name, O_RDWR|O_NONBLOCK, 0) ) < 0 )
52 - err ( _("error opening fifo\n") );
53 - }
54 - fcntl(initctl_fd,F_SETFD,FD_CLOEXEC); /*make sure no one inherits the fd*/
55 + open_initctl_fifo();
57 if (userspace){
58 pid_t mypid=getpid();
59 @@ -885,6 +884,28 @@
60 if (!stopped) hup_handler (sig);
61 } /* End Function sigtstp_handler */
63 +void open_initctl_fifo()
65 + if ( ( initctl_fd = open (initctl_name, O_RDWR|O_NONBLOCK, 0) ) < 0 ) {
66 + mkfifo (initctl_name, S_IRUSR | S_IWUSR);
67 + if ( ( initctl_fd = open (initctl_name, O_RDWR|O_NONBLOCK, 0) ) < 0 )
68 + err ( _("error opening fifo\n") );
69 + }
70 + fcntl(initctl_fd,F_SETFD,FD_CLOEXEC); /*make sure no one inherits the fd*/
73 +void sigusr_handler (int sig)
75 + close (0);
76 + close (1);
77 + close (2);
78 + open ("/dev/console", O_RDONLY, 0);
79 + open ("/dev/console", O_RDWR, 0);
80 + dup2 (1, 2);
81 + open_initctl_fifo();
82 + sig=sig;
85 void sigterm_handler (int sig)
87 int i;
88 @@ -1686,6 +1707,9 @@
89 for (i = 1; i < NSIG; i++) signal (i, SIG_DFL);
90 sigprocmask(SIG_UNBLOCK,&all_signals,NULL);
91 if (!userspace) {
92 + close (0);
93 + close (1);
94 + close (2);
95 open ("/dev/console", O_RDONLY, 0);
96 open ("/dev/console", O_RDWR, 0);
97 dup2 (1, 2);