Commit 1f241c1e authored by Dmitry Bogatov's avatar Dmitry Bogatov

Merge branch 'release/2.94-1'

 Regenerate debian/changelog
 New upstream version 2.94
 Clean up unused leftover legacy migration code from postinst
 Remove write-only variable left over from legacy migration postinst code
 Remove random seed on initscripts purge (Closes: #839238)
 Do not enable tmpfs-based shm on Hurd (Closes: #922915)
 Update Danish translation of the debconf templates (Closes: #923058)
 Remove useless macro from init-d-script.5 (Closes: #905243)
 Clarify README in /etc/rc2.d (Closes: #608573)
 Improve logging about swapfile activation (Closes: #501336)
parents 399ebb96 520ea68c
sysvinit (2.94-1) experimental; urgency=medium
* New upstream release (Closes: #923371, #671589)
* Remove unused code from initscripts postinst (Closes: #923168)
* Update Danish translation of the debconf templates (Closes: #923058)
+ Thanks: Joe Dalton <joedalton2@yahoo.dk>
* Do not enable tmpfs-based shm on Hurd (Closes: #922915)
* Remove useless macro from init-d-script.5 (Closes: #905243)
+ Thanks: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* Remove random seed on initscripts purge (Closes: #839238)
* Clarify README in /etc/rc2.d (Closes: #608573)
* Improve logging about swapfile activation (Closes: #501336)
-- Dmitry Bogatov <KAction@debian.org> Thu, 28 Feb 2019 09:59:39 +0000
sysvinit (2.93-9) experimental; urgency=medium
* Ensure predictable permission on /var/log/dmesg. (Closes: #867747)
......
......@@ -66,7 +66,6 @@ can be used instead of implementing ones own do_reload function:
.EX
alias do_reload=do_reload_sigusr1
.EE
.RE
.SH FILES
.TP
.I /lib/init/init-d-script
......@@ -74,7 +73,6 @@ Bourne shell interpreter with implementation of init.d actions
.TP
.I /etc/init.d/
Location of init.d scripts.
.RE
.SH KNOWN BUGS/LIMITATIONS
Not yet documented
.SH AUTHOR
......
......@@ -9,12 +9,6 @@ set -e
. /lib/init/tmpfs.sh
. /lib/init/mount-functions.sh
# Set this as a variable to hide from lintian the fact that we're removing
# it; otherwise, a wrong lintian check + ftp fatal autoreject prevents us
# from uploading this legitimate code, even though the previous upload was
# accepted without incident.
devshm=/dev/shm
case "$1" in
configure)
PREV_VER=$2
......@@ -26,40 +20,6 @@ esac
umask 022
compat_link () {
SRC=$1
DEST=$2
ssrc="$(stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
sdest="$(stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"
if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
echo "guest environment detected: Linking $DEST to $SRC"
(
if [ -e $DEST ]; then
if [ -L $DEST ]; then
echo "$DEST is already a symlink; not replacing with link to $SRC"
exit 0
elif [ -d $DEST ]; then
rmdir $DEST || exit 1
else
echo "$DEST isn't a directory or a symlink"
exit 1
fi
fi
ln -fs $SRC $DEST
) || {
echo "Can't symlink $DEST to $SRC; please fix manually."
return 1
}
if which restorecon >/dev/null 2>&1; then
restorecon "$DEST"
fi
fi
return 0
}
# In 2.88dsf-23 the "mountoverflowtmp" script was dropped entirely.
if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-23" ; then
update-rc.d -f mountoverflowtmp remove >/dev/null
......
......@@ -22,6 +22,7 @@ case "$1" in
rm -f /etc/init.d/bootclean.sh.dpkg-old
rm -f /etc/default/bootlogd
rm -f /etc/default/bootlogd.dpkg-old
rm -f /var/lib/urandom/random-seed
#
# Remove configuration files
......
# Danish translation sysvinit.
# Copyright (C) 2012 sysvinit & Joe Hansen.
# Copyright (C) 2019 sysvinit & Joe Hansen.
# This file is distributed under the same license as the sysvinit package.
# Joe Hansen <joedalton2@yahoo.dk>, 2010, 2012.
# Joe Hansen <joedalton2@yahoo.dk>, 2010, 2012, 2019.
#
msgid ""
msgstr ""
"Project-Id-Version: sysvinit\n"
"Report-Msgid-Bugs-To: sysvinit@packages.debian.org\n"
"POT-Creation-Date: 2018-10-26 08:14+0000\n"
"PO-Revision-Date: 2012-06-10 17:30+01:00\n"
"PO-Revision-Date: 2019-02-23 17:30+01:00\n"
"Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
"Language-Team: Danish <debian-l10n-danish@lists.debian.org>\n"
"Language: \n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
......@@ -20,7 +20,7 @@ msgstr ""
#. Description
#: ../sysvinit-core.templates:1001
msgid "Update getty pathnames and add hurd-console?"
msgstr ""
msgstr "Opdater getty-stinavne og tilføj hurd-console?"
#. Type: boolean
#. Description
......@@ -32,6 +32,11 @@ msgid ""
"Hurd system for long, so any errors in that file would not have shown up "
"earlier."
msgstr ""
"Din /etc/inittab ser ud til at bruge /libexec/getty som getty og/eller at "
"mangle hurd-consol-elementet. Standarden for inittab er blevet ændret, din "
"/etc/inittab er dog blevet ændret. Bemærk at sysvnit ikke har været brugt "
"til at starte et Hurd-system op i lang tid, så enhver fejl i den fil, vil "
"ikke have vist sig tidligere."
#. Type: boolean
#. Description
......@@ -39,6 +44,8 @@ msgstr ""
msgid ""
"If you allow this change, a backup will be stored in /etc/inittab.dpkg-old."
msgstr ""
"Hvis du tillader denne ændring, så vil en sikkerhedskopi blive lagret i "
"/etc/inittab.dpkg-old."
#. Type: boolean
#. Description
......@@ -48,6 +55,9 @@ msgid ""
"inittab.dpkg-new. Please review the changes and update your /etc/inittab "
"accordingly."
msgstr ""
"Hvis du ikke tillader denne ændring, så vil en opdateret inittab blive "
"skrevet til /etc/inittab.dpkg-new. Gennemse venligst ændringerne og opdater "
"din /etc/inittab jævnfør ændringerne."
#~ msgid "Unable to migrate to dependency-based boot system"
#~ msgstr "Kunne ikke migrere til afhængighedsbaseret opstartssystem"
......
......@@ -74,11 +74,11 @@ do_start() {
else
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Activating swapfile swap"
log_action_begin_msg "Activating swapfile swap, if any"
swapon -a -e 2>/dev/null || : # Stifle "Device or resource busy"
log_action_end_msg 0
else
log_daemon_msg "Will now activate swapfile swap"
log_daemon_msg "Will now activate swapfile swap, if any"
swapon -a -e -v
log_action_end_msg $?
fi
......
......@@ -86,7 +86,15 @@ need_overflow_tmp ()
RAMLOCK=yes
# These might be overridden by /etc/default/rcS
if [ -z "$RAMSHM" ]; then RAMSHM=yes; fi
if test -z "${RAMSHM}" ; then
# tmpfs can not be used for shm yet, see #923078
case "$(uname -s)" in
(GNU) RAMSHM=no ;;
(*) RAMSHM=yes ;;
esac
fi
if [ -z "$RAMTMP" ]; then RAMTMP=no; fi
TMPFS_SIZE=20%VM
......
......@@ -6,7 +6,7 @@ The scripts are all symbolic links whose targets are located in
To disable a service in this runlevel, rename its script in this
directory so that the new name begins with a 'K' and a two-digit
number, and run 'update-rc.d script defaults' to reorder the scripts
number, and run 'update-rc.d <script> defaults' to reorder the scripts
according to dependencies. A warning about the current runlevels
being enabled not matching the LSB header in the init.d script will be
printed. To re-enable the service, rename the script back to its
......
sysvinit (2.94) unreleased; urgency=low
[ Jesse Smith ]
* When the halt command is called with the -p flag (or as poweroff)
the command now passes the "-h -P" flags to shutdown. This
in turn sets the INIT_HALT environment variable to POWEROFF.
Assuming this value is checked by initscripts during the
shutting down procedure, it should cause the system to
be powered off.
If halt is called without -p then the value of INIT_HALT
is not set and the default action (often set in /etc/defaut/halt)
is taken.
* Removed unnecessary malloc.h includes. Memory allocation
and freeing is now handled in stdlib.h
* Added defines for FreeBSD to make some components compile
on FreeBSD 11.
* Increased the size of the kernel command line buffer in bootlogd
from 256 characters to 4096. This size is defined in KERNEL_COMMAND_LENGTH
for easy modification downstream.
* Added logsave.c and logsave.8 manual page from e2fsprogs to make
sure logsave is available to initscripts.
* Updated src/Makefile to make sure bootlogd compiles with Clang.
* Use defined constants for password length in sulogin. Makes
it easier to update/patch later.
* Minor code fixes across multiple source files to avoid buffer
overflows, or uninitialized strings.
* Changed the way the "when" variable is used internally in shutdown.c.
It starts as a NULL pointer, then might get set as a pointer to optarg,
then it might get set to point to an argv parameter, then it might have
a string value copied into it, over-writing the original data. We should
not risk over-writing internal variables which might get used for something
else (it's rude and security risk). Set up "when" as its own buffer
that has data from optargs and/or argv copied into it.
* Fixed typo in init.8 manual page.
* Updated text of fstab-decode to explain what the utility does.
sysvinit (2.93) released; urgency=low
[ Jesse Smith ]
......@@ -5,6 +43,10 @@ sysvinit (2.93) released; urgency=low
* Fixed typo in pidof which would prevent the -o (omit PID)
flag from working.
Fixes Debian bug ##913394.
* Fixed error where pidof would not omit checking PIDs passed
to it when the -o flag was used.
Fixes Debian bug #913394.
sysvinit (2.92) released; urgency=low
......
......@@ -27,13 +27,26 @@ fstab-decode \- run a command with fstab-encoded arguments
.SH DESCRIPTION
.B fstab-decode
decodes escapes in the specified \fIARGUMENT\fRs
decodes escapes (such as newline characters) in the specified \fIARGUMENT\fRs
and uses them to run \fICOMMAND\fR.
The argument escaping uses the same rules as path escaping in
\fB/etc/fstab\fR,
.B /etc/mtab
and \fB/proc/mtab\fR.
In essence fstab-decode can be used anytime we want to pass multiple
parameters to a command as a list of command line argments. It turns output
like this:
.nf
/root
/mnt/remote-disk
/home
Into one long list of parameters, "/root /mnt/remote-disk /home". This
can be useful when trying to work with multiple filesystems at once. For
instance, we can use it to unmount multiple NFS shares.
.SH EXIT STATUS
.B fstab-decode
exits with status 127 if
......@@ -43,5 +56,11 @@ Otherwise it exits with the status returned by \fICOMMAND\fR.
.SH EXAMPLES
.nf
The following example reads fstab, finds all instances of VFAT filesystems and
prints their mount points (argument 2 in the fstab file). fstab-decode then runs
the specified program, umount, and passes it the list of VFAT mountpoints.
This unmounts all VFAT partitions.
.B fstab-decode umount $(awk \[aq]$3 == \[dq]vfat\[dq] { print $2 }\[aq] /etc/fstab)
.fi
'\" -*- coding: UTF-8 -*-
.\" A man page for fstab-decode(8).
.\"
.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved.
.\"
.\" This copyrighted material is made available to anyone wishing to use,
.\" modify, copy, or redistribute it subject to the terms and conditions of the
.\" GNU General Public License v.2.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU General Public License along
.\" with this program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" Author: Miloslav Trmac <mitr@redhat.com>
.TH fstab-decode 8 "May 2006"
.SH NAME
fstab-decode \- run a command with fstab-encoded arguments
.SH SYNOPSIS
\fBfstab-decode\fR \fICOMMAND\fR [\fIARGUMENT\fR]...
.SH DESCRIPTION
.B fstab-decode
decodes escapes in the specified \fIARGUMENT\fRs
and uses them to run \fICOMMAND\fR.
The argument escaping uses the same rules as path escaping in
\fB/etc/fstab\fR,
.B /etc/mtab
and \fB/proc/mtab\fR.
.SH EXIT STATUS
.B fstab-decode
exits with status 127 if
.I COMMAND
can't be run.
Otherwise it exits with the status returned by \fICOMMAND\fR.
.SH EXAMPLES
.nf
.B fstab-decode umount $(awk \[aq]$3 == \[dq]vfat\[dq] { print $2 }\[aq] /etc/fstab)
.fi
......@@ -276,7 +276,7 @@ On receipt of this signals, init closes and re-opens its control fifo,
.TP 0.5i
.B SIGUSR2
When init receives SIGUSR2, init closes and leaves the control fifo,
\fB/run/initctl\f\P, closed. This may be used to make sure init is not
\fB/run/initctl\fP, closed. This may be used to make sure init is not
holding open any files. However, it also prevents init from switching
runlevels. Which means commands like shutdown no longer work.
The fifo can be re-opened by sending init the SIGUSR1 signal.
......
.\" -*- nroff -*-
.\" Copyright 2003 by Theodore Ts'o. All Rights Reserved.
.\" This file may be copied under the terms of the GNU Public License.
.\"
.TH LOGSAVE 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
logsave \- save the output of a command in a logfile
.SH SYNOPSIS
.B logsave
[
.B \-asv
]
.I logfile cmd_prog [ ... ]
.SH DESCRIPTION
The
.B logsave
program will execute
.I cmd_prog
with the specified argument(s), and save a copy of its output to
.IR logfile .
If the containing directory for
.I logfile
does not exist,
.B logsave
will accumulate the output in memory until it can be written out.
A copy of the output will also be written to standard output.
.PP
If
.I cmd_prog
is a single hyphen ('-'), then instead of executing a program,
.B logsave
will take its input from standard input and save it in
.I logfile
.PP
.B logsave
is useful for saving the output of initial boot scripts
until the /var partition is mounted, so the output can be written to
/var/log.
.SH OPTIONS
.TP
.B \-a
This option will cause the output to be appended to
.IR logfile ,
instead of replacing its current contents.
.TP
.B \-s
This option will cause
.B logsave
to skip writing to the log file text which is bracketed with a control-A
(ASCII 001 or Start of Header) and control-B (ASCII 002 or Start of
Text). This allows progress bar information to be visible to the user
on the console, while not being written to the log file.
.TP
.B \-v
This option will make
.B logsave
to be more verbose in its output to the user.
.SH AUTHOR
Theodore Ts'o (tytso@mit.edu)
.SH SEE ALSO
.BR fsck (8)
......@@ -23,13 +23,13 @@ MNTPOINT=
# For some known distributions we do not build all programs, otherwise we do.
BIN =
SBIN = init halt shutdown runlevel killall5 fstab-decode
SBIN = init halt shutdown runlevel killall5 fstab-decode logsave
USRBIN = last mesg readbootlog
MAN1 = last.1 lastb.1 mesg.1 readbootlog.1
MAN5 = initscript.5 inittab.5 initctl.5
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
MAN8 += shutdown.8 telinit.8 fstab-decode.8
MAN8 += shutdown.8 telinit.8 fstab-decode.8 logsave.8
ifeq ($(DISTRO),)
SBIN += sulogin bootlogd
......@@ -115,6 +115,9 @@ halt: halt.o ifdown.o hddown.o utmp.o runlevellog.o
last: LDLIBS += $(STATIC)
last: last.o
logsave: LDLIBS += $(STATIC)
logsave: logsave.o
mesg: LDLIBS += $(STATIC)
mesg: mesg.o
......@@ -137,10 +140,10 @@ shutdown: LDLIBS += $(STATIC)
shutdown: dowall.o shutdown.o utmp.o
bootlogd: LDLIBS += -lutil $(STATIC)
bootlogd: bootlogd.o bootlogd.h
bootlogd: bootlogd.o
readbootlog: LDLIBS += $(STATIC)
readbootlog: readbootlog.o bootlogd.h
readbootlog: readbootlog.o
fstab-decode: LDLIBS += $(STATIC)
fstab-decode: fstab-decode.o
......@@ -151,7 +154,7 @@ sulogin.o: sulogin.c
runlevellog.o: runlevellog.h runlevellog.c paths.h
init.o: CPPFLAGS += $(SELINUX_DEF)
init.o: init.c init.h initreq.h paths.h reboot.h runlevellog.h runlevellog.c set.h paths.h
init.o: init.c init.h initreq.h paths.h reboot.h runlevellog.h runlevellog.c set.h
utmp.o:
......@@ -159,6 +162,10 @@ init_utmp.o: CPPFLAGS += -DINIT_MAIN
init_utmp.o: utmp.c init.h initreq.h paths.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
bootlogd.o: bootlogd.c bootlogd.h
readbootlog.o: readbootlog.c
utmpdump.o: utmpdump.c oldutmp.h
shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
......@@ -167,6 +174,8 @@ halt.o: halt.c reboot.h paths.h runlevellog.c runlevellog.h
last.o: last.c oldutmp.h
logsave.o: logsave.c
consoles.o: consoles.c consoles.h
cleanobjs:
......
......@@ -24,12 +24,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* *NOTE* *NOTE* *NOTE*
* This is a PROOF OF CONCEPT IMPLEMENTATION
*
* I have bigger plans for Debian, but for now
* this has to do ;)
*
*/
#include <sys/types.h>
......@@ -40,7 +34,6 @@
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
......@@ -48,7 +41,15 @@
#include <getopt.h>
#include <dirent.h>
#include <fcntl.h>
#ifdef __linux__
#include <pty.h>
#endif
#ifdef __FreeBSD__
#include <termios.h>
#include <libutil.h>
#endif
#include <ctype.h>
#ifdef __linux__
#include <sys/mount.h>
......@@ -56,6 +57,7 @@
#include "bootlogd.h"
#define MAX_CONSOLES 16
#define KERNEL_COMMAND_LENGTH 4096
char ringbuf[32768];
char *endptr = ringbuf + sizeof(ringbuf);
......@@ -250,7 +252,7 @@ int consolenames(struct real_cons *cons, int max_consoles)
/* This appears to be unused. unsigned int kdev; */
#endif
struct stat st, st2;
char buf[256];
char buf[KERNEL_COMMAND_LENGTH];
char *p;
int didmount = 0;
int n;
......@@ -279,17 +281,14 @@ int consolenames(struct real_cons *cons, int max_consoles)
perror("bootlogd: /proc/cmdline");
} else {
buf[0] = 0;
if ((n = read(fd, buf, sizeof(buf) - 1)) < 0)
if ((n = read(fd, buf, KERNEL_COMMAND_LENGTH - 1)) < 0)
perror("bootlogd: /proc/cmdline");
close(fd);
}
if (didmount) umount("/proc");
if (n < 0) return 0;
/*
* OK, so find console= in /proc/cmdline.
* Parse in reverse, opening as we go.
......
......@@ -155,13 +155,15 @@ int get_runlevel(void)
/*
* Switch to another runlevel.
*/
void do_shutdown(char *fl, char *tm)
void do_shutdown(char *fl, int should_poweroff, char *tm)
{
char *args[8];
char *args[9];
int i = 0;
args[i++] = "shutdown";
args[i++] = fl;
if ( (! strcmp(fl, "-h") ) && (should_poweroff) )
args[i++] = "-P";
if (tm) {
args[i++] = "-t";
args[i++] = tm;
......@@ -259,7 +261,7 @@ int main(int argc, char **argv)
*/
c = get_runlevel();
if (c != '0' && c != '6')
do_shutdown(do_reboot ? "-r" : "-h", tm);
do_shutdown(do_reboot ? "-r" : "-h", do_poweroff, tm);
}
/*
......
......@@ -13,11 +13,12 @@
Version information is not placed in the top-level Makefile by default
*/
#ifndef VERSION
#define VERSION "2.91"
#define VERSION "2.94"
#endif
/*
* This file is part of the sysvinit suite,
* Copyright (C) 1991-2004 Miquel van Smoorenburg.
* Copyright (C) 2017-2019 Jesse Smith
*
* 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
......@@ -52,7 +53,11 @@ Version information is not placed in the top-level Makefile by default
#include <string.h>
#include <signal.h>
#include <termios.h>
#ifdef __FreeBSD__
#include <utmpx.h>
#else
#include <utmp.h>
#endif
#include <ctype.h>
#include <stdarg.h>
#include <sys/ttydefaults.h>
......@@ -62,6 +67,9 @@ Version information is not placed in the top-level Makefile by default
#ifdef WITH_SELINUX
# include <selinux/selinux.h>
#endif
#ifdef __FreeBSD__
extern char **environ;
#endif
#ifdef __i386__
# ifdef __GLIBC__
......@@ -133,7 +141,7 @@ int wrote_wtmp_reboot = 1; /* Set when we wrote the reboot record */
int wrote_utmp_reboot = 1; /* Set when we wrote the reboot record */
int wrote_wtmp_rlevel = 1; /* Set when we wrote the runlevel record */
int wrote_utmp_rlevel = 1; /* Set when we wrote the runlevel record */
int sltime = WAIT_BETWEEN_SIGNALS; /* Sleep time between TERM and KILL */
int sleep_time = WAIT_BETWEEN_SIGNALS; /* Sleep time between TERM and KILL */
char *argv0; /* First arguments; show up in ps listing */
int maxproclen; /* Maximal length of argv[0] with \0 */
struct utmp utproto; /* Only used for sizeof(utproto.ut_id) */
......@@ -144,7 +152,7 @@ int main(int, char **);
/* Used by re-exec part */
int reload = 0; /* Should we do initialization stuff? */
char *myname="/sbin/init"; /* What should we exec */
char *myname=INIT; /* What should we exec */
int oops_error; /* Used by some of the re-exec code. */
const char *Signature = "12567362"; /* Signature for re-exec fd */
......@@ -288,7 +296,7 @@ void send_state(int fd)
fprintf(fp, "-SI%u\n", got_signals);
fprintf(fp, "-WR%d\n", wrote_wtmp_reboot);
fprintf(fp, "-WU%d\n", wrote_utmp_reboot);
fprintf(fp, "-ST%d\n", sltime);
fprintf(fp, "-ST%d\n", sleep_time);
fprintf(fp, "-DB%d\n", did_boot);
for (p = family; p; p = p->next) {
......@@ -416,7 +424,7 @@ static CHILD *get_record(FILE *f)
}
break;
case D_SLTIME:
if (fscanf(f, "%d\n", &sltime) == EOF && errno != 0) {
if (fscanf(f, "%d\n", &sleep_time) == EOF && errno != 0) {
fprintf(stderr, "%s (%d): %s\n", __FILE__, __LINE__, strerror(errno));
}
break;
......@@ -521,8 +529,12 @@ int receive_state(int fd)
* Set the process title.
*/
#ifdef __GNUC__
#ifndef __FreeBSD__
__attribute__ ((format (printf, 1, 2)))
#endif
#endif
/* This function already exists on FreeBSD. No need to delcare it. */
#ifndef __FreeBSD__
static int setproctitle(char *fmt, ...)
{
va_list ap;
......@@ -542,6 +554,7 @@ static int setproctitle(char *fmt, ...)
return len;
}
#endif
/*
* Set console_dev to a working console.
......@@ -1705,7 +1718,7 @@ void read_inittab(void)
/*
* Yup, but check every second if we still have children.
*/
for(f = 0; f < sltime; f++) {
for(f = 0; f < sleep_time; f++) {
for(ch = family; ch; ch = ch->next) {
if (!(ch->flags & KILLME)) continue;
if ((ch->flags & RUNNING) && !(ch->flags & ZOMBIE))
......@@ -1959,7 +1972,7 @@ int read_level(int arg)
foo = arg;
ok = 1;
}
if (ok == 2) sltime = st;
if (ok == 2) sleep_time = st;
#endif /* INITLVL */
......@@ -2160,9 +2173,11 @@ int make_pipe(int fd)
/*
* Attempt to re-exec.
* Renaming to my_re_exec since re_exec is now a common function name
* which conflicts.
*/
static
void re_exec(void)
void my_re_exec(void)
{
CHILD *ch;
sigset_t mask, oldset;
......@@ -2279,7 +2294,7 @@ void fifo_new_level(int level)
runlevel = read_level(level);
if (runlevel == 'U') {
runlevel = oldlevel;
re_exec();
my_re_exec();
} else {
if (oldlevel != 'S' && runlevel == 'S') console_stty();
if (runlevel == '6' || runlevel == '0' ||
......@@ -2460,22 +2475,22 @@ void check_init_fifo(void)
}
switch(request.cmd) {
case INIT_CMD_RUNLVL:
sltime = request.sleeptime;
sleep_time = request.sleeptime;
fifo_new_level(request.runlevel);
quit = 1;
break;
case INIT_CMD_POWERFAIL:
sltime = request.sleeptime;
sleep_time = request.sleeptime;
do_power_fail('F');
quit = 1;
break;
case INIT_CMD_POWERFAILNOW:
sltime = request.sleeptime;
sleep_time = request.sleeptime;
do_power_fail('L');
quit = 1;
break;
case INIT_CMD_POWEROK:
sltime = request.sleeptime;
sleep_time = request.sleeptime;
do_power_fail('O');
quit = 1;
break;
......@@ -2681,7 +2696,7 @@ void process_signals()
#endif
if (runlevel == 'U') {
runlevel = oldlevel;
re_exec();
my_re_exec();
} else {
if (oldlevel != 'S' && runlevel == 'S') console_stty();
if (runlevel == '6' || runlevel == '0' ||
......@@ -2902,7 +2917,7 @@ int telinit(char *progname, int argc, char **argv)
while ((f = getopt(argc, argv, "t:e:")) != EOF) switch(f) {
case 't':
sltime = atoi(optarg);
sleep_time = atoi(optarg);
break;
case 'e':
if (env == NULL)
......@@ -2935,7 +2950,7 @@ int telinit(char *progname, int argc, char **argv)
usage(progname);
request.cmd = INIT_CMD_RUNLVL;
request.runlevel = argv[optind][0];
request.sleeptime = sltime;
request.sleeptime = sleep_time;
}
/* Change to the root directory. */
......@@ -2977,7 +2992,7 @@ int telinit(char *progname, int argc, char **argv)
progname, INITLVL);
exit(1);
}
fprintf(fp, "%s %d", argv[optind], sltime);
fprintf(fp, "%s %d", argv[optind], sleep_time);
fclose(fp);
/* And tell init about the pending runlevel change. */
......
......@@ -154,3 +154,12 @@ extern char prevlevel;
#define D_WROTE_WTMP_RLEVEL -16
#define D_WROTE_UTMP_RLEVEL -17
#ifdef __FreeBSD__
#define UTMP_FILE "/var/run/utmp"