Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: return value from system call, exit status, shift right 8, bitwise and, $?

by rovf (Priest)
on Feb 11, 2010 at 09:34 UTC ( [id://822615]=note: print w/replies, xml ) Need Help??


in reply to return value from system call, exit status, shift right 8, bitwise and, $?

My understanding of the system function is that it returns a 16-bit value, where the high 8 bits are the exit status, and the low 8 are the signal id.
Can we really rely on this? I know that this is true for the Perl implementations I worked with, but I can't find anywhere in the docs that the exist status has to be 8 bit. This is certainly true for Unix-like systems. On Windows, programs can return 32 bit exitcode (although at least ActiveState Perl 5.8 and 5.10 throws away part of the bits). I could imagine that in later/different implementations, all 32 bits could be returned on Windows.

-- 
Ronald Fischer <ynnor@mm.st>
  • Comment on Re: return value from system call, exit status, shift right 8, bitwise and, $?
  • Download Code

Replies are listed 'Best First'.
Re^2: return value from system call, exit status, shift right 8, bitwise and, $?
by Khen1950fx (Canon) on Feb 11, 2010 at 12:13 UTC
      I didn't find anything in this section of perlfaq8 about the number of significant bits in the result of system, but I believe ikegami of course ;-)

      -- 
      Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://822615]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-23 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found