*BSD News Article 14161


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!foxhound.dsto.gov.au!fang.dsto.gov.au!myall.awadi.com.au!myall!blymn
From: blymn@awadi.com.au (Brett Lymn)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Shutdown problem.
Date: 7 Apr 93 22:29:43
Organization: /usr/blymn/.organization
Lines: 51
Message-ID: <BLYMN.93Apr7222943@siren.awadi.com.au>
References: <8fkMiGG00WC=A1cXIl@andrew.cmu.edu>
NNTP-Posting-Host: siren.awadi.com.au
In-reply-to: "Peter W. De Bonte"'s message of Tue,  6 Apr 1993 09:54:26 -0400

>>>>> On Tue,  6 Apr 1993 09:54:26 -0400, "Peter W. De Bonte" <pwd+@CMU.EDU> said:
Peter> NNTP-Posting-Host: po2.andrew.cmu.edu

Peter> Excerpts from netnews.comp.os.386bsd.questions: 6-Apr-93 Re: Shutdown
Peter> problem. by Paul@isl.cf.ac.uk 
> Well if you're the only user on the system, which most 386BSD systems
> are, then you might as well just type halt in the first place. All
> shutdown does is be a little more polite to other users on the system

Peter> You mean shutdown doesn't call sync?  ick.


Nonsense, if you RTFS for shutdown and look at the function
die_you_gravy_sucking_pig_dog() (yes that is it's real name :-) you
will see that it does an execle of the halt program like this:

        if (doreboot) {
                execle(_PATH_REBOOT, "reboot", "-l", nosync, 0);
                syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_REBOOT);
                perror("shutdown");
        }
        else if (dohalt) {
                execle(_PATH_HALT, "halt", "-l", nosync, 0);
                syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_HALT);
                perror("shutdown");
        }

Now unless you have used the -n option on shutdown (which prevents the
sync) then the only flag passed to halt is -l which is an undocumented
switch to stop halt writing the syslog as shutdown already has.

If you RTFS for halt then you see the following:

        if (!qflag && (howto & RB_NOSYNC) == 0) {
                logwtmp("~", "shutdown", "");
                sync();
                setalarm(5);
                pause();
        }
        reboot(howto);
        perror("halt");

The variable howto will only have the flag RM_NOSYNC set if the -n
flag was on the command line, this does not apply in this case.
Similarly qflag will only be true if the -q flag was set on the
command line, again it was not so the sync will happen.

After all that, Paul@isl.cf.ac.uk is correct.  The only thing that
shutdown gives you is a more polite method of shutting down, halt is
just as good if you are the only one on the system.