Re: svn commit: r231534 - in head: etc/rc.d sbin/init

2012-02-11 Thread Doug Barton
On 02/11/2012 15:21, Ed Schouten wrote:
> Hi Doug,
> 
> * Doug Barton , 20120211 23:58:
>> New scripts in the base should not use BEFORE. Rather, LOGIN should
>> REQUIRE this script.
> 
> You mean like this?

Yes, thanks.

> I noticed there are still over 60 occurrences of
> BEFORE in the tree. Looks like there's still quite a lot of work to do
> to get rid of it then.

Quite. I tackle them when I can, but the goal at this point is to avoid
making the problem any worse. :)


Doug

> %%%
> Index: etc/rc.d/utx
> ===
> --- etc/rc.d/utx  (revision 231534)
> +++ etc/rc.d/utx  (working copy)
> @@ -5,7 +5,6 @@
>  
>  # PROVIDE: utx
>  # REQUIRE: DAEMON cleanvar
> -# BEFORE:  LOGIN
>  # KEYWORD: shutdown
>  
>  . /etc/rc.subr
> Index: etc/rc.d/LOGIN
> ===
> --- etc/rc.d/LOGIN(revision 231514)
> +++ etc/rc.d/LOGIN(working copy)
> @@ -4,7 +4,7 @@
>  #
>  
>  # PROVIDE: LOGIN
> -# REQUIRE: DAEMON
> +# REQUIRE: DAEMON utx
>  
>  #This is a dummy dependency to ensure user services such as xdm,
>  #inetd, cron and kerberos are started after everything else, in case
> %%%
> 



-- 

It's always a long day; 86400 doesn't fit into a short.

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/




signature.asc
Description: OpenPGP digital signature


Re: svn commit: r231534 - in head: etc/rc.d sbin/init

2012-02-11 Thread Ed Schouten
Hi Doug,

* Doug Barton , 20120211 23:58:
> New scripts in the base should not use BEFORE. Rather, LOGIN should
> REQUIRE this script.

You mean like this? I noticed there are still over 60 occurrences of
BEFORE in the tree. Looks like there's still quite a lot of work to do
to get rid of it then.

%%%
Index: etc/rc.d/utx
===
--- etc/rc.d/utx(revision 231534)
+++ etc/rc.d/utx(working copy)
@@ -5,7 +5,6 @@
 
 # PROVIDE: utx
 # REQUIRE: DAEMON cleanvar
-# BEFORE:  LOGIN
 # KEYWORD: shutdown
 
 . /etc/rc.subr
Index: etc/rc.d/LOGIN
===
--- etc/rc.d/LOGIN  (revision 231514)
+++ etc/rc.d/LOGIN  (working copy)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: LOGIN
-# REQUIRE: DAEMON
+# REQUIRE: DAEMON utx
 
 #  This is a dummy dependency to ensure user services such as xdm,
 #  inetd, cron and kerberos are started after everything else, in case
%%%

-- 
 Ed Schouten 
 WWW: http://80386.nl/


pgpAOhERpqM1y.pgp
Description: PGP signature


Re: svn commit: r231534 - in head: etc/rc.d sbin/init

2012-02-11 Thread Doug Barton
On 02/11/2012 12:47, Ed Schouten wrote:
> +# BEFORE:  LOGIN

New scripts in the base should not use BEFORE. Rather, LOGIN should
REQUIRE this script.


Doug

-- 

It's always a long day; 86400 doesn't fit into a short.

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231534 - in head: etc/rc.d sbin/init

2012-02-11 Thread Ed Schouten
Author: ed
Date: Sat Feb 11 20:47:16 2012
New Revision: 231534
URL: http://svn.freebsd.org/changeset/base/231534

Log:
  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.

Added:
  head/etc/rc.d/utx   (contents, props changed)
Modified:
  head/etc/rc.d/Makefile
  head/etc/rc.d/cleanvar
  head/sbin/init/init.8
  head/sbin/init/init.c

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Sat Feb 11 20:44:16 2012(r231533)
+++ head/etc/rc.d/Makefile  Sat Feb 11 20:47:16 2012(r231534)
@@ -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}
 

Modified: head/etc/rc.d/cleanvar
==
--- head/etc/rc.d/cleanvar  Sat Feb 11 20:44:16 2012(r231533)
+++ head/etc/rc.d/cleanvar  Sat Feb 11 20:47:16 2012(r231534)
@@ -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

Added: head/etc/rc.d/utx
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/rc.d/utx   Sat Feb 11 20:47:16 2012(r231534)
@@ -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"

Modified: head/sbin/init/init.8
==
--- head/sbin/init/init.8   Sat Feb 11 20:44:16 2012(r231533)
+++ head/sbin/init/init.8   Sat Feb 11 20:47:16 2012(r231534)
@@ -31,7 +31,7 @@
 .\" @(#)init.8 8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd January 23, 2011
+.Dd February 11, 2012
 .Dt INIT 8
 .Os
 .Sh NAME
@@ -146,14 +146,7 @@ executes a shell for that user.
 When this shell
 dies, either because the user logged out
 or an abnormal termination occurred (a signal),
-.Nm login
-records the logout in the user accounting
-database (see
-.Xr getutxent 3)
-and terminates.
-The cycle is
-then restarted by
-.Nm
+the cycle is restarted by
 executing a new
 .Nm getty
 for the line.

Modified: head/sbin/init/init.c
==
--- head/sbin/init/init.c   Sat Feb 11 20:44:16 2012(r231533)
+++ head/sbin/init/init.c   Sat Feb 11 20:47:16 2012(r231534)
@@ -66,7 +66,6 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -181,8 +180,6 @@ static void setprocresources(const char 
 #endif
 static int clang;
 
-static void clear_session_logs(session_t *);
-
 static int start_session_db(void);
 static void add_session(session_t *);
 static void del_session(session_t *);
@@ -567,20 +564,6 @@ transition(state_t s)
 }
 
 /*
- * Close out the accounting files for a login session.
- * NB: should send a message to the session logger to avoid blocking.
- */
-static void
-clear_session_logs(session_t *sp __unused)
-{
-
-   /*
-* XXX: Use getutxline() and call pututxline() for each entry.
-* Is this safe to do this here?  Is it really required anyway?
-*/
-}
-
-/*
  * Start a session and allocate a controlling terminal.
  * Only called by children of init after forking.
  */
@@ -780,17 +763,12 @@ single_user(void)
 static state_func_t
 runcom(void)
 {
-   struct utmpx utx;
state_func_t next_transition;
 
if ((next_transition = run_script(_PATH_RUNCOM)) != 0)
return next_transition;
 
runcom_mode = AUTOBOOT;