Subject: Re: exit(-x) cleanup
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Greywolf <>
List: tech-userlevel
Date: 04/06/2001 20:21:16
On Fri, 6 Apr 2001, der Mouse wrote:

# Date: Fri, 6 Apr 2001 22:57:52 -0400 (EDT)
# From: der Mouse <mouse@Rodents.Montreal.QC.CA>
# To:
# Subject: Re: exit(-x) cleanup
# >> Subject: Re: exit(-x) cleanup
# >> [some shell] treats it as unsigned.
# > Is that really true, or is that because the architecture you're on
# > has either signed or unsigned chars and one of those implementations
# > is doing the wrong thing?  :-)
# What is "the wrong thing"?  Exit statuses (stati? :) are only eight
# bits wide; whether they're "supposed" to be 0..255, -128..127, or 0.127
# with the other values machine-dependent, I've never seen specified
# anywhere.

If the original struct wait is any indication, it looks to me to be 0..127,
with the top bit set if it was due to a signal delivery.  At least it's that
way without fiddling the exit value -- this is reflected in the fsck part of
the startup scripts (130 -> stop_boot).

# And which, if any, of these bits of software are wrong (programs
# passing small negative values ot exit, shells treating the exit status
# as signed or unsigned or whatever) depends on that.

I would think, then, that the exit values are NOT machine-dependent; else
we'd have a HELL of a time keeping up with reality.

# 					der Mouse
# 		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

*BSD: better for your uptime than Viagra.