From d775757b77aba05c2766546682db2915b5cc12e1 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Fri, 28 Apr 2006 18:42:33 +0000 Subject: sysvinit: use upstream 2.86 release instead of patching 2.85 locally --- .../sysvinit/sysvinit-2.86/sysvinit-2.86.patch | 4880 -------------------- packages/sysvinit/sysvinit_2.86.bb | 6 +- 2 files changed, 3 insertions(+), 4883 deletions(-) delete mode 100644 packages/sysvinit/sysvinit-2.86/sysvinit-2.86.patch diff --git a/packages/sysvinit/sysvinit-2.86/sysvinit-2.86.patch b/packages/sysvinit/sysvinit-2.86/sysvinit-2.86.patch deleted file mode 100644 index b83f525c3e..0000000000 --- a/packages/sysvinit/sysvinit-2.86/sysvinit-2.86.patch +++ /dev/null @@ -1,4880 +0,0 @@ -diff -urNd -urNd sysvinit-2.85/COPYRIGHT sysvinit-2.86/COPYRIGHT ---- sysvinit-2.85/COPYRIGHT 2003-04-15 03:45:44.000000000 -0500 -+++ sysvinit-2.86/COPYRIGHT 2004-07-30 07:12:12.000000000 -0500 -@@ -1,4 +1,4 @@ --Sysvinit is Copyright (C) 1991-2003 Miquel van Smoorenburg -+Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -diff -urNd -urNd sysvinit-2.85/doc/Changelog sysvinit-2.86/doc/Changelog ---- sysvinit-2.85/doc/Changelog 2003-04-15 09:37:58.000000000 -0500 -+++ sysvinit-2.86/doc/Changelog 2004-07-30 07:15:06.000000000 -0500 -@@ -1,3 +1,29 @@ -+sysvinit (2.86) cistron; urgency=low -+ -+ * Fixed up bootlogd to read /proc/cmdline. Also keep an internal -+ linebuffer to process \r, \t and ^H. It is becoming useable. -+ * Applied trivial OWL patches -+ * Block signals in syslog(), since syslog() is not re-entrant -+ (James Olin Oden , redhat bug #97534) -+ * Minor adjustements so that sysvinit compiles on the Hurd -+ * killall5 now skips kernel threads -+ * Inittab entries with both 'S' and other runlevels were broken. -+ Fix by Bryan Kadzban -+ * Changed initreq.h to be more flexible and forwards-compatible. -+ * You can now through /dev/initctl set environment variables in -+ init that will be inherited by its children. For now, only -+ variables prefixed with INIT_ can be set and the maximum is -+ 16 variables. There's also a length limit due to the size -+ of struct init_request, so it should be safe from abuse. -+ * Option -P and -H to shutdown set INIT_HALT=POWERDOWN and -+ INIT_HALT=HALT as environment variables as described above -+ * Add "mountpoint" utility. -+ * Slightly better algorithm in killall5.c:pidof() -+ * Added some patches from fedora-core (halt-usage, last -t, -+ sulogin-message, user-console) -+ -+ -- Miquel van Smoorenburg Fri, 30 Jul 2004 14:14:58 +0200 -+ - sysvinit (2.85) cistron; urgency=low - - * Add IPv6 support in last(1) -diff -urNd -urNd sysvinit-2.85/doc/Install sysvinit-2.86/doc/Install ---- sysvinit-2.85/doc/Install 2003-04-15 03:46:49.000000000 -0500 -+++ sysvinit-2.86/doc/Install 2004-07-30 07:15:40.000000000 -0500 -@@ -1,5 +1,5 @@ - -- README for the System V style init, version 2.85 -+ README for the System V style init, version 2.86 - - init, shutdown, halt, reboot, wall, last, mesg, runlevel, - killall5, pidof, sulogin. -diff -urNd -urNd sysvinit-2.85/doc/bootlogd.README sysvinit-2.86/doc/bootlogd.README ---- sysvinit-2.85/doc/bootlogd.README 2000-09-12 16:54:31.000000000 -0500 -+++ sysvinit-2.86/doc/bootlogd.README 2004-06-09 07:47:45.000000000 -0500 -@@ -1,10 +1,12 @@ - - bootlogd: a way to capture all console output during bootup -- in a logfile. ** PROOF OF CONCEPT IMPLEMENTATION ** -+ in a logfile. - --- bootlogd opens /dev/console --- finds out what the real console is with an ioctl() --- then opens the real console -+- bootlogd opens /dev/console and finds out what the real console is -+ with an ioctl() if TIOCCONS is available -+- otherwise bootlogd tries to parse /proc/cmdline for console= -+ kernel command line arguments -+- then opens the (most probable) real console - - allocates a pty pair - - redirects console I/O to the pty pair - - then goes in a loop reading from the pty, writing to the real -diff -urNd -urNd sysvinit-2.85/doc/sysvinit-2.85.lsm sysvinit-2.86/doc/sysvinit-2.85.lsm ---- sysvinit-2.85/doc/sysvinit-2.85.lsm 2003-04-18 16:04:12.000000000 -0500 -+++ sysvinit-2.86/doc/sysvinit-2.85.lsm 2004-06-09 07:47:45.000000000 -0500 -@@ -1,7 +1,7 @@ - Begin3 - Title: sysvinit and utilities - Version: 2.85 --Entered-Date: 18APR2003 -+Entered-Date: 15APR2003 - Description: This is the Linux System V init. - This version can be compiled with glibc 2.0.6 and up. - Author: miquels@cistron.nl (Miquel van Smoorenburg) -diff -urNd -urNd sysvinit-2.85/doc/sysvinit-2.86.lsm sysvinit-2.86/doc/sysvinit-2.86.lsm ---- sysvinit-2.85/doc/sysvinit-2.86.lsm 1969-12-31 18:00:00.000000000 -0600 -+++ sysvinit-2.86/doc/sysvinit-2.86.lsm 2004-07-31 08:35:28.000000000 -0500 -@@ -0,0 +1,14 @@ -+Begin3 -+Title: sysvinit and utilities -+Version: 2.86 -+Entered-Date: 30JUL2004 -+Description: This is the Linux System V init. -+ This version can be compiled with glibc 2.0.6 and up. -+Author: miquels@cistron.nl (Miquel van Smoorenburg) -+Primary-Site: ftp.cistron.nl /pub/people/miquels/software -+ 92K sysvinit-2.86.tar.gz -+Alternate-Site: sunsite.unc.edu /pub/Linux/system/daemons/init -+ 92K sysvinit-2.86.tar.gz -+Copying-Policy: GPL -+Keywords: init shutdown halt reboot -+End -diff -urNd -urNd sysvinit-2.85/man/bootlogd.8 sysvinit-2.86/man/bootlogd.8 ---- sysvinit-2.85/man/bootlogd.8 1969-12-31 18:00:00.000000000 -0600 -+++ sysvinit-2.86/man/bootlogd.8 2004-06-09 07:47:45.000000000 -0500 -@@ -0,0 +1,39 @@ -+.TH BOOTLOGD 8 "Jul 21, 2003" "" "Linux System Administrator's Manual" -+.SH NAME -+bootlogd \- record boot messages -+.SH SYNOPSIS -+.B /sbin/bootlogd -+.RB [ \-d ] -+.RB [ \-r ] -+.RB [ \-v ] -+.RB [ " -l logfile " ] -+.RB [ " -p pidfile " ] -+.SH DESCRIPTION -+\fBBootlogd\fP runs in the background and copies all strings sent to the -+\fI/dev/console\fP device to a logfile. If the logfile is not accessible, -+the messages will be buffered in-memory until it is. -+.SH OPTIONS -+.IP \fB\-d\fP -+Do not fork and run in the background. -+.IP \fB\-r\fP -+If there is an existing logfile called \fIlogfile\fP rename it to -+\fIlogfile~\fP unless \fIlogfile~\fP already exists. -+.IP \fB\-v\fP -+Show version. -+.IP \fB\-l logfile\fP -+Log to this logfile. The default is \fI/var/log/boot\fP. -+.IP \fB\-p pidfile\fP -+Put process-id in this file. The default is no pidfile. -+.SH BUGS -+Bootlogd works by redirecting the console output from the console -+device. It copies that output to the real console device and a -+logfile. There is no standard way to find out the real console device -+if you have a new-style \fI/dev/console\fP device (major 5, minor 1). -+\fBBootlogd\fP tries to parse the kernel command line, looking for -+console= lines and deducts the real console device from that. If that -+syntax is ever changed by the kernel, or a console-type is used -+bootlogd does not know about, bootlogd will not work. -+.SH AUTHOR -+Miquel van Smoorenburg, miquels@cistron.nl -+.SH "SEE ALSO" -+.BR dmesg (8) -diff -urNd -urNd sysvinit-2.85/man/init.8 sysvinit-2.86/man/init.8 ---- sysvinit-2.85/man/init.8 2003-04-18 16:05:03.000000000 -0500 -+++ sysvinit-2.86/man/init.8 2004-07-29 06:21:31.000000000 -0500 -@@ -1,6 +1,6 @@ - .\"{{{}}} - .\"{{{ Title --.TH INIT 8 "18 April 2003" "" "Linux System Administrator's Manual" -+.TH INIT 8 "29 Jul 2004" "" "Linux System Administrator's Manual" - .\"}}} - .\"{{{ Name - .SH NAME -@@ -160,7 +160,7 @@ - .SH ENVIRONMENT - \fBInit\fP sets the following environment variables for all its children: - .IP \fBPATH\fP --\fI/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin\fP -+\fI/bin:/usr/bin:/sbin:/usr/sbin\fP - .IP \fBINIT_VERSION\fP - As the name says. Useful to determine if a script runs directly from \fBinit\fP. - .IP \fBRUNLEVEL\fP -diff -urNd -urNd sysvinit-2.85/man/initscript.5 sysvinit-2.86/man/initscript.5 ---- sysvinit-2.85/man/initscript.5 1999-12-24 16:31:21.000000000 -0600 -+++ sysvinit-2.86/man/initscript.5 2004-06-09 07:47:45.000000000 -0500 -@@ -1,4 +1,4 @@ --.TH INITSCRIPT 5 "December 24, 1999" "" "Linux System Administrator's Manual" -+.TH INITSCRIPT 5 "July 10, 2003" "" "Linux System Administrator's Manual" - .SH NAME - initscript \- script that executes inittab commands. - .SH SYNOPSIS -@@ -40,6 +40,12 @@ - - .sp - .RE -+.SH NOTES -+This script is not meant as startup script for daemons or somesuch. -+It has nothing to do with a \fIrc.local\fP style script. It's just -+a handler for things executed from \fB/etc/inittab\fP. Experimenting -+with this can make your system un(re)bootable. -+.RE - .SH FILES - /etc/inittab, - /etc/initscript. -diff -urNd -urNd sysvinit-2.85/man/killall5.8 sysvinit-2.86/man/killall5.8 ---- sysvinit-2.85/man/killall5.8 1997-05-27 05:34:21.000000000 -0500 -+++ sysvinit-2.86/man/killall5.8 2004-06-09 07:47:45.000000000 -0500 -@@ -1,4 +1,4 @@ --.TH KILLALL5 8 "27 May 1997" "" "Linux System Administrator's Manual" -+.TH KILLALL5 8 "04 Nov 2003" "" "Linux System Administrator's Manual" - .SH NAME - killall5 -- send a signal to all processes. - .SH SYNOPSIS -@@ -7,9 +7,9 @@ - .SH DESCRIPTION - .B killall5 - is the SystemV killall command. It sends a signal to all processes except --the processes in its own session, so it won't kill the shell that is --running the script it was called from. Its primary (only) use is in the --\fBrc\fP scripts found in the /etc/init.d directory. -+kernel threads and the processes in its own session, so it won't kill -+the shell that is running the script it was called from. Its primary -+(only) use is in the \fBrc\fP scripts found in the /etc/init.d directory. - .SH SEE ALSO - .BR halt (8), - .BR reboot (8) -diff -urNd -urNd sysvinit-2.85/man/last.1 sysvinit-2.86/man/last.1 ---- sysvinit-2.85/man/last.1 1999-07-29 05:50:34.000000000 -0500 -+++ sysvinit-2.86/man/last.1 2004-07-30 06:39:18.000000000 -0500 -@@ -1,6 +1,6 @@ - .\"{{{}}} - .\"{{{ Title --.TH LAST,LASTB 1 "Jul 29, 1999" "" "Linux System Administrator's Manual" -+.TH LAST,LASTB 1 "Jul 31, 2004" "" "Linux System Administrator's Manual" - .\"}}} - .\"{{{ Name - .SH NAME -@@ -14,6 +14,7 @@ - .RB "[ \-\fBn\fP \fInum\fP ]" - .RB [ \-adiox ] - .RB "[ \-\fBf\fP \fIfile\fP ]" -+.RB "[ \-\fBt\fP \fIYYYYMMDDHHMMSS\fP ]" - .RI [ name... ] - .RI [ tty... ] - .br -@@ -54,6 +55,11 @@ - This is a count telling \fBlast\fP how many lines to show. - .IP "\fB\-n\fP \fInum\fP" - The same. -+.IP "\fB\-t\fP \fIYYYYMMDDHHMMSS\fP" -+Display the state of logins as of the specified time. This is -+useful, e.g., to determine easily who was logged in at a particular -+time -- specify that time with \fB\-t\fP and look for "still logged -+in". - .IP \fB\-R\fP - Suppresses the display of the hostname field. - .IP \fB\-a\fP -diff -urNd -urNd sysvinit-2.85/man/mesg.1 sysvinit-2.86/man/mesg.1 ---- sysvinit-2.85/man/mesg.1 2001-02-26 06:01:10.000000000 -0600 -+++ sysvinit-2.86/man/mesg.1 2004-06-09 07:47:45.000000000 -0500 -@@ -27,7 +27,7 @@ - If no option is given, \fBmesg\fP prints out the current access state of your - terminal. - .PP NOTES --\fBMesg\fP assumes that it's standard input is connected to your -+\fBMesg\fP assumes that its standard input is connected to your - terminal. That also means that if you are logged in multiple times, - you can get/set the mesg status of other sessions by using redirection. - For example "mesg n < /dev/pts/46". -diff -urNd -urNd sysvinit-2.85/man/mountpoint.1 sysvinit-2.86/man/mountpoint.1 ---- sysvinit-2.85/man/mountpoint.1 1969-12-31 18:00:00.000000000 -0600 -+++ sysvinit-2.86/man/mountpoint.1 2004-06-09 07:47:45.000000000 -0500 -@@ -0,0 +1,37 @@ -+.TH MOUNTPOINT 8 "Mar 15, 2004" "" "Linux System Administrator's Manual" -+.SH NAME -+mountpoint \- see if a directory is a mountpoint -+.SH SYNOPSIS -+.B /bin/mountpoint -+.RB [ \-q ] -+.RB [ \-d ] -+.I /path/to/directory -+.br -+.B /bin/mountpoint -+.RB \-x -+.I /dev/device -+.SH DESCRIPTION -+\fBMountpoint\fP checks if the directory is a mountpoint. -+ -+.SH OPTIONS -+.IP \fB\-q\fP -+Be quiet - don't print anything. -+.IP \fB\-d\fP -+Print major/minor device number of the filesystem on stdout. -+.IP \fB\-x\fP -+Print major/minor device number of the blockdevice on stdout. -+.SH EXIT STATUS -+Zero if the directory is a mountpoint, non-zero if not. -+.SH NOTES -+Symbolic links are not followed, except when the \fB-x\fP option is -+used. To force following symlinks, add a trailing slash to the -+path of the directory. -+.PP -+The name of the command is misleading when the -x option is used, -+but the option is useful for comparing if a directory and a device -+match up, and there is no other command that can print the info easily. -+.PP -+.SH AUTHOR -+Miquel van Smoorenburg, miquels@cistron.nl -+.SH "SEE ALSO" -+.BR stat (1) -diff -urNd -urNd sysvinit-2.85/man/shutdown.8 sysvinit-2.86/man/shutdown.8 ---- sysvinit-2.85/man/shutdown.8 2001-10-02 16:27:50.000000000 -0500 -+++ sysvinit-2.86/man/shutdown.8 2004-06-09 07:47:45.000000000 -0500 -@@ -1,6 +1,6 @@ - .\"{{{}}} - .\"{{{ Title --.TH SHUTDOWN 8 "Juli 31, 2001" "" "Linux System Administrator's Manual" -+.TH SHUTDOWN 8 "November 12, 2003" "" "Linux System Administrator's Manual" - .\"}}} - .\"{{{ Name - .SH NAME -@@ -11,7 +11,7 @@ - .B /sbin/shutdown - .RB [ \-t - .IR sec ] --.RB [ \-arkhncfF ] -+.RB [ \-arkhncfFHP ] - .I time - .RI [ warning-message ] - .\"}}} -@@ -54,7 +54,16 @@ - .\"}}} - .\"{{{ -h - .IP \fB\-h\fP --Halt after shutdown. -+Halt or poweroff after shutdown. -+.\"}}} -+.\"{{{ -H -+.IP \fB\-H\fP -+Halt action is to halt or drop into boot monitor on systems that -+support it. -+.\"}}} -+.\"{{{ -P -+.IP \fB\-P\fP -+Halt action is to turn off the power. - .\"}}} - .\"{{{ -n - .IP \fB\-n\fP -@@ -141,6 +150,14 @@ - .sp 1 - Note that if \fI/etc/shutdown.allow\fP is not present, the \fB-a\fP - argument is ignored. -+.SH HALT OR POWEROFF -+The \fB-H\fP option just sets the \fIinit\fP environment variable -+\fIINIT_HALT\fP to \fIHALT\fP, and the \fB-P\fP option just sets -+that variable to \fIPOWEROFF\fP. The shutdown script that calls -+\fBhalt\fP(8) as the last thing in the shutdown sequence should -+check these environment variables and call \fBhalt\fP(8) with -+the right options for these options to actually have any effect. -+Debian 3.1 (sarge) supports this. - .SH FILES - .nf - /fastboot -diff -urNd -urNd sysvinit-2.85/man/sulogin.8 sysvinit-2.86/man/sulogin.8 ---- sysvinit-2.85/man/sulogin.8 2000-09-11 07:19:25.000000000 -0500 -+++ sysvinit-2.86/man/sulogin.8 2004-06-09 07:47:45.000000000 -0500 -@@ -1,4 +1,4 @@ --.TH SULOGIN 8 "11 Sep 2000" "" "Linux System Administrator's Manual" -+.TH SULOGIN 8 "04 Nov 2003" "" "Linux System Administrator's Manual" - .SH NAME - sulogin -- Single-user login - .SH SYNOPSIS -@@ -20,7 +20,7 @@ - .br - (or type Control-D for normal startup): - .PP --\fIsulogin\fP will connected to the current terminal, or to the -+\fIsulogin\fP will be connected to the current terminal, or to the - optional device that can be specified on the command line - (typically \fB/dev/console\fP). - .PP -@@ -45,16 +45,18 @@ - .PP - boot: linux -b rw sushell=/sbin/sash - .SH FALLBACK METHODS --\fIsulogin\fP checks the root password using the standard methods first. --If the \fB-e\fP option was specified, --\fIsulogin\fP examines the next files to find the root password. If --they are damaged, or non-existant, it will use fallback methods that --even go so far as to provide you with a shell prompt without asking --for the root password if they are irrepairably damaged. -+\fIsulogin\fP checks the root password using the standard method (getpwnam) -+first. -+Then, if the \fB-e\fP option was specified, -+\fIsulogin\fP examines these files directly to find the root password: - .PP - /etc/passwd, - .br - /etc/shadow (if present) -+.PP -+If they are damaged or non-existant, sulogin will start a root shell -+without asking for a password. Only use the \fB-e\fP option if you -+are sure the console is physically protected against unauthorized access. - .SH AUTHOR - Miquel van Smoorenburg - .SH SEE ALSO -diff -urNd -urNd sysvinit-2.85/man/wall.1 sysvinit-2.86/man/wall.1 ---- sysvinit-2.85/man/wall.1 2003-04-16 04:17:38.000000000 -0500 -+++ sysvinit-2.86/man/wall.1 2004-06-09 07:47:45.000000000 -0500 -@@ -47,7 +47,7 @@ - .I Wall - ignores the - .B TZ --variable - the time printed in the banner is based on the systems -+variable - the time printed in the banner is based on the system's - local time. - - .SH SEE ALSO -diff -urNd -urNd sysvinit-2.85/src/Makefile sysvinit-2.86/src/Makefile ---- sysvinit-2.85/src/Makefile 2001-11-06 05:58:16.000000000 -0600 -+++ sysvinit-2.86/src/Makefile 2004-06-09 07:47:45.000000000 -0500 -@@ -5,34 +5,56 @@ - # clean cleans up object files - # clobber really cleans up - # --# Version: @(#)Makefile 2.83-3 06-Nov-2001 miquels@cistron.nl -+# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl - # - --CC = cc --CFLAGS = -Wall -O2 -D_GNU_SOURCE -+CC = gcc -+CFLAGS = -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE - LDFLAGS = -s - STATIC = - --# For Debian we do not build all programs, otherwise we do. --ifeq ($(DEBIAN),) --PROGS = init halt shutdown killall5 runlevel sulogin utmpdump \ -- last mesg wall --else --PROGS = init halt shutdown killall5 runlevel sulogin last mesg -+# For some known distributions we do not build all programs, otherwise we do. -+BIN = -+SBIN = init halt shutdown runlevel killall5 -+USRBIN = last mesg -+ -+MAN1 = last.1 lastb.1 mesg.1 -+MAN5 = initscript.5 inittab.5 -+MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8 -+MAN8 += shutdown.8 telinit.8 -+ -+ifeq ($(DISTRO),) -+BIN += mountpoint -+SBIN += sulogin bootlogd -+USRBIN += utmpdump wall -+MAN1 += mountpoint.1 wall.1 -+MAN8 += sulogin.8 bootlogd.8 -+endif -+ -+ifeq ($(DISTRO),Debian) -+BIN += mountpoint -+SBIN += sulogin bootlogd -+MAN1 += mountpoint.1 -+MAN8 += sulogin.8 bootlogd.8 -+endif -+ -+ifeq ($(DISTRO),Owl) -+USRBIN += wall -+MAN1 += wall.1 - endif - - BIN_OWNER = root - BIN_GROUP = root --BIN_COMBO = $(BIN_OWNER).$(BIN_GROUP) -+BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP) - INSTALL = install -o $(BIN_OWNER) -g $(BIN_GROUP) - MANDIR = /usr/share/man - --# Additional libs for Gnu Libc -+# Additional libs for GNU libc. - ifneq ($(wildcard /usr/lib/libcrypt.a),) - LCRYPT = -lcrypt - endif - --all: $(PROGS) -+all: $(BIN) $(SBIN) $(USRBIN) - - init: init.o init_utmp.o - $(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o -@@ -46,6 +68,9 @@ - mesg: mesg.o - $(CC) $(LDFLAGS) -o $@ mesg.o - -+mountpoint: mountpoint.o -+ $(CC) $(LDFLAGS) -o $@ mountpoint.o -+ - utmpdump: utmpdump.o - $(CC) $(LDFLAGS) -o $@ utmpdump.o - -@@ -62,9 +87,9 @@ - $(CC) $(LDFLAGS) -o $@ dowall.o shutdown.o utmp.o - - bootlogd: bootlogd.o -- $(CC) $(LDFLAGS) -o $@ bootlogd.o -+ $(CC) $(LDFLAGS) -o $@ bootlogd.o -lutil - --init.o: init.c init.h set.h reboot.h -+init.o: init.c init.h set.h reboot.h initreq.h - $(CC) -c $(CFLAGS) init.c - - utmp.o: utmp.c init.h -@@ -80,36 +105,44 @@ - @echo Type \"make clobber\" to really clean up. - - clobber: cleanobjs -- rm -f $(PROGS) -+ rm -f $(BIN) $(SBIN) $(USRBIN) - - distclean: clobber - - install: -- $(INSTALL) -m 755 halt init killall5 sulogin \ -- runlevel shutdown $(ROOT)/sbin -- # These are not installed by default --ifeq ($(DEBIAN),) -- $(INSTALL) -m 555 utmpdump wall $(ROOT)/usr/bin --endif -- # $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc -- $(INSTALL) -m 755 mesg last $(ROOT)/usr/bin -- cd $(ROOT)/sbin; ln -sf halt reboot; chown $(BIN_COMBO) reboot -- cd $(ROOT)/sbin; ln -sf halt poweroff; chown $(BIN_COMBO) poweroff -- cd $(ROOT)/sbin; ln -sf init telinit; chown $(BIN_COMBO) telinit -- cd $(ROOT)/bin; ln -sf ../sbin/killall5 pidof; chown $(BIN_COMBO) pidof -- cd $(ROOT)/usr/bin; ln -sf last lastb; chown $(BIN_COMBO) lastb -- $(INSTALL) -m 644 initreq.h $(ROOT)/usr/include -- $(INSTALL) -m 644 ../man/*.8 $(ROOT)$(MANDIR)/man8 -- $(INSTALL) -m 644 ../man/*.5 $(ROOT)$(MANDIR)/man5 --ifeq ($(DEBIAN),) -- $(INSTALL) -m 644 ../man/wall.1 $(ROOT)$(MANDIR)/man1 --endif -- $(INSTALL) -m 644 ../man/last.1 ../man/lastb.1 ../man/mesg.1 \ -- $(ROOT)$(MANDIR)/man1 -+ for i in $(BIN); do \ -+ $(INSTALL) -m 755 $$i $(ROOT)/bin/; \ -+ done -+ for i in $(SBIN); do \ -+ $(INSTALL) -m 755 $$i $(ROOT)/sbin/; \ -+ done -+ for i in $(USRBIN); do \ -+ $(INSTALL) -m 755 $$i $(ROOT)/usr/bin/; \ -+ done -+ # $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc/ -+ ln -sf halt $(ROOT)/sbin/reboot -+ ln -sf halt $(ROOT)/sbin/poweroff -+ ln -sf init $(ROOT)/sbin/telinit -+ ln -sf ../sbin/killall5 $(ROOT)/bin/pidof -+ if [ ! -f $(ROOT)/usr/bin/lastb ]; then \ -+ ln -sf last $(ROOT)/usr/bin/lastb; \ -+ fi -+ $(INSTALL) -m 644 initreq.h $(ROOT)/usr/include/ -+ for i in $(MAN1); do \ -+ $(INSTALL) -m 644 ../man/$$i $(ROOT)$(MANDIR)/man1/; \ -+ done -+ for i in $(MAN5); do \ -+ $(INSTALL) -m 644 ../man/$$i $(ROOT)$(MANDIR)/man5/; \ -+ done -+ for i in $(MAN8); do \ -+ $(INSTALL) -m 644 ../man/$$i $(ROOT)$(MANDIR)/man8/; \ -+ done -+ifeq ($(ROOT),) - # -- # This part is skipped on debian systems, the -+ # This part is skipped on Debian systems, the - # debian.preinst script takes care of it. - @if [ ! -p /dev/initctl ]; then \ - echo "Creating /dev/initctl"; \ - rm -f /dev/initctl; \ - mknod -m 600 /dev/initctl p; fi -+endif -Binary files sysvinit-2.85/src/bootlogd and sysvinit-2.86/src/bootlogd differ -diff -urNd -urNd sysvinit-2.85/src/bootlogd.c sysvinit-2.86/src/bootlogd.c ---- sysvinit-2.85/src/bootlogd.c 2001-12-09 08:01:28.000000000 -0600 -+++ sysvinit-2.86/src/bootlogd.c 2004-06-09 07:47:45.000000000 -0500 -@@ -3,12 +3,12 @@ - * The file is usually located on the /var partition, and - * gets written (and fsynced) as soon as possible. - * -- * Version: @(#)bootlogd 2.79 11-Sep-2000 miquels@cistron.nl -+ * Version: @(#)bootlogd 2.86pre 12-Jan-2004 miquels@cistron.nl - * - * Bugs: Uses openpty(), only available in glibc. Sorry. - * - * This file is part of the sysvinit suite, -- * Copyright 1991-2000 Miquel van Smoorenburg. -+ * Copyright 1991-2004 Miquel van Smoorenburg. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -17,7 +17,9 @@ - * - * *NOTE* *NOTE* *NOTE* - * This is a PROOF OF CONCEPT IMPLEMENTATION -- * I do not recommend using this on production systems. -+ * -+ * I have bigger plans for Debian, but for now -+ * this has to do ;) - * - */ - -@@ -38,18 +40,14 @@ - #include - #include - #include -- --char *Version = "@(#) bootlogd 2.79 11-Sep-2000 MvS"; -- --/* -- * Until the kernel knows about TIOCGDEV, use a really ugly -- * non-portable (not even between architectures) hack. -- */ --#ifndef TIOCGDEV --# define TIOCTTYGSTRUCT_HACK 1 -+#include -+#ifdef __linux__ -+#include - #endif - --#define LOGFILE "/var/log/boot.log" -+char *Version = "@(#) bootlogd 2.86 03-Jun-2004 miquels@cistron.nl"; -+ -+#define LOGFILE "/var/log/boot" - - char ringbuf[32768]; - char *endptr = ringbuf + sizeof(ringbuf); -@@ -59,29 +57,32 @@ - int got_signal = 0; - int didnl = 1; - -+struct line { -+ char buf[256]; -+ int pos; -+} line; - --#ifdef TIOCTTYGSTRUCT_HACK --struct tty_offsets { -- char *kver; -- int offset; --} tty_offsets[] = { --#if ((~0UL) == 0xffffffff) /* 32 bits */ -- { "2.0.", 236 }, -- { "2.1.", 268 }, -- { "2.2.", 272 }, -- { "2.3.", 272 }, -- { "2.4.", 272 }, -- { "2.5.", 272 }, --#else /* 64 bits */ -- { "2.2.", 480 }, -- { "2.3.", 480 }, -- { "2.4.", 480 }, -- { "2.5.", 480 }, --#endif -- { NULL, 0 }, -+/* -+ * Console devices as listed on the kernel command line and -+ * the mapping to actual devices in /dev -+ */ -+struct consdev { -+ char *cmdline; -+ char *dev1; -+ char *dev2; -+} consdev[] = { -+ { "ttySC", "/dev/ttySC%s", "/dev/ttsc/%s" }, -+ { "ttyS", "/dev/ttyS%s", "/dev/tts/%s" }, -+ { "tty", "/dev/tty%s", "/dev/vc/%s" }, -+ { "hvc", "/dev/hvc%s", "/dev/hvc/%s" }, -+ { NULL, NULL, NULL }, - }; --#endif - -+/* -+ * Devices to try as console if not found on kernel command line. -+ * Tried from left to right (as opposed to kernel cmdline). -+ */ -+char *defcons[] = { "tty0", "hvc0", "ttyS0", "ttySC0", NULL }; - - /* - * Catch signals. -@@ -95,6 +96,8 @@ - /* - * Scan /dev and find the device name. - * Side-effect: directory is changed to /dev -+ * -+ * FIXME: scan subdirectories for devfs support ? - */ - int findtty(char *res, int rlen, dev_t dev) - { -@@ -117,18 +120,88 @@ - } - } - if (ent == NULL) { -- fprintf(stderr, "bootlogd: cannot find console device\n"); -+ fprintf(stderr, "bootlogd: cannot find console device " -+ "%d:%d in /dev\n", major(dev), minor(dev)); - r = -1; -- } else if (strlen(ent->d_name) >= rlen) { -+ } else if (strlen(ent->d_name) + 5 >= rlen) { - fprintf(stderr, "bootlogd: console device name too long\n"); - r = -1; - } else -- strcpy(res, ent->d_name); -+ snprintf(res, rlen, "/dev/%s", ent->d_name); - closedir(dir); - - return r; - } - -+/* -+ * For some reason, openpty() in glibc sometimes doesn't -+ * work at boot-time. It must be a bug with old-style pty -+ * names, as new-style (/dev/pts) is not available at that -+ * point. So, we find a pty/tty pair ourself if openpty() -+ * fails for whatever reason. -+ */ -+int findpty(int *master, int *slave, char *name) -+{ -+ char pty[16]; -+ char tty[16]; -+ int i, j; -+ int found; -+ -+ if (openpty(master, slave, name, NULL, NULL) >= 0) -+ return 0; -+ -+ found = 0; -+ -+ for (i = 'p'; i <= 'z'; i++) { -+ for (j = '0'; j <= 'f'; j++) { -+ if (j == '9' + 1) j = 'a'; -+ sprintf(pty, "/dev/pty%c%c", i, j); -+ sprintf(tty, "/dev/tty%c%c", i, j); -+ if ((*master = open(pty, O_RDWR|O_NOCTTY)) >= 0) { -+ *slave = open(tty, O_RDWR|O_NOCTTY); -+ if (*slave >= 0) { -+ found = 1; -+ break; -+ } -+ } -+ } -+ if (found) break; -+ } -+ if (found < 0) return -1; -+ -+ if (name) strcpy(name, tty); -+ -+ return 0; -+} -+/* -+ * See if a console taken from the kernel command line maps -+ * to a character device we know about, and if we can open it. -+ */ -+int isconsole(char *s, char *res, int rlen) -+{ -+ struct consdev *c; -+ int l, sl, i, fd; -+ char *p, *q; -+ -+ sl = strlen(s); -+ -+ for (c = consdev; c->cmdline; c++) { -+ l = strlen(c->cmdline); -+ if (sl <= l) continue; -+ p = s + l; -+ if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p)) -+ continue; -+ for (i = 0; i < 2; i++) { -+ snprintf(res, rlen, i ? c->dev1 : c->dev2, p); -+ if ((q = strchr(res, ',')) != NULL) *q = 0; -+ if ((fd = open(res, O_RDONLY|O_NONBLOCK)) >= 0) { -+ close(fd); -+ return 1; -+ } -+ } -+ } -+ return 0; -+} - - /* - * Find out the _real_ console. Assume that stdin is connected to -@@ -136,21 +209,18 @@ - */ - int consolename(char *res, int rlen) - { -- struct stat st; --#if TIOCTTYGSTRUCT_HACK -- struct utsname uts; -- struct tty_offsets *tt; -- dev_t dev; -- unsigned short *kdev; -- char buf[4096]; -- int offset = -1; --#endif - #ifdef TIOCGDEV -- kdev_t kdev; -+ unsigned int kdev; - #endif -+ struct stat st, st2; -+ char buf[256]; -+ char *p; -+ int didmount = 0; -+ int n, r; -+ int fd; - - fstat(0, &st); -- if (st.st_rdev != 0x0501) { -+ if (major(st.st_rdev) != 5 || minor(st.st_rdev) != 1) { - /* - * Old kernel, can find real device easily. - */ -@@ -160,33 +230,78 @@ - #ifdef TIOCGDEV - if (ioctl(0, TIOCGDEV, &kdev) == 0) - return findtty(res, rlen, (dev_t)kdev); -- return -1; -+ if (errno != ENOIOCTLCMD) return -1; - #endif - -+#ifdef __linux__ - /* -- * New kernel and new console device - hard to find -- * out what device the real console is .. -+ * Read /proc/cmdline. - */ --#if TIOCTTYGSTRUCT_HACK -- if (ioctl(0, TIOCTTYGSTRUCT, buf) != 0) { -- perror("bootlogd: TIOCTTYGSTRUCT"); -+ stat("/", &st); -+ if (stat("/proc", &st2) < 0) { -+ perror("bootlogd: /proc"); - return -1; - } -- uname(&uts); -- for (tt = tty_offsets; tt->kver; tt++) -- if (!strncmp(uts.release, tt->kver, strlen(tt->kver))) { -- offset = tt->offset; -+ if (st.st_dev == st2.st_dev) { -+ if (mount("proc", "/proc", "proc", 0, NULL) < 0) { -+ perror("bootlogd: mount /proc"); -+ return -1; -+ } -+ didmount = 1; -+ } -+ -+ n = 0; -+ r = -1; -+ if ((fd = open("/proc/cmdline", O_RDONLY)) < 0) { -+ perror("bootlogd: /proc/cmdline"); -+ } else { -+ buf[0] = 0; -+ if ((n = read(fd, buf, sizeof(buf) - 1)) >= 0) -+ r = 0; -+ else -+ perror("bootlogd: /proc/cmdline"); -+ close(fd); -+ } -+ if (didmount) umount("/proc"); -+ -+ if (r < 0) return r; -+ -+ /* -+ * OK, so find console= in /proc/cmdline. -+ * Parse in reverse, opening as we go. -+ * -+ * Valid console devices: ttySC, ttyS, tty, hvc. -+ */ -+ p = buf + n; -+ *p-- = 0; -+ r = -1; -+ while (p >= buf) { -+ if (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') { -+ *p-- = 0; -+ continue; -+ } -+ if (strncmp(p, "console=", 8) == 0 && -+ isconsole(p + 8, res, rlen)) { -+ r = 0; - break; - } -- if (offset < 0) { -- fprintf(stderr, "bootlogd: don't know offsetof" -- "(struct tty_struct, device) for kernel %s\n", uts.release); -- return -1; -+ p--; - } -- kdev = (unsigned short *)(&buf[offset]); -- dev = (dev_t)(*kdev); -- return findtty(res, rlen, dev); -+ -+ if (r == 0) return r; - #endif -+ -+ /* -+ * Okay, no console on the command line - -+ * guess the default console. -+ */ -+ for (n = 0; defcons[n]; n++) -+ if (isconsole(defcons[n], res, rlen)) -+ return 0; -+ -+ fprintf(stderr, "bootlogd: cannot deduce real console device\n"); -+ -+ return -1; - } - - -@@ -197,9 +312,13 @@ - { - time_t t; - char *s; -+ char tmp[8]; - int olen = len; -+ int dosync = 0; -+ int tlen; - - while (len > 0) { -+ tmp[0] = 0; - if (didnl) { - time(&t); - s = ctime(&t); -@@ -207,24 +326,51 @@ - didnl = 0; - } - switch (*ptr) { -+ case 27: /* ESC */ -+ strcpy(tmp, "^["); -+ break; - case '\r': -+ line.pos = 0; -+ break; -+ case 8: /* ^H */ -+ if (line.pos > 0) line.pos--; - break; - case '\n': - didnl = 1; -+ dosync = 1; -+ break; - case '\t': -+ line.pos += (line.pos / 8 + 1) * 8; -+ if (line.pos >= sizeof(line.buf)) -+ line.pos = sizeof(line.buf) - 1; -+ break; - case 32 ... 127: - case 161 ... 255: -- fputc(*ptr, fp); -+ tmp[0] = *ptr; -+ tmp[1] = 0; - break; - default: -- fprintf(fp, "\\%03o", *ptr); -+ sprintf(tmp, "\\%03o", *ptr); - break; - } - ptr++; - len--; -+ -+ tlen = strlen(tmp); -+ if (tlen && (line.pos + tlen < sizeof(line.buf))) { -+ memcpy(line.buf + line.pos, tmp, tlen); -+ line.pos += tlen; -+ } -+ if (didnl) { -+ fprintf(fp, "%s\n", line.buf); -+ memset(&line, 0, sizeof(line)); -+ } -+ } -+ -+ if (dosync) { -+ fflush(fp); -+ fdatasync(fileno(fp)); - } -- fflush(fp); -- fdatasync(fileno(fp)); - - outptr += olen; - if (outptr >= endptr) -@@ -242,6 +388,40 @@ - exit(1); - } - -+int open_nb(char *buf) -+{ -+ int fd, n; -+ -+ if ((fd = open(buf, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0) -+ return -1; -+ n = fcntl(fd, F_GETFL); -+ n &= ~(O_NONBLOCK); -+ fcntl(fd, F_SETFL, n); -+ -+ return fd; -+} -+ -+/* -+ * We got a write error on the real console. If its an EIO, -+ * somebody hung up our filedescriptor, so try to re-open it. -+ */ -+int write_err(int pts, int realfd, char *realcons, int e) -+{ -+ int fd; -+ -+ if (e != EIO) { -+werr: -+ close(pts); -+ fprintf(stderr, "bootlogd: writing to console: %s\n", -+ strerror(e)); -+ return -1; -+ } -+ close(realfd); -+ if ((fd = open_nb(realcons)) < 0) -+ goto werr; -+ -+ return fd; -+} - - int main(int argc, char **argv) - { -@@ -249,6 +429,7 @@ - struct timeval tv; - fd_set fds; - char buf[1024]; -+ char realcons[1024]; - char *p; - char *logfile; - char *pidfile; -@@ -298,23 +479,32 @@ - /* - * Open console device directly. - */ -- if (consolename(buf, sizeof(buf)) < 0) -+ if (consolename(realcons, sizeof(realcons)) < 0) - return 1; -- if ((realfd = open(buf, O_WRONLY|O_NONBLOCK)) < 0) { -+ -+ if (strcmp(realcons, "/dev/tty0") == 0) -+ strcpy(realcons, "/dev/tty1"); -+ if (strcmp(realcons, "/dev/vc/0") == 0) -+ strcpy(realcons, "/dev/vc/1"); -+ -+ if ((realfd = open_nb(realcons)) < 0) { - fprintf(stderr, "bootlogd: %s: %s\n", buf, strerror(errno)); - return 1; - } -- n = fcntl(realfd, F_GETFL); -- n &= ~(O_NONBLOCK); -- fcntl(realfd, F_SETFL, n); - - /* - * Grab a pty, and redirect console messages to it. - */ -- if (openpty(&ptm, &pts, buf, NULL, NULL) < 0) { -- fprintf(stderr, "bootlogd: cannot allocate pseudo tty\n"); -+ ptm = -1; -+ pts = -1; -+ buf[0] = 0; -+ if (findpty(&ptm, &pts, buf) < 0) { -+ fprintf(stderr, -+ "bootlogd: cannot allocate pseudo tty: %s\n", -+ strerror(errno)); - return 1; - } -+ - (void)ioctl(0, TIOCCONS, NULL); - #if 1 - /* Work around bug in 2.1/2.2 kernels. Fixed in 2.2.13 and 2.3.18 */ -@@ -357,8 +547,8 @@ - * open the logfile. There might be buffered messages - * we want to write. - */ -- tv.tv_sec = fp ? 86400 : 5; -- tv.tv_usec = 0; -+ tv.tv_sec = 0; -+ tv.tv_usec = 500000; - FD_ZERO(&fds); - FD_SET(ptm, &fds); - if (select(ptm + 1, &fds, NULL, NULL, &tv) == 1) { -@@ -374,10 +564,22 @@ - p = inptr; - while (m > 0) { - i = write(realfd, p, m); -- if (i <= 0) break; -- m -= i; -- p += i; -+ if (i >= 0) { -+ m -= i; -+ p += i; -+ continue; -+ } -+ /* -+ * Handle EIO (somebody hung -+ * up our filedescriptor) -+ */ -+ realfd = write_err(pts, realfd, -+ realcons, errno); -+ if (realfd >= 0) continue; -+ got_signal = 1; /* Not really */ -+ break; - } -+ - /* - * Increment buffer position. Handle - * wraps, and also drag output pointer -@@ -410,8 +612,8 @@ - writelog(fp, outptr, todo); - } - -- if (fp && !didnl) { -- fputc('\n', fp); -+ if (fp) { -+ if (!didnl) fputc('\n', fp); - fclose(fp); - } - -Binary files sysvinit-2.85/src/bootlogd.o and sysvinit-2.86/src/bootlogd.o differ -diff -urNd -urNd sysvinit-2.85/src/dowall.c sysvinit-2.86/src/dowall.c ---- sysvinit-2.85/src/dowall.c 2003-04-17 06:32:01.000000000 -0500 -+++ sysvinit-2.86/src/dowall.c 2004-06-09 07:47:45.000000000 -0500 -@@ -3,7 +3,7 @@ - * - * Author: Miquel van Smoorenburg, miquels@cistron.nl - * -- * Version: @(#)dowall.c 2.85-1 15-Apr-2003 miquels@cistron.nl -+ * Version: @(#)dowall.c 2.85-5 02-Jul-2003 miquels@cistron.nl - * - * This file is part of the sysvinit suite, - * Copyright 1991-2003 Miquel van Smoorenburg. -@@ -135,6 +135,13 @@ - char *user, *tty; - int fd, flags; - -+ /* -+ * Make sure tp and fd aren't in a register. Some versions -+ * of gcc clobber those after longjmp (or so I understand). -+ */ -+ (void) &tp; -+ (void) &fd; -+ - getuidtty(&user, &tty); - - /* Get the time */ -Binary files sysvinit-2.85/src/dowall.o and sysvinit-2.86/src/dowall.o differ -Binary files sysvinit-2.85/src/halt and sysvinit-2.86/src/halt differ -diff -urNd -urNd sysvinit-2.85/src/halt.c sysvinit-2.86/src/halt.c ---- sysvinit-2.85/src/halt.c 2001-11-27 06:12:03.000000000 -0600 -+++ sysvinit-2.86/src/halt.c 2004-07-30 07:16:18.000000000 -0500 -@@ -8,12 +8,14 @@ - * execute an "shutdown -r". This is for compatibility with - * sysvinit 2.4. - * -- * Usage: halt [-n] [-w] [-d] [-f] [-p] -+ * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p] - * -n: don't sync before halting the system - * -w: only write a wtmp reboot record and exit. - * -d: don't write a wtmp record. - * -f: force halt/reboot, don't call shutdown. -- * -p: power down the system (if possible, otherwise halt) -+ * -h: put harddisks in standby mode -+ * -i: shut down all network interfaces. -+ * -p: power down the system (if possible, otherwise halt). - * - * Reboot and halt are both this program. Reboot - * is just a link to halt. Invoking the program -@@ -21,10 +23,10 @@ - * - * Author: Miquel van Smoorenburg, miquels@cistron.nl - * -- * Version: 2.84, 27-Nov-2001 -+ * Version: 2.86, 30-Jul-2004 - * - * This file is part of the sysvinit suite, -- * Copyright 1991-2001 Miquel van Smoorenburg. -+ * Copyright 1991-2004 Miquel van Smoorenburg. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -47,7 +49,7 @@ - #include - #include "reboot.h" - --char *Version = "@(#)halt 2.84 27-Nov-2001 miquels@cistron.nl"; -+char *Version = "@(#)halt 2.86 31-Jul-2004 miquels@cistron.nl"; - char *progname; - - #define KERNEL_MONITOR 1 /* If halt() puts you into the kernel monitor. */ -@@ -62,7 +64,16 @@ - */ - void usage(void) - { -- fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-i] [-p]\n", progname); -+ fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", -+ progname, strcmp(progname, "halt") ? "" : " [-p]"); -+ fprintf(stderr, "\t-n: don't sync before halting the system\n"); -+ fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); -+ fprintf(stderr, "\t-d: don't write a wtmp record.\n"); -+ fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n"); -+ fprintf(stderr, "\t-h: put harddisks in standby mode.\n"); -+ fprintf(stderr, "\t-i: shut down all network interfaces.\n"); -+ if (!strcmp(progname, "halt")) -+ fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); - exit(1); - } - -@@ -172,11 +183,6 @@ - else - progname = argv[0]; - -- if (geteuid() != 0) { -- fprintf(stderr, "%s: must be superuser.\n", progname); -- exit(1); -- } -- - if (!strcmp(progname, "reboot")) do_reboot = 1; - if (!strcmp(progname, "poweroff")) do_poweroff = 1; - -@@ -216,6 +222,11 @@ - } - if (argc != optind) usage(); - -+ if (geteuid() != 0) { -+ fprintf(stderr, "%s: must be superuser.\n", progname); -+ exit(1); -+ } -+ - (void)chdir("/"); - - if (!do_hard && !do_nothing) { -@@ -236,7 +247,7 @@ - /* - * Exit if all we wanted to do was write a wtmp record. - */ -- if (do_nothing) exit(0); -+ if (do_nothing && !do_hddown && !do_ifdown) exit(0); - - if (do_sync) { - sync(); -@@ -249,13 +260,17 @@ - if (do_hddown) - (void)hddown(); - -+ if (do_nothing) exit(0); -+ - if (do_reboot) { - init_reboot(BMAGIC_REBOOT); - } else { - /* - * Turn on hard reboot, CTRL-ALT-DEL will reboot now - */ -+#ifdef BMAGIC_HARD - init_reboot(BMAGIC_HARD); -+#endif - - /* - * Stop init; it is insensitive to the signals sent -@@ -277,7 +292,9 @@ - /* - * If we return, we (c)ontinued from the kernel monitor. - */ -+#ifdef BMAGIC_SOFT - init_reboot(BMAGIC_SOFT); -+#endif - kill(1, SIGCONT); - - exit(0); -Binary files sysvinit-2.85/src/halt.o and sysvinit-2.86/src/halt.o differ -diff -urNd -urNd sysvinit-2.85/src/hddown.c sysvinit-2.86/src/hddown.c ---- sysvinit-2.85/src/hddown.c 2001-11-07 09:11:21.000000000 -0600 -+++ sysvinit-2.86/src/hddown.c 2004-06-09 07:47:45.000000000 -0500 -@@ -3,7 +3,7 @@ - * shut them down. - * - */ --char *v_hddown = "@(#)hddown.c 1.01 07-Nov-2001 miquels@cistron.nl"; -+char *v_hddown = "@(#)hddown.c 1.02 22-Apr-2003 miquels@cistron.nl"; - - #include - #include -@@ -13,8 +13,9 @@ - #include - #include - --#include -+#ifdef __linux__ - -+#include - #include - - #define MAX_DISKS 64 -@@ -104,6 +105,15 @@ - return 0; - } - -+#else /* __linux__ */ -+ -+int hddown(void) -+{ -+ return 0; -+} -+ -+#endif /* __linux__ */ -+ - #ifdef STANDALONE - int main(int argc, char **argv) - { -Binary files sysvinit-2.85/src/hddown.o and sysvinit-2.86/src/hddown.o differ -Binary files sysvinit-2.85/src/ifdown.o and sysvinit-2.86/src/ifdown.o differ -Binary files sysvinit-2.85/src/init and sysvinit-2.86/src/init differ -diff -urNd -urNd sysvinit-2.85/src/init.c sysvinit-2.86/src/init.c ---- sysvinit-2.85/src/init.c 2003-04-15 06:16:41.000000000 -0500 -+++ sysvinit-2.86/src/init.c 2004-07-30 07:16:20.000000000 -0500 -@@ -5,34 +5,28 @@ - * init [0123456SsQqAaBbCc] - * telinit [0123456SsQqAaBbCc] - * -- * Version: @(#)init.c 2.85 15-Apr-2003 miquels@cistron.nl -+ * Version: @(#)init.c 2.86 30-Jul-2004 miquels@cistron.nl - */ --#define VERSION "2.85" --#define DATE "15-Apr-2003" -+#define VERSION "2.86" -+#define DATE "31-Jul-2004" - /* - * This file is part of the sysvinit suite, -- * Copyright 1991-2003 Miquel van Smoorenburg. -+ * Copyright 1991-2004 Miquel van Smoorenburg. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * -- * Modified: 21 Feb 1998, Al Viro: -- * 'U' flag added to telinit. It forces init to re-exec itself -- * (passing its state through exec, certainly). -- * May be useful for smoother (heh) upgrades. -- * 24 Feb 1998, AV: -- * did_boot made global and added to state - thanks, Miquel. -- * Yet another file descriptors leak - close state pipe if -- * re_exec fails. - */ - - #include - #include - #include - #include -+#ifdef __linux__ - #include -+#endif - #include - #include - #include -@@ -70,6 +64,13 @@ - # define SIGPWR SIGUSR2 - #endif - -+#ifndef CBAUD -+# define CBAUD 0 -+#endif -+#ifndef CBAUDEX -+# define CBAUDEX 0 -+#endif -+ - /* Set a signal handler. */ - #define SETSIG(sa, sig, fun, flags) \ - do { \ -@@ -88,13 +89,13 @@ - CHILD *newFamily = NULL; /* The list after inittab re-read */ - - CHILD ch_emerg = { /* Emergency shell */ -- 0, 0, 0, 0, 0, -- "~~", -- "S", -- 3, -- "/sbin/sulogin", -- NULL, -- NULL -+ 0, 0, 0, 0, 0, -+ "~~", -+ "S", -+ 3, -+ "/sbin/sulogin", -+ NULL, -+ NULL - }; - - char runlevel = 'S'; /* The current run level */ -@@ -108,8 +109,9 @@ - int wrote_utmp_reboot = 1; /* Set when we wrote the reboot record */ - int sltime = 5; /* Sleep time between TERM and KILL */ - char *argv0; /* First arguments; show up in ps listing */ --int maxproclen; /* Maximal length of argv[0] without \0 */ -+int maxproclen; /* Maximal length of argv[0] with \0 */ - struct utmp utproto; /* Only used for sizeof(utproto.ut_id) */ -+char *user_console = NULL; /* User console device */ - char *console_dev; /* Console device. */ - int pipe_fd = -1; /* /dev/initctl */ - int did_boot = 0; /* Did we already do BOOT* stuff? */ -@@ -186,6 +188,10 @@ - {NULL,0} - }; - -+#define NR_EXTRA_ENV 16 -+char *extra_env[NR_EXTRA_ENV]; -+ -+ - /* - * Sleep a number of seconds. - * -@@ -203,6 +209,35 @@ - ; - } - -+ -+/* -+ * Non-failing allocation routines (init cannot fail). -+ */ -+void *imalloc(size_t size) -+{ -+ void *m; -+ -+ while ((m = malloc(size)) == NULL) { -+ initlog(L_VB, "out of memory"); -+ do_sleep(5); -+ } -+ memset(m, 0, size); -+ return m; -+} -+ -+ -+char *istrdup(char *s) -+{ -+ char *m; -+ int l; -+ -+ l = strlen(s) + 1; -+ m = imalloc(l); -+ memcpy(m, s, l); -+ return m; -+} -+ -+ - /* - * Send the state info of the previous running init to - * the new one, in a version-independant way. -@@ -344,12 +379,9 @@ - } - } while (cmd != C_REC); - -- while ((p = (CHILD *)malloc(sizeof(CHILD))) == NULL ) { -- log(L_VB, "out of memory"); -- do_sleep(5); -- } -- memset(p, 0, sizeof(CHILD)); -+ p = imalloc(sizeof(CHILD)); - get_string(p->id, sizeof(p->id), f); -+ - do switch(cmd = get_cmd(f)) { - case 0: - case C_EOR: -@@ -420,7 +452,7 @@ - #ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) - #endif --int setproctitle(char *fmt, ...) -+static int setproctitle(char *fmt, ...) - { - va_list ap; - int len; -@@ -432,8 +464,10 @@ - len = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - -- memset(argv0, 0, maxproclen + 1); -- strncpy(argv0, buf, maxproclen - 1); -+ if (maxproclen > 2) { -+ memset(argv0, 0, maxproclen); -+ strncpy(argv0, buf, maxproclen - 2); -+ } - - return len; - } -@@ -448,7 +482,9 @@ - int tried_vtmaster = 0; - char *s; - -- if ((s = getenv("CONSOLE")) != NULL) -+ if (user_console) { -+ console_dev = user_console; -+ } else if ((s = getenv("CONSOLE")) != NULL) - console_dev = s; - else { - console_dev = CONSOLE; -@@ -528,10 +564,9 @@ - if (errno == ECHILD) break; - for( ch = family; ch; ch = ch->next ) - if ( ch->pid == pid && (ch->flags & RUNNING) ) { --#if DEBUG -- log(L_VB, "chld_handler: marked %d as zombie", -+ INITDBG(L_VB, -+ "chld_handler: marked %d as zombie", - ch->pid); --#endif - ADDSET(got_signals, SIGCHLD); - ch->exstat = st; - ch->flags |= ZOMBIE; -@@ -541,11 +576,9 @@ - } - break; - } --#if DEBUG - if (ch == NULL) -- log(L_VB, "chld_handler: unknown child %d exited.", -+ INITDBG(L_VB, "chld_handler: unknown child %d exited.", - pid); --#endif - } - errno = saved_errno; - } -@@ -563,28 +596,34 @@ - } - - /* -- * Dump core. Returns 0 if we are the child, so that the caller -- * can return if it is a signal handler - SIGSEGV is blocked in -- * the handler, so it will be raised when the handler returns. -+ * Fork and dump core in /. - */ --int coredump(void) -+void coredump(void) - { -- static int dumped = 0; -- struct rlimit rlim; -+ static int dumped = 0; -+ struct rlimit rlim; -+ sigset_t mask; - -- if (dumped) return 1; -+ if (dumped) return; - dumped = 1; - -- if (fork() != 0) return 1; -+ if (fork() != 0) return; -+ -+ sigfillset(&mask); -+ sigprocmask(SIG_SETMASK, &mask, NULL); - - rlim.rlim_cur = RLIM_INFINITY; - rlim.rlim_max = RLIM_INFINITY; - setrlimit(RLIMIT_CORE, &rlim); -- - chdir("/"); -+ - signal(SIGSEGV, SIG_DFL); - raise(SIGSEGV); -- return 0; -+ sigdelset(&mask, SIGSEGV); -+ sigprocmask(SIG_SETMASK, &mask, NULL); -+ -+ do_sleep(5); -+ exit(0); - } - - /* -@@ -592,7 +631,7 @@ - * If we have the info, print where it occured. - * Then sleep 30 seconds and try to continue. - */ --#ifdef STACK_DEBUG -+#if defined(STACK_DEBUG) && defined(__linux__) - void segv_handler(int sig, struct sigcontext ctx) - { - char *p = ""; -@@ -601,10 +640,10 @@ - if ((void *)ctx.eip >= (void *)do_sleep && - (void *)ctx.eip < (void *)main) - p = " (code)"; -- log(L_VB, "PANIC: segmentation violation at %p%s! " -+ initlog(L_VB, "PANIC: segmentation violation at %p%s! " - "sleeping for 30 seconds.", (void *)ctx.eip, p); -- if (coredump() != 0) -- do_sleep(30); -+ coredump(); -+ do_sleep(30); - errno = saved_errno; - } - #else -@@ -612,9 +651,10 @@ - { - int saved_errno = errno; - -- log(L_VB, "PANIC: segmentation violation! sleeping for 30 seconds."); -- if (coredump() != 0) -- do_sleep(30); -+ initlog(L_VB, -+ "PANIC: segmentation violation! sleeping for 30 seconds."); -+ coredump(); -+ do_sleep(30); - errno = saved_errno; - } - #endif -@@ -641,7 +681,7 @@ - int fd; - - if ((fd = console_open(O_RDWR|O_NOCTTY)) < 0) { -- log(L_VB, "can't open %s", console_dev); -+ initlog(L_VB, "can't open %s", console_dev); - return; - } - -@@ -697,10 +737,11 @@ - #ifdef __GNUC__ - __attribute__ ((format (printf, 2, 3))) - #endif --void log(int loglevel, char *s, ...) -+void initlog(int loglevel, char *s, ...) - { - va_list va_alist; - char buf[256]; -+ sigset_t nmask, omask; - - va_start(va_alist, s); - vsnprintf(buf, sizeof(buf), s, va_alist); -@@ -708,11 +749,15 @@ - - if (loglevel & L_SY) { - /* -- * Re-etablish connection with syslogd every time. -+ * Re-establish connection with syslogd every time. -+ * Block signals while talking to syslog. - */ -+ sigfillset(&nmask); -+ sigprocmask(SIG_BLOCK, &nmask, &omask); - openlog("init", 0, LOG_DAEMON); - syslog(LOG_INFO, "%s", buf); - closelog(); -+ sigprocmask(SIG_SETMASK, &omask, NULL); - } - - /* -@@ -727,14 +772,51 @@ - - - /* -- * See if one character of s2 is in s1 -+ * Build a new environment for execve(). - */ --int any(char *s1, char *s2) -+char **init_buildenv(int child) - { -- while(*s2) -- if (strchr(s1, *s2++) != NULL) -- return(1); -- return(0); -+ char i_lvl[] = "RUNLEVEL=x"; -+ char i_prev[] = "PREVLEVEL=x"; -+ char i_cons[32]; -+ char **e; -+ int n, i; -+ -+ for (n = 0; environ[n]; n++) -+ ; -+ n += NR_EXTRA_ENV + 8; -+ e = calloc(n, sizeof(char *)); -+ -+ for (n = 0; environ[n]; n++) -+ e[n] = istrdup(environ[n]); -+ -+ for (i = 0; i < NR_EXTRA_ENV; i++) -+ if (extra_env[i]) -+ e[n++] = istrdup(extra_env[i]); -+ -+ if (child) { -+ snprintf(i_cons, sizeof(i_cons), "CONSOLE=%s", console_dev); -+ i_lvl[9] = thislevel; -+ i_prev[10] = prevlevel; -+ e[n++] = istrdup(i_lvl); -+ e[n++] = istrdup(i_prev); -+ e[n++] = istrdup(i_cons); -+ e[n++] = istrdup(E_VERSION); -+ } -+ -+ e[n++] = NULL; -+ -+ return e; -+} -+ -+ -+void init_freeenv(char **e) -+{ -+ int n; -+ -+ for (n = 0; e[n]; n++) -+ free(e[n]); -+ free(e); - } - - -@@ -753,9 +835,6 @@ - time_t t; /* System time */ - int oldAlarm; /* Previous alarm value */ - char *proc = ch->process; /* Command line */ -- char i_lvl[] = "RUNLEVEL=x"; /* Runlevel in environment. */ -- char i_prev[] = "PREVLEVEL=x";/* Previous runlevel. */ -- char i_cons[32]; /* console device. */ - pid_t pid, pgrp; /* child, console process group. */ - sigset_t nmask, omask; /* For blocking SIGCHLD */ - struct sigaction sa; -@@ -781,8 +860,9 @@ - /* Do we try to respawn too fast? */ - if (ch->count >= MAXSPAWN) { - -- log(L_VB, "Id \"%s\" respawning too fast: disabled for %d minutes", -- ch->id, SLEEPTIME / 60); -+ initlog(L_VB, -+ "Id \"%s\" respawning too fast: disabled for %d minutes", -+ ch->id, SLEEPTIME / 60); - ch->flags &= ~RUNNING; - ch->flags |= FAILING; - -@@ -813,7 +893,7 @@ - } - args[6] = proc; - args[7] = NULL; -- } else if (any(proc, "~`!$^&*()=|\\{}[];\"'<>?")) { -+ } else if (strpbrk(proc, "~`!$^&*()=|\\{}[];\"'<>?")) { - /* See if we need to fire off a shell for this command */ - /* Give command line to shell */ - args[1] = SHELL; -@@ -868,15 +948,6 @@ - - sigprocmask(SIG_SETMASK, &omask, NULL); - -- /* Now set RUNLEVEL and PREVLEVEL */ -- snprintf(i_cons, sizeof(i_cons), "CONSOLE=%s", console_dev); -- i_lvl[9] = thislevel; -- i_prev[10] = prevlevel; -- putenv(i_lvl); -- putenv(i_prev); -- putenv(i_cons); -- putenv(E_VERSION); -- - /* - * In sysinit, boot, bootwait or single user mode: - * for any wait-type subprocess we _force_ the console -@@ -896,7 +967,7 @@ - dup(f); - } - if ((pid = fork()) < 0) { -- log(L_VB, "cannot fork"); -+ initlog(L_VB, "cannot fork"); - exit(1); - } - if (pid > 0) { -@@ -926,7 +997,7 @@ - * this with a temporary process. - */ - if ((pid = fork()) < 0) { -- log(L_VB, "cannot fork"); -+ initlog(L_VB, "cannot fork"); - exit(1); - } - if (pid == 0) { -@@ -946,7 +1017,7 @@ - } else { - setsid(); - if ((f = console_open(O_RDWR|O_NOCTTY)) < 0) { -- log(L_VB, "open(%s): %s", console_dev, -+ initlog(L_VB, "open(%s): %s", console_dev, - strerror(errno)); - f = open("/dev/null", O_RDWR); - } -@@ -954,15 +1025,15 @@ - dup(f); - } - -- /* Reset all the signals */ -+ /* Reset all the signals, set up environment */ - for(f = 1; f < NSIG; f++) SETSIG(sa, f, SIG_DFL, SA_RESTART); -- execvp(args[1], args + 1); -+ environ = init_buildenv(1); - - /* -- * Is this a bug in execvp? It does _not_ execute shell -- * scripts (/etc/rc !), so we try again with -- * 'sh -c exec ...' -+ * Execute prog. In case of ENOEXEC try again -+ * as a shell script. - */ -+ execvp(args[1], args + 1); - if (errno == ENOEXEC) { - args[1] = SHELL; - args[2] = "-c"; -@@ -972,18 +1043,16 @@ - args[4] = NULL; - execvp(args[1], args + 1); - } -- log(L_VB, "cannot execute \"%s\"", args[1]); -+ initlog(L_VB, "cannot execute \"%s\"", args[1]); - exit(1); - } - *res = pid; - sigprocmask(SIG_SETMASK, &omask, NULL); - --#if DEBUG -- log(L_VB, "Started id %s (pid %d)", ch->id, pid); --#endif -+ INITDBG(L_VB, "Started id %s (pid %d)", ch->id, pid); - - if (pid == -1) { -- log(L_VB, "cannot fork, retry.."); -+ initlog(L_VB, "cannot fork, retry.."); - do_sleep(5); - continue; - } -@@ -1032,66 +1101,45 @@ - } - } - --/* -- * My version of strtok(3). -- */ --char *get_part(char *str, int tok) --{ -- static char *s; -- char *p, *q; -- -- if (str != NULL) -- s = str; -- if (s == NULL || *s == 0) -- return(NULL); -- q = p = s; -- while(*p != tok && *p) -- p++; -- if (*p == tok) -- *p++ = 0; -- s = p; -- -- return q; --} - - /* - * Read the inittab file. - */ - void read_inittab(void) - { -- FILE *fp; /* The INITTAB file */ -- char buf[256]; /* Line buffer */ -- char err[64]; /* Error message. */ -- char *id, *rlevel, -- *action, *process; /* Fields of a line */ -- char *p; -- CHILD *ch, *old, *i; /* Pointers to CHILD structure */ -- CHILD *head = NULL; /* Head of linked list */ -- int lineNo = 0; /* Line number in INITTAB file */ -- int actionNo; /* Decoded action field */ -- int f; /* Counter */ -- int round; /* round 0 for SIGTERM, round 1 for SIGKILL */ -- int foundOne = 0; /* No killing no sleep */ -- int talk; /* Talk to the user */ -- int done = 0; /* Ready yet? */ -- sigset_t nmask, omask; /* For blocking SIGCHLD. */ -+ FILE *fp; /* The INITTAB file */ -+ CHILD *ch, *old, *i; /* Pointers to CHILD structure */ -+ CHILD *head = NULL; /* Head of linked list */ - #ifdef INITLVL -- struct stat st; /* To stat INITLVL */ -+ struct stat st; /* To stat INITLVL */ - #endif -+ sigset_t nmask, omask; /* For blocking SIGCHLD. */ -+ char buf[256]; /* Line buffer */ -+ char err[64]; /* Error message. */ -+ char *id, *rlevel, -+ *action, *process; /* Fields of a line */ -+ char *p; -+ int lineNo = 0; /* Line number in INITTAB file */ -+ int actionNo; /* Decoded action field */ -+ int f; /* Counter */ -+ int round; /* round 0 for SIGTERM, 1 for SIGKILL */ -+ int foundOne = 0; /* No killing no sleep */ -+ int talk; /* Talk to the user */ -+ int done = 0; /* Ready yet? */ - - #if DEBUG - if (newFamily != NULL) { -- log(L_VB, "PANIC newFamily != NULL"); -+ INITDBG(L_VB, "PANIC newFamily != NULL"); - exit(1); - } -- log(L_VB, "Reading inittab"); -+ INITDBG(L_VB, "Reading inittab"); - #endif - - /* - * Open INITTAB and real line by line. - */ - if ((fp = fopen(INITTAB, "r")) == NULL) -- log(L_VB, "No inittab file found"); -+ initlog(L_VB, "No inittab file found"); - - while(!done) { - /* -@@ -1103,9 +1151,9 @@ - * See if we have a single user entry. - */ - for(old = newFamily; old; old = old->next) -- if (strcmp(old->rlevel, "S") == 0) break; -+ if (strpbrk(old->rlevel, "S")) break; - if (old == NULL) -- snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SHELL); -+ snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN); - else - continue; - } -@@ -1120,10 +1168,10 @@ - /* - * Decode the fields - */ -- id = get_part(p, ':'); -- rlevel = get_part(NULL, ':'); -- action = get_part(NULL, ':'); -- process = get_part(NULL, '\n'); -+ id = strsep(&p, ":"); -+ rlevel = strsep(&p, ":"); -+ action = strsep(&p, ":"); -+ process = strsep(&p, "\n"); - - /* - * Check if syntax is OK. Be very verbose here, to -@@ -1145,10 +1193,8 @@ - if (action && strlen(action) > 32) - strcpy(err, "action field too long"); - if (err[0] != 0) { -- log(L_VB, "%s[%d]: %s", INITTAB, lineNo, err); --#if DEBUG -- log(L_VB, "%s:%s:%s:%s", id, rlevel, action, process); --#endif -+ initlog(L_VB, "%s[%d]: %s", INITTAB, lineNo, err); -+ INITDBG(L_VB, "%s:%s:%s:%s", id, rlevel, action, process); - continue; - } - -@@ -1162,7 +1208,7 @@ - break; - } - if (actionNo == -1) { -- log(L_VB, "%s[%d]: %s: unknown action field", -+ initlog(L_VB, "%s[%d]: %s: unknown action field", - INITTAB, lineNo, action); - continue; - } -@@ -1172,7 +1218,7 @@ - */ - for(old = newFamily; old; old = old->next) { - if(strcmp(old->id, id) == 0 && strcmp(id, "~~")) { -- log(L_VB, "%s[%d]: duplicate ID field \"%s\"", -+ initlog(L_VB, "%s[%d]: duplicate ID field \"%s\"", - INITTAB, lineNo, id); - break; - } -@@ -1182,11 +1228,7 @@ - /* - * Allocate a CHILD structure - */ -- while ((ch = malloc(sizeof(CHILD))) == NULL) { -- log(L_VB, "out of memory"); -- do_sleep(5); -- } -- memset(ch, 0, sizeof(CHILD)); -+ ch = imalloc(sizeof(CHILD)); - - /* - * And fill it in. -@@ -1275,9 +1317,7 @@ - * be killed. - */ - --#if DEBUG -- log(L_VB, "Checking for children to kill"); --#endif -+ INITDBG(L_VB, "Checking for children to kill"); - for(round = 0; round < 2; round++) { - talk = 1; - for(ch = family; ch; ch = ch->next) { -@@ -1328,19 +1368,19 @@ - ch->flags &= ~KILLME; - continue; - } --#if DEBUG -- log(L_VB, "Killing \"%s\"", ch->process); --#endif -+ INITDBG(L_VB, "Killing \"%s\"", ch->process); - switch(round) { - case 0: /* Send TERM signal */ - if (talk) -- log(L_CO, "Sending processes the TERM signal"); -+ initlog(L_CO, -+ "Sending processes the TERM signal"); - kill(-(ch->pid), SIGTERM); - foundOne = 1; - break; - case 1: /* Send KILL signal and collect status */ - if (talk) -- log(L_CO, "Sending processes the KILL signal"); -+ initlog(L_CO, -+ "Sending processes the KILL signal"); - kill(-(ch->pid), SIGKILL); - break; - } -@@ -1380,12 +1420,11 @@ - for(ch = family; ch; ch = ch->next) - if (ch->flags & KILLME) { - if (!(ch->flags & ZOMBIE)) -- log(L_CO, "Pid %d [id %s] seems to hang", ch->pid, -+ initlog(L_CO, "Pid %d [id %s] seems to hang", ch->pid, - ch->id); - else { --#if DEBUG -- log(L_VB, "Updating utmp for pid %d [id %s]", ch->pid, ch->id); --#endif -+ INITDBG(L_VB, "Updating utmp for pid %d [id %s]", -+ ch->pid, ch->id); - ch->flags &= ~RUNNING; - if (ch->process[0] != '+') - write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL); -@@ -1451,15 +1490,13 @@ - CHILD *ch; /* Pointer to child */ - int delete; /* Delete this entry from list? */ - --#if DEBUG -- log(L_VB, "Checking for children to start"); --#endif -+ INITDBG(L_VB, "Checking for children to start"); - - for(ch = family; ch; ch = ch->next) { - - #if DEBUG - if (ch->rlevel[0] == 'C') { -- log(L_VB, "%s: flags %d", ch->process, ch->flags); -+ INITDBG(L_VB, "%s: flags %d", ch->process, ch->flags); - } - #endif - -@@ -1545,7 +1582,8 @@ - if (lvl > 0) { - if (islower(lvl)) lvl = toupper(lvl); - if (strchr("0123456789S", lvl) == NULL) { -- log(L_VB, "Initdefault level '%c' is invalid", lvl); -+ initlog(L_VB, -+ "Initdefault level '%c' is invalid", lvl); - lvl = 0; - } - } -@@ -1570,98 +1608,99 @@ - */ - int read_level(int arg) - { -- unsigned char foo = 'X'; /* Contents of INITLVL */ -- CHILD *ch; /* Walk through list */ -- int ok = 1; -+ CHILD *ch; /* Walk through list */ -+ unsigned char foo = 'X'; /* Contents of INITLVL */ -+ int ok = 1; - #ifdef INITLVL -- FILE *fp; -- int st; -- struct stat stt; -+ FILE *fp; -+ struct stat stt; -+ int st; - #endif - -- if (arg) foo = arg; -+ if (arg) foo = arg; - - #ifdef INITLVL -- ok = 0; -+ ok = 0; - -- if (arg == 0) { -- fp = NULL; -- if (stat(INITLVL, &stt) != 0 || stt.st_size != 0L) -- fp = fopen(INITLVL, "r"); -+ if (arg == 0) { -+ fp = NULL; -+ if (stat(INITLVL, &stt) != 0 || stt.st_size != 0L) -+ fp = fopen(INITLVL, "r"); - #ifdef INITLVL2 -- if (fp == NULL && (stat(INITLVL2, &stt) != 0 || stt.st_size != 0L)) -- fp = fopen(INITLVL2, "r"); -+ if (fp == NULL && -+ (stat(INITLVL2, &stt) != 0 || stt.st_size != 0L)) -+ fp = fopen(INITLVL2, "r"); - #endif -- if (fp == NULL) { -- /* INITLVL file is empty or not there - act as 'init q' */ -- log(L_SY, "Re-reading inittab"); -- return(runlevel); -+ if (fp == NULL) { -+ /* INITLVL file empty or not there - act as 'init q' */ -+ initlog(L_SY, "Re-reading inittab"); -+ return(runlevel); -+ } -+ ok = fscanf(fp, "%c %d", &foo, &st); -+ fclose(fp); -+ } else { -+ /* We go to the new runlevel passed as an argument. */ -+ foo = arg; -+ ok = 1; - } -- ok = fscanf(fp, "%c %d", &foo, &st); -- fclose(fp); -- } else { -- /* We go to the new runlevel passed as an argument. */ -- foo = arg; -- ok = 1; -- } -- if (ok == 2) sltime = st; -+ if (ok == 2) sltime = st; - - #endif /* INITLVL */ - -- if (islower(foo)) foo = toupper(foo); -- if (ok < 1 || ok > 2 || strchr("QS0123456789ABCU", foo) == NULL) { -- log(L_VB, "bad runlevel: %c", foo); -- return(runlevel); -- } -+ if (islower(foo)) foo = toupper(foo); -+ if (ok < 1 || ok > 2 || strchr("QS0123456789ABCU", foo) == NULL) { -+ initlog(L_VB, "bad runlevel: %c", foo); -+ return runlevel; -+ } - -- /* Log this action */ -- switch(foo) { -- case 'S': -- log(L_VB, "Going single user"); -- break; -- case 'Q': -- log(L_SY, "Re-reading inittab"); -- break; -- case 'A': -- case 'B': -- case 'C': -- log(L_SY, "Activating demand-procedures for '%c'", foo); -- break; -- case 'U': -- log(L_SY, "Trying to re-exec init"); -- return 'U'; -- default: -- log(L_VB, "Switching to runlevel: %c", foo); -- } -+ /* Log this action */ -+ switch(foo) { -+ case 'S': -+ initlog(L_VB, "Going single user"); -+ break; -+ case 'Q': -+ initlog(L_SY, "Re-reading inittab"); -+ break; -+ case 'A': -+ case 'B': -+ case 'C': -+ initlog(L_SY, -+ "Activating demand-procedures for '%c'", foo); -+ break; -+ case 'U': -+ initlog(L_SY, "Trying to re-exec init"); -+ return 'U'; -+ default: -+ initlog(L_VB, "Switching to runlevel: %c", foo); -+ } - -- if (foo == 'Q') return(runlevel); -+ if (foo == 'Q') return runlevel; - -- /* Check if this is a runlevel a, b or c */ -- if (strchr("ABC", foo)) { -- if (runlevel == 'S') return(runlevel); -+ /* Check if this is a runlevel a, b or c */ -+ if (strchr("ABC", foo)) { -+ if (runlevel == 'S') return(runlevel); - -- /* Read inittab again first! */ -- read_inittab(); -+ /* Read inittab again first! */ -+ read_inittab(); - -- /* Mark those special tasks */ -- for(ch = family; ch; ch = ch->next) -- if (strchr(ch->rlevel, foo) != NULL || -- strchr(ch->rlevel, tolower(foo)) != NULL) { -- ch->flags |= DEMAND; -- ch->flags &= ~XECUTED; --#if DEBUG -- log(L_VB, "Marking (%s) as ondemand, flags %d", -- ch->id, ch->flags); --#endif -- } -- return(runlevel); -- } -+ /* Mark those special tasks */ -+ for(ch = family; ch; ch = ch->next) -+ if (strchr(ch->rlevel, foo) != NULL || -+ strchr(ch->rlevel, tolower(foo)) != NULL) { -+ ch->flags |= DEMAND; -+ ch->flags &= ~XECUTED; -+ INITDBG(L_VB, -+ "Marking (%s) as ondemand, flags %d", -+ ch->id, ch->flags); -+ } -+ return runlevel; -+ } - -- /* Store both the old and the new runlevel. */ -- write_utmp_wtmp("runlevel", "~~", foo + 256*runlevel, RUN_LVL, "~"); -- thislevel = foo; -- prevlevel = runlevel; -- return(foo); -+ /* Store both the old and the new runlevel. */ -+ write_utmp_wtmp("runlevel", "~~", foo + 256*runlevel, RUN_LVL, "~"); -+ thislevel = foo; -+ prevlevel = runlevel; -+ return foo; - } - - -@@ -1674,32 +1713,33 @@ - */ - void fail_check(void) - { -- time_t t; /* System time */ -- CHILD *ch; /* Pointer to child structure */ -- time_t next_alarm = 0; /* When to set next alarm */ -+ CHILD *ch; /* Pointer to child structure */ -+ time_t t; /* System time */ -+ time_t next_alarm = 0; /* When to set next alarm */ - -- time(&t); -+ time(&t); - -- for(ch = family; ch; ch = ch->next) { -+ for(ch = family; ch; ch = ch->next) { - -- if (ch->flags & FAILING) { -- /* Can we free this sucker? */ -- if (ch->tm + SLEEPTIME < t) { -- ch->flags &= ~FAILING; -- ch->count = 0; -- ch->tm = 0; -- } else { -- /* No, we'll look again later */ -- if (next_alarm == 0 || ch->tm + SLEEPTIME > next_alarm) -- next_alarm = ch->tm + SLEEPTIME; -+ if (ch->flags & FAILING) { -+ /* Can we free this sucker? */ -+ if (ch->tm + SLEEPTIME < t) { -+ ch->flags &= ~FAILING; -+ ch->count = 0; -+ ch->tm = 0; -+ } else { -+ /* No, we'll look again later */ -+ if (next_alarm == 0 || -+ ch->tm + SLEEPTIME > next_alarm) -+ next_alarm = ch->tm + SLEEPTIME; -+ } - } - } -- } -- if (next_alarm) { -- next_alarm -= t; -- if (next_alarm < 1)