[Pkg-sysvinit-devel] Bug#638019: please consider moving /dev/initctl to /run
Robert Millan
rmh at debian.org
Tue Aug 16 15:18:22 UTC 2011
Package: sysvinit
Version: 2.88dsf-13.11
Severity: wishlist
Tags: patch
User: debian-bsd at lists.debian.org
Usertags: kfreebsd
Please consider moving /dev/initctl to /run/initctl. Using /dev to store named
pipes is not portable and as a result a workaround to use /etc/.initctl on
GNU/kFreeBSD was introduced in 2004 (see #226939).
However, this option is far from ideal. It creates a disparity that might
confuse users. Using /etc for a FIFO is clearly not compliant with FHS. It
does also seem to confuse some programs (see e.g. #637151).
Now that /run is available, I think it'd simplify things if this FIFO node was
moved to that directory.
-- System Information:
Debian Release: 6.0.2
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.1-1-amd64
Locale: LANG=ca_AD.utf8, LC_CTYPE=ca_AD.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
=== modified file 'debian/postinst'
--- debian/postinst 2011-08-16 15:06:26 +0000
+++ debian/postinst 2011-08-16 15:07:14 +0000
@@ -16,18 +16,10 @@ esac
umask 022
-case "$(uname -s)" in
- *FreeBSD)
- INITCTL=/etc/.initctl
- ;;
- *)
- INITCTL=/dev/initctl
- ;;
-esac
-
#
-# Check /dev/initctl
+# Check /run/initctl
#
+INITCTL=/run/initctl
if [ "$INITCTL" ] && [ ! -p "$INITCTL" ]
then
echo "sysvinit: creating $INITCTL"
=== modified file 'debian/src/initscripts/etc/init.d/mountall.sh'
--- debian/src/initscripts/etc/init.d/mountall.sh 2011-08-16 15:06:26 +0000
+++ debian/src/initscripts/etc/init.d/mountall.sh 2011-08-16 15:11:46 +0000
@@ -43,26 +43,6 @@ do_start() {
fi
post_mountall
- case "$(uname -s)" in
- *FreeBSD)
- INITCTL=/etc/.initctl
- ;;
- *)
- INITCTL=/dev/initctl
- ;;
- esac
-
- #
- # We might have mounted something over /dev, see if
- # /dev/initctl is there. Look for /usr/share/sysvinit/update-rc.d
- # to verify that sysvinit (and not upstart) is installed).
- #
- if [ ! -p $INITCTL ] && [ -f /usr/share/sysvinit/update-rc.d ]; then
- rm -f $INITCTL
- mknod -m 600 $INITCTL p
- kill -USR1 1
- fi
-
# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
swaponagain 'swapfile'
=== modified file 'doc/Install'
--- doc/Install 2011-08-16 15:06:26 +0000
+++ doc/Install 2011-08-16 15:08:58 +0000
@@ -48,7 +48,7 @@ You might want to create a file called "
manual page on shutdown to find out more about this.
Running from a read-only file system (CDROM?):
-o All communication to init goes through the FIFO /dev/initctl.
+o All communication to init goes through the FIFO /run/initctl.
There should be no problem using a read-only root file system
IF you use a Linux kernel > 1.3.66. Older kernels don't allow
writing to a FIFO on a read-only file system.
=== modified file 'man/init.8'
--- man/init.8 2011-08-16 15:06:26 +0000
+++ man/init.8 2011-08-16 15:09:32 +0000
@@ -130,7 +130,7 @@ letters \fBF\fP, \fBO\fP or \fBL\fP, ini
the letter \fBF\fP.
.PP
Usage of \fBSIGPWR\fP and \fB/etc/powerstatus\fP is discouraged. Someone
-wanting to interact with \fBinit\fP should use the \fB/dev/initctl\fP
+wanting to interact with \fBinit\fP should use the \fB/run/initctl\fP
control channel - see the source code of the \fBsysvinit\fP package
for more documentation about this.
.PP
@@ -234,7 +234,7 @@ can then manipulate the command line so
the current runlevel.
.PP
.SH INTERFACE
-Init listens on a \fIfifo\fP in /dev, \fI/dev/initctl\fP, for messages.
+Init listens on a \fIfifo\fP in /dev, \fI/run/initctl\fP, for messages.
\fBTelinit\fP uses this to communicate with init. The interface is not
very well documented or finished. Those interested should study the
\fIinitreq.h\fP file in the \fIsrc/\fP subdirectory of the \fBinit\fP
@@ -248,7 +248,7 @@ Has the same effect as \fBtelinit q\fP.
.TP 0.5i
.B SIGUSR1
On receipt of this signals, init closes and re-opens its control fifo,
-\fB/dev/initctl\fP. Useful for bootscripts when /dev is remounted.
+\fB/run/initctl\fP. Useful for bootscripts when /dev is remounted.
.TP 0.5i
.B SIGINT
Normally the kernel sends this signal to init when CTRL-ALT-DEL is
@@ -273,7 +273,7 @@ file in the directory \fI/etc/init.d\fP
/dev/console
/var/run/utmp
/var/log/wtmp
-/dev/initctl
+/run/initctl
.fi
.\"}}}
.\"{{{ Warnings
=== modified file 'src/Makefile'
--- src/Makefile 2011-08-16 15:06:26 +0000
+++ src/Makefile 2011-08-16 15:09:54 +0000
@@ -176,8 +176,8 @@ ifeq ($(ROOT),)
#
# 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
+ @if [ ! -p /run/initctl ]; then \
+ echo "Creating /run/initctl"; \
+ rm -f /run/initctl; \
+ mknod -m 600 /run/initctl p; fi
endif
=== modified file 'src/init.c'
--- src/init.c 2011-08-16 15:06:26 +0000
+++ src/init.c 2011-08-16 15:11:00 +0000
@@ -133,7 +133,7 @@ char *argv0; /* First arguments; show
int maxproclen; /* Maximal length of argv[0] with \0 */
struct utmp utproto; /* Only used for sizeof(utproto.ut_id) */
char *console_dev; /* Console device. */
-int pipe_fd = -1; /* /dev/initctl */
+int pipe_fd = -1; /* /run/initctl */
int did_boot = 0; /* Did we already do BOOT* stuff? */
int main(int, char **);
@@ -2175,13 +2175,13 @@ void check_init_fifo(void)
int quit = 0;
/*
- * First, try to create /dev/initctl if not present.
+ * First, try to create /run/initctl if not present.
*/
if (stat(INIT_FIFO, &st2) < 0 && errno == ENOENT)
(void)mkfifo(INIT_FIFO, 0600);
/*
- * If /dev/initctl is open, stat the file to see if it
+ * If /run/initctl is open, stat the file to see if it
* is still the _same_ inode.
*/
if (pipe_fd >= 0) {
@@ -2195,7 +2195,7 @@ void check_init_fifo(void)
}
/*
- * Now finally try to open /dev/initctl
+ * Now finally try to open /run/initctl
*/
if (pipe_fd < 0) {
if ((pipe_fd = open(INIT_FIFO, O_RDWR|O_NONBLOCK)) >= 0) {
@@ -2501,7 +2501,7 @@ void process_signals()
}
if (ISMEMBER(got_signals, SIGUSR1)) {
/*
- * SIGUSR1 means close and reopen /dev/initctl
+ * SIGUSR1 means close and reopen /run/initctl
*/
INITDBG(L_VB, "got SIGUSR1");
close(pipe_fd);
@@ -2737,7 +2737,7 @@ int telinit(char *progname, int argc, ch
chdir("/");
/* Open the fifo and write a command. */
- /* Make sure we don't hang on opening /dev/initctl */
+ /* Make sure we don't hang on opening /run/initctl */
SETSIG(sa, SIGALRM, signal_handler, 0);
alarm(3);
if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0) {
=== modified file 'src/initreq.h'
--- src/initreq.h 2011-08-16 15:06:26 +0000
+++ src/initreq.h 2011-08-16 15:10:15 +0000
@@ -1,5 +1,5 @@
/*
- * initreq.h Interface to talk to init through /dev/initctl.
+ * initreq.h Interface to talk to init through /run/initctl.
*
* Copyright (C) 1995-2004 Miquel van Smoorenburg
*
@@ -25,11 +25,7 @@
#include <sys/param.h>
-#if defined(__FreeBSD_kernel__)
-# define INIT_FIFO "/etc/.initctl"
-#else
-# define INIT_FIFO "/dev/initctl"
-#endif
+#define INIT_FIFO "/run/initctl"
#define INIT_MAGIC 0x03091969
#define INIT_CMD_START 0
=== modified file 'src/shutdown.c'
--- src/shutdown.c 2011-08-16 15:06:26 +0000
+++ src/shutdown.c 2011-08-16 15:10:34 +0000
@@ -173,7 +173,7 @@ int init_setenv(char *name, char *value)
/*
* Open the fifo and write the command.
- * Make sure we don't hang on opening /dev/initctl
+ * Make sure we don't hang on opening /run/initctl
*/
memset(&sa, 0, sizeof(sa));
sa.sa_handler = alrm_handler;
More information about the Pkg-sysvinit-devel
mailing list