On 03/31/2016 07:30 AM, Björn Stabel wrote:
> Am 31.03.2016 um 15:01 schrieb Cristian:
>> I noted that exit codes returned by CMD and other apps (msiexec) are 
>> truncated to 1 byte (0 .. 255).

This matches Linux, but not POSIX.

>> Windows exit codes are represented using 32 bits, so is this limitation 
>> intentional?

Part intentional (we do what Linux does), and part accidental (Cygwin
handles the return status slightly different than Windows, and that
handling makes it impossible to easily preserve all 32-bits, even if
Linux were to be patched to obey POSIX).

> POSIX specifies that the lower 8 bits of the exit status be made
> available to the caller of wait/waitpid:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html

Correct: wait() and waitpid() can only return 8 bits; but POSIX states
that waitid() MUST be able to access all 32-bits untruncated; this is
where Linux gets it wrong (Linux truncates during exit(), so waitid()
can only return 8 bits; other operating systems do NOT truncate during
exit, but preserve all 32 bits; if you use wait() or waitpid() you only
get 8 bits, but if you use waitid() you can see the full 32 bits).

> Maybe there's another way to get the entire status value, but this looks
> like a POSIX limitation to me.
> Cygwin is conformant here.

Cygwin is only partially conformant here.

See also: http://austingroupbugs.net/view.php?id=947

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to