FpWaitPid() multiplies status by 256

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FpWaitPid() multiplies status by 256

Anton Shepelev
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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FpWaitPid() multiplies status by 256

Marco van de Voort
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)
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FpWaitPid() multiplies status by 256

Anton Shepelev
Marco van de Voort to Anton Shepelev:

> > 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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal