Age | Commit message (Collapse) | Author |
|
Adjust design of file descriptor table to eliminate races
with both opening and closing of file descriptor entries
and eliminates one class of deadlocks. One nice side effect
of this change in design should be better performance for
applications that open and close many file descriptors due
to reduced fd_table_lock contention and fd entry reuse.
- Add entry states to manage use of entry and eliminate
some closing races. fd entries are not deallocated upon
close() now.
- Call _thread_fd_table_init with one of five discreet
modes to properly initialize an entry and manage the
state transition to open.
- When closing an entry hold the entry spinlock locked
across the state transition and the _thread_sys_close
call to close another race.
- Introduce a new lock type FD_RDWR_CLOSE that transitions
either a closed entry or an open entry into closing state
and then waits for a RDWR lock so that the lock queue can
unwind normally. All subsequent fd lock attempts for that
entry are rejected with EBADF until the fd is fully closed,
or reopened by dup2(). Once a thread holds the FD_RDWR_LOCK
it is safe to close() it or dup2() on it.
- When a thread creates a new fd there is a window of time
when another thread could attempt to use the fd before the
creating thread has initialized the entry for it. This can
result in improper status_flags for the entry, so record
the entries init mode, detect when this has happened and
correct the status_flags when needed.
reviewed by marc@ & brad@, tested by several, okay brad@
|
|
originally reported by Gergely Kovacs; help from dhartmei@;
ok tedu@ millert@
|
|
it has already been defined by previous includes. While this
is true at the moment, it will no longer be true after a pending
includes cleanup. OK marc@
|
|
Make sure tolower/toupper use the whole 8 bits.
okay deraadt@
thanks to everyone who tested
|
|
particular implementation of libpthread for libc. libc no longer
needs pthread.h to compile.
OK millert@, brad@, tedu@
|
|
Access to the global _res structure replaced by pointers to a
per thread instance. If unthreaded the pointer is to the
global structure.
Also replaced a 64k stack array with malloc-ed memory so
threaded aps (with a default 64k stack) have a chance at working.
ok deraadt@
|
|
Thanks to miod@ for m68k and vax fixes
|
|
|
|
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.
|
|
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
|
|
|
Test next time, ok?
|
|
|
|
deraadt@ ok
|
|
|
|
|
|
|
|
macros
|
|
|
|
|
|
|
|
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
|
|
Make sure everything uses {SYS,}LIBC_SCCS properly
|
|
|