summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-02-11 20:47:16 +0000
committered <ed@FreeBSD.org>2012-02-11 20:47:16 +0000
commit959ca16023aae7c8432edca09966fbccd16d5a90 (patch)
treee19f43b12c30c0d24550c43ff6b9a4ea289111b3 /etc
parent51f3dcc0bd6e354eab16e3f6b3fb7228f1581047 (diff)
downloadFreeBSD-src-959ca16023aae7c8432edca09966fbccd16d5a90.zip
FreeBSD-src-959ca16023aae7c8432edca09966fbccd16d5a90.tar.gz
Move utmpx handling out of init(8).
This has the following advantages: - During boot, the BOOT_TIME record is now written right after the file systems become writable, but before users are allowed to log in. This means that they can't cause `hidden logins' by logging in right before init(8) kicks in. - The pututxline(3) function may potentially block on file locking, though this is very rare to occur. By placing it in an rc script, the user can still kill it with ^C if needed. - Most importantly: jails don't use init(8). This means that a force reboot of a system running jails will leave stale entries in the accounting database of the jails individually.
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.d/Makefile5
-rwxr-xr-xetc/rc.d/cleanvar2
-rwxr-xr-xetc/rc.d/utx18
3 files changed, 23 insertions, 2 deletions
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index a665ba9..460de6f 100644
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -144,6 +144,7 @@ FILES= DAEMON \
tmp \
${_ubthidhci} \
ugidfw \
+ ${_utx} \
var \
virecover \
watchdogd \
@@ -177,6 +178,10 @@ _nscd= nscd
_ubthidhci= ubthidhci
.endif
+.if ${MK_UTMPX} != "no"
+_utx= utx
+.endif
+
FILESDIR= /etc/rc.d
FILESMODE= ${BINMODE}
diff --git a/etc/rc.d/cleanvar b/etc/rc.d/cleanvar
index 62c8f42..dade4a2 100755
--- a/etc/rc.d/cleanvar
+++ b/etc/rc.d/cleanvar
@@ -58,8 +58,6 @@ cleanvar_start ()
{
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
purgedir /var/run
- # And an initial utmpx active session file
- (cd /var/run && cp /dev/null utx.active && chmod 644 utx.active)
>/var/run/clean_var
fi
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
diff --git a/etc/rc.d/utx b/etc/rc.d/utx
new file mode 100755
index 0000000..9035d12
--- /dev/null
+++ b/etc/rc.d/utx
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: utx
+# REQUIRE: DAEMON cleanvar
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="utx"
+start_cmd="utx boot"
+stop_cmd="utx shutdown"
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud