| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
the issues seen with www/varnish.
With input and help from guenther@ and kurt@. guenther@ ok
|
|
|
|
|
|
| |
the use of spinlocks and malloc. All needed memory is allocated upfront
and _thread_kern_sig_defer/undefer() is now used to protect critical
sections. okay guenther@
|
|
|
|
|
|
|
| |
calls to close(), closefrom(), and dup2() don't change it.
ok tedu@, deraadt@, kurt@, millert@, art@, marco@
(miscommit: originally by guenther@)
|
|
|
|
|
| |
casting when safe or adding ARGSUSED where needed. Reviewed and
improvements from millert@ and marc@. okay marc@
|
|
|
|
| |
merge _thread_fd_unlock_thread() into _thread_fd_unlock(). okay marc@
|
|
|
|
| |
applications that increase nofiles using setrlimit(2). ok marc@
|
|
|
|
|
|
|
|
|
|
| |
closed so that a threaded child process can still read it without blocking.
However, leaving stdin/out/err non-blocking when closed is bad because it
can be shared with non-threaded apps that can't deal with a non-blocking
file descriptor (i.e. cat). Therefore special case stdin/out/err pipes so
that they are reset to blocking upon a close(). Tested by robert@, jolan@
and myself with multiple OOo builds on mp systems where the problem was
seen more frequently.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
| |
particular implementation of libpthread for libc. libc no longer
needs pthread.h to compile.
OK millert@, brad@, tedu@
|
|
|
|
| |
Also, for safety lock the _thread_fd_table when removing entries.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
to notice that the file exists. This fixes a problem where an
application may think a file was in non-block mode because the
threads kernel played with the flags. Also fix a stupid error
introduced in the last commit -- the threaded version of dup and
dup2 were foobared. Bad marc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
are both void.
The select call is a cancellation point per IEEE Std 1003.1-2001.
This should fix a problem espie@ found in kde.
|
| |
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
missing) _thread_fd_unlock_owned function can be added with minimal pain.
The incorrect special handling of the stdio fds was also removed.
Tested with the libc_r regression tests and the mysql regression tests.
No complaints from any developers
|
| |
|
|
|
|
| |
Test next time, ok?
|
|
|
|
| |
more sync with freebsd.
|
|
|
|
|
|
|
|
|
|
| |
o Implement _get_curthread() and _set_curthread(). Use it where possible.
o Add missing _thread_[enter|leave]_cancellation_point().
o Add a couple of not yet used vars to pthread_private.h.
o Remove return's from void functions.
This is by no means complete, but instead of doing a big commit, i'll
split it in small ones, minimizing diffs.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
add (broken) mips md stuff
fix some const warnings
add sigaltstack() stub
another hash at getting shlib auto-init to work (mips/elf and i386/a.out)
|
|
|