Given the description of wait(2), only exit codes 0-255 will be fully
available to the parent.  Higher values may act oddly, although I'd suppose
it's the application (ksh, in this case) rather than the OS that's
responsible for such strange results.

What I see about the exit builtin command in the ksh man page that's
relevant is:

      The value of a simple-command is its exit status;  0-255  if
       it  terminates  normally;  256+signum  if it terminates abnormally
(the
       name of the signal corresponding to the exit status can be obtained
via
       the -l option of the kill built-in utility).

and

       - exit [ n ]
              Causes  the  shell  to exit with the exit status specified by
n.
              The value will be the least significant 8 bits of the
 specified
              status.   If  n  is omitted, then the exit status is that of
the
              last command executed.  An end-of-file will also cause the
shell
              to  exit  except for a shell which has the ignoreeof option
(see
              set below) turned on.

In your case, it seems to me that it is NOT properly masking off the value
given to the exit command, so that only the low 8 bits are acted on and
made available to the parent.


On Wed, Sep 28, 2016 at 12:31 PM, Paulo César Pereira de Andrade <
paulo.cesar.pereira.de.andr...@gmail.com> wrote:

>   Hi,
>
>   I cannot find the reason of this chunk in
> src/cmd/ksh93/bltins/cflow.c when diff'ing
> ksh-20100621 and ksh-20120801
>
>   The problem is that if one calls:
>
> $ exit 267
>
> ksh will pretend it did sigsegv. It will happen for
> other signals as well, for example:
>
> $ ksh
> $ exit 286
> Power failure
>
> $ ksh
> $ exit 273
> << sets SIGCHLD to SIG_DFL and calls pause >>
>
>   Is this an intended feature?
>
> Thanks,
> Paulo
> _______________________________________________
> ast-users mailing list
> ast-users@lists.research.att.com
> http://lists.research.att.com/mailman/listinfo/ast-users
>
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to