Is this a library issue in libc_r?
I just wrote a quick test program using rfork(RFMEM|RFPROC) to
create a child thread.
I then had both the parent and the child attempt to open the pre-existing
file /tmp/blah with O_EXLOCK set. When I specify O_NONBLOCK, the child
open() fails immediately. When I do not specify O_NONBLOCK, the child
blocks indefinitely:
#if TRY_NONBLOCKING
# define O_XXXX (O_NONBLOCK)
#else
# define O_XXXX (0)
#endif
int main(int argc, char* *argv) {
thread_creation_using_rfork(RFPROC|RFTHREAD) ;
/* parent continues here */
printf("main: %d\n", open("/tmp/blah",
O_RDWR|O_EXLOCK|O_XXXX)) ;
for( ; ; ) ;
}
void childthreadproc(void *) {
/* child begins here */
/* fails for O_NONBLOCK, otherwise blocks indefinitely */
printf("child: %d\n", open("/tmp/blah",
O_RDWR|O_EXLOCK|O_XXXX)) ;
for( ; ; ) ;
}
Note that I've omitted the guts of rfork().
Therefore, it seems to me that the blocking is at the library level, not
the kernel level. Have I missed something?
Eddy
---------------------------------------------------------------------------
Brotsman & Dreger, Inc.
EverQuick Internet / EternalCommerce Division
E-Mail: [EMAIL PROTECTED]
Phone: (316) 794-8922
---------------------------------------------------------------------------
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message