Discussion:
[fpc-pascal] FpWaitPid() multiplies status by 256
Anton Shepelev
2018-10-06 09:59:40 UTC
Permalink
Hello, all

Can anybody suggest why the function

function FpWaitPid
( pid: TPid;
var Status: cint;
Options: cint
): TPid;

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. I am sorry to say that I
observe it with an old version of FPC -- 2.6.4+dfsg-4, be-
cause it is installed on the remote machine with Debian/GNU
Linux 8 that I use over SSH. I have requested the maintain-
er to upgrade FPC and, if or when he complies, I will test
again.
--
Please, do not forward replies to my e-mail.

_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailm
Marco van de Voort
2018-10-06 10:07:04 UTC
Permalink
Post by Anton Shepelev
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)
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freep
Anton Shepelev
2018-10-07 10:26:21 UTC
Permalink
may return the status multiplied by 256? If my child
process 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.
Thank you.
--
Please, do not forward replies to my e-mail.

_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailma
Loading...