diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2006-09-22 19:04:34 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2006-09-22 19:04:34 +0000 |
commit | 7b0347847c0d6eea5eea4d695761d24f1b151d53 (patch) | |
tree | 1f3f8ccccc135dfe4bbb20426cc5557f14403d53 /lib/libpthread/uthread/uthread_exit.c | |
parent | d18267fdcf69320a8929dd06de2610e29bbb2b75 (diff) |
Part 1 of file descriptor race and deadlock corrections.
File status flags should be shared for dup'ed file descriptors.
However fd_table_entry's should not be shared for dup'ed file
descriptors so they can be independently be closed without
interfering with dup'ed fd's.
- split out file status flags into its own structure
fs_flags to manage sharing of status flags between
dup'ed file descriptors.
- when duplicating a fd, initialize a new fd_table_entry
for the new fd, but share the status flags via status_flags.
- consolidate the code that sets the underlying system fd
to be non-blocking to a new function _thread_fs_flags_init()
- consolidate the code that sets the underlying system
fd back to blocking into a new function _thread_fs_flags_replace()
This change is needed as a prerequisite to the coming race
and deadlock corrections. okay marc@
Diffstat (limited to 'lib/libpthread/uthread/uthread_exit.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_exit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_exit.c b/lib/libpthread/uthread/uthread_exit.c index 91f41343583..94fc1699c37 100644 --- a/lib/libpthread/uthread/uthread_exit.c +++ b/lib/libpthread/uthread/uthread_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_exit.c,v 1.17 2002/11/07 02:56:20 marc Exp $ */ +/* $OpenBSD: uthread_exit.c,v 1.18 2006/09/22 19:04:33 kurt Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -67,7 +67,7 @@ _exit(int status) for (i = 0; i < _thread_dtablesize; i++) { /* Check if this file descriptor is in use: */ if (_thread_fd_table[i] != NULL && - !(_thread_fd_table[i]->flags & O_NONBLOCK)) { + !(_thread_fd_table[i]->status_flags->flags & O_NONBLOCK)) { /* Get the current flags: */ flags = _thread_sys_fcntl(i, F_GETFL, NULL); /* Clear the nonblocking file descriptor flag: */ |