[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PROPOSAL: init file actions (draft 3)



H Peter Anvin <hpa@transmeta.com> writes:

> Well, exit code 0 for success is standard pretty much anywhere, even if
> it overlaps.  What do they have for 0-1 or 0-3?

0 is exactly success for "status".  It means the program is running.
However, the status command pretty much succeeds no matter what as
long as it manages to return an answer.

Existing practice:

     status                                    everything else
     ----------------------------------------  ---------------
0:   program running                           success
1:   program dead, /var/run pid file exists    unspecified error
2:   program dead, /var/lock lock file exists  not used
3:   program stopped                           not used

Unless we decide to break down the exit code into eight 1-bit wide
flags (and limit how much we can expand things), having the overlap on
exit code 0 is probably okay.  Overlap on exit code 1 is unavoidable
if we want to preserve existing practice.

Where this is a bit of a problem is returning errors for the "status"
action (the init file wants to say "I couldn't figure out the
status").  For example, the command line usage error should not
overlap with any exit code for the "status" action.

We could do something like this:

     status                                    everything else
     ----------------------------------------  ---------------
0:   program running                           success
1:   program dead, /var/run pid file exists    unspecified error (deprecated)
2:   program dead, /var/lock lock file exists  not used
3:   program stopped                           not used
4:                                             unspecified error (new code)
5:                                             command line usage error
6:                                             unimplemented feature
7:                                             permission denied
8:                                             program not installed
9:                                             configuration error
...

Of course, exit code 1 is heavily tied to unspecified errors.
Deprecating it is not really realistic and the above is a little
confusing.

> There is also the option of macroizing the exit codes, although that can
> get really ugly.

Yuck.

> I also believe that the codes in <sysexits.h> should be sacrosanct. 
> There is probably something to be said for standardizing those.

Yes, some headers need to be put into the spec.

- Dan


Reply to: