here's a different little hack that's more unix-specific, which i borrowed from unix libthread (i think that's where i saw it, although it might be well-known in fcntl land). a parent process needs to know whether a child has successfully done an exec of an arbitrary program (so it's hard to have that program tell the parent). the parent makes a pipe, marks the child's end as close-on-exec, forks, and then reads its end of the pipe. if the exec succeeds, the read returns 0; if the exec fails, the child writes the diagnostic on the pipe, so again the read returns something.