[m-dev.] io__call_system()

Fergus Henderson fjh at cs.mu.oz.au
Sat Mar 8 02:06:16 AEDT 1997


Christopher Rodd SPEIRS, you wrote:
> 
> I was trying to use io__call_system() and noticed its slightly unfriendly
> return values.  This is because the low order 8 bits of the return value are
> flags showing why the process ended (core-dumped, interrupted etc), and the
> high order 8(?) bits are the actual return value of the program.  My
> questions are:  
>  - Is the 8 bits as flags a standard.  ie can i just shift the return val
>    right 8 bits to get the actual return value, or will my results depend
>    on the system?

io__call_system/3 is an interface to the standard C library function system().
If you want to know what ANSI/ISO C guarantees for system(),
have a look at the standard (it's on the shelf above my desk).
I think it doesn't guarantee much at all.  POSIX may guarantee more,
though -- I think the behaviour you describe is pretty much standard
Unix behaviour, and I suspect that POSIX probably requires it.  I'm
not sure, thought -- if you want to know, post to comp.unix.programmer.

>  - Do we want to make the behaviour of io__call_system() friendlier?

That's probably a good idea.  The current behaviour doesn't really
match its documentation.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list