[fpc-pascal] FpWaitPid() multiplies status by 256

Marco van de Voort marcov at stack.nl
Sat Oct 6 12:07:04 CEST 2018


In our previous episode, Anton Shepelev said:
> may  return  the status multiplied by 256?  If my child pro-
> cess terminates with Halt(1), the status  is  256,  if  with
> Halt(2),  the  status is 512, etc.

Entirely normal. Status is an opague format in POSIX, and there are macros
to pry them apart.

In Free Pascal those become inline functions, but the result is the same.
Consult man pages or freepascal documentation:

https://www.freepascal.org/docs-html/rtl/baseunix/wexitstatus.html
(note also the see also links which lists some of the other macros)



More information about the fpc-pascal mailing list