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_open.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_open.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_open.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_open.c b/lib/libpthread/uthread/uthread_open.c index bf55d7d8bb9..aa2d3dd9b56 100644 --- a/lib/libpthread/uthread/uthread_open.c +++ b/lib/libpthread/uthread/uthread_open.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_open.c,v 1.6 2000/01/06 07:20:10 d Exp $ */ +/* $OpenBSD: uthread_open.c,v 1.7 2006/09/22 19:04:33 kurt Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -63,7 +63,7 @@ open(const char *path, int flags,...) if ((fd = _thread_sys_open(path, flags, mode)) < 0) { } /* Initialise the file descriptor table entry: */ - else if (_thread_fd_table_init(fd) != 0) { + else if (_thread_fd_table_init(fd, NULL) != 0) { /* Quietly close the file: */ _thread_sys_close(fd); |