[TUHS] SYSTEM V R1 HELP

Random832 random832 at fastmail.com
Fri Dec 22 11:55:09 AEST 2017


On Thu, Dec 21, 2017, at 19:34, William Corcoran wrote:
> echo $?
> 
> 1003
> 
> Now, I thought all return values were 8 bit?    What is that all about?

In the Bourne shell, when a process exits a signal, $? is set to sig|SIGFLG, which is, for some unknown reason, defined to 1000 (Yes, as in 0x3E8. As in 1000|11 == 1000|3 == 1003) - a value that no other version before or since SVR1 (at least not SysIII or SVR4) seems to have - every other one I checked has 0200.

I can only guess that the reason is to make it easier to read the signal number, and whoever it is only tested with SIGINT and SIGQUIT or they would have presumably changed it to sig+SIGFLG. Then at some point before a later SysV release, it was reverted to 0200.

POSIX for its part only guarantees a value above 128, not any particular value or distinct values per signal.


More information about the TUHS mailing list