On Monday 08 May 2006 11:05 am, Per Jessen wrote:
Per Jessen wrote:
I was hoping strace would do it for me, but it might be better just doing it myself.
OK, here's some output from my own tracing:
Format: [my id][pid][self()] function fd
[02][ 2761][3066452896] pipe(): fd=14 [02][ 2761][3066452896] pipe(): fd=18
pipe() call to establish communication with the process about to be forked().
[02][ 3024][3066452896] close(): fd=14 [02][ 3024][3066452896] close(): fd=18
forked() process closes both,
[02][ 2761][3066452896] close(): fd=18 ****> [02][ 2761][3066452896] fdopen(): fd=14
We prepare to read output from forked() process.
[01][ 2761][3074980768] fopen(): fd=18 [01][ 2761][3074980768] fclose(): fd=18 [01][ 2761][3074980768] pipe(): fd=14 [01][ 2761][3074980768] pipe(): fd=18
Another thread does a pipe() call and gets 14 and 18. This should not be happening. Why not. At the time you call pipe(), fd14 and fd18 are closed. You appear to be passing an already closed file descriptor to fdopen.
--
Jerry Feldman