diff options
author | 2003-02-04 22:14:27 +0000 | |
---|---|---|
committer | 2003-02-04 22:14:27 +0000 | |
commit | 2c58a6ed58ae116f56ea454eedb1c1dc9677b218 (patch) | |
tree | edb66ad54861bace0403d129698fe36a9cb02150 /lib/libpthread/uthread/pthread_private.h | |
parent | Add test to compare threaded vs non-threaded fd handling. (diff) | |
download | wireguard-openbsd-2c58a6ed58ae116f56ea454eedb1c1dc9677b218.tar.xz wireguard-openbsd-2c58a6ed58ae116f56ea454eedb1c1dc9677b218.zip |
Part 1 of thread fd handling fixes. In the new scheme fd_table_entries
for dup-ed fds are shared to ensure proper flag handling. A refcnt
was added to control when entries should be freed. Specific changes:
close: don't free entry unless refcnt is zero
dup: rewrite to use new function _thread_fd_table_dup
dup2: rewrite to use new function _thread_fd_table_dup
fcntl: use _thread_fd_table_dup
uthread_fd: initialize thread fd table, searching for dup-ed fds. Add
function to share _thread_fd_table entries when an fd is dup-ed.
uthread_init: make it readable. Call fd init functions.
All current regression tests plus the mysql torture test pass. The
new stdfiles regression test fails (I/O redirection problem). Part
2 is intended to fix that problem
Diffstat (limited to 'lib/libpthread/uthread/pthread_private.h')
-rw-r--r-- | lib/libpthread/uthread/pthread_private.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h index 639ab7d916f..9d5b9bf2747 100644 --- a/lib/libpthread/uthread/pthread_private.h +++ b/lib/libpthread/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.43 2003/01/31 04:46:17 marc Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.44 2003/02/04 22:14:27 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -500,17 +500,18 @@ struct fd_table_entry { * state of the lock on the file descriptor. */ spinlock_t lock; - _thread_list_t r_queue; /* Read queue. */ - _thread_list_t w_queue; /* Write queue. */ - struct pthread *r_owner; /* Ptr to thread owning read lock. */ - struct pthread *w_owner; /* Ptr to thread owning write lock. */ - const char *r_fname; /* Ptr to read lock source file name */ - int r_lineno; /* Read lock source line number. */ - const char *w_fname; /* Ptr to write lock source file name */ - int w_lineno; /* Write lock source line number. */ - int r_lockcount; /* Count for FILE read locks. */ - int w_lockcount; /* Count for FILE write locks. */ - int flags; /* Flags used in open. */ + _thread_list_t r_queue; /* Read queue. */ + _thread_list_t w_queue; /* Write queue. */ + struct pthread *r_owner; /* thread owning read lock. */ + struct pthread *w_owner; /* thread owning write lock. */ + const char *r_fname; /* read lock source file name */ + int r_lineno; /* Read lock source line no. */ + const char *w_fname; /* write lock src file name */ + int w_lineno; /* Write lock src line no. */ + int r_lockcount; /* Count for FILE read locks. */ + int w_lockcount; /* Count for FILE write locks.*/ + int flags; /* Flags used in open. */ + int refcnt; /* how many fds use this entry*/ }; struct pthread_poll_data { @@ -1108,7 +1109,9 @@ void _thread_sig_init(void); void _thread_start(void); void _thread_start_sig_handler(void); void _thread_seterrno(pthread_t,int); -int _thread_fd_table_init(int fd); +void _thread_fd_init(void); +int _thread_fd_table_init(int); +int _thread_fd_table_dup(int, int); void _thread_fd_unlock_owned(pthread_t); void _thread_fd_unlock_thread(struct pthread *, int, int, const char *, int); pthread_addr_t _thread_gc(pthread_addr_t); |