Date: Fri, 20 Sep 1996 14:33:28 -0700 (PDT) From: Jeffrey Hsu <hsu> To: dubois@primate.wisc.edu Cc: hackers Subject: Re: libc_r bug Message-ID: <199609202133.OAA05442@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
> What happens, and what do you expect to happen? The first write gets lost. This is because the uthreads internal fd table is not set up for fds which are inherited from the parent process. I got around it with the following hack. This workaround is bad because it assumes that fd 0, 1, and 2 are valid upon start-up, which is generally but universally true. Alternatively, one could place a call to _thread_fd_table_init() in uthreads_write.c. Neither solution is very stisfactory. *** uthread_init.c 1996/08/20 08:21:23 1.3 --- uthread_init.c 1996/09/20 18:18:53 *************** *** 176,186 **** */ PANIC("Cannot allocate memory for file descriptor table"); } else { /* * Enter a loop to initialise the file descriptor * table: */ ! for (i = 0; i < _thread_dtablesize; i++) { /* Initialise the file descriptor table: */ _thread_fd_table[i] = NULL; } --- 176,189 ---- */ PANIC("Cannot allocate memory for file descriptor table"); } else { + _thread_fd_table_init(0); + _thread_fd_table_init(1); + _thread_fd_table_init(2); /* * Enter a loop to initialise the file descriptor * table: */ ! for (i = 2; i < _thread_dtablesize; i++) { /* Initialise the file descriptor table: */ _thread_fd_table[i] = NULL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609202133.OAA05442>