Jerry Feldman wrote:
The issue here is with open(2) (and related calls that return a new file descriptor). The trace does not show that 2 different open(2) calls return 13.
I had to go quite far back to find the pipe() call that gives me a set of 13 and 14.
I suggest that you add some diagnostic code whenever an open(2) or related call returns a file descriptor.
I was hoping strace would do it for me, but it might be better just doing it myself.
fprintf(stderr, "Thread %ld receives fd %d\n", pthread_self(), fd); As I mentioned, GDB is not the best tool to trace threads. If you want to log the data: Create a log file in the parent thread. Create a mutex void logger(int fd) { pthread_mutex_lock(&lock_mutex); fprintf(logstream, "Thread %ld receives fd %d\n", pthread_self(), fd); fflush(logstream); pthread_mutex_unlock(&lock_miutex); }
I'll try it. Thanks. /Per Jessen, Zürich