| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
points.
ok fgsch@
|
|
|
|
|
|
|
|
|
| |
SA_RESTART is set, with connect(2) being the exception thus getting its
own state.
as pointed by kurt, threads on this and PS_FDR_WAIT states need to be
set to PS_RUNNING since the current signal dispatching code only looks
at the current thread.
ok kurt@
|
|
|
|
|
|
|
|
| |
interrupted, thus simulating the system call restart behaviour in the
non-pthreads case.
Add a state for kevent since it shouldn't be restarted regardless of
SA_RESTART being present.
guenther@ ok.
|
|
|
|
|
|
|
|
| |
so it works correctly with large offsets (and matches other systems).
This requires adding a new getdirentries syscall, with the old one
renamed to ogetdirentries. All in-tree consumers of getdirentries()
have been updated. Bump libc and libpthread major numbers.
OK and with deraadt@
|
|
|
|
|
|
|
| |
including the scheduling timer, sigmask, fd nonblocking status, and
handling of the signals used by the thread library.
ok marc@, additional testing by ajacoutot@
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
|
| |
64bit archs to accommodate the growing number of ports that put large
buffers on the stack. Supported by many with no objections.
|
|
|
|
|
|
| |
Bump lib minor
ok otto@ kurt@ marc@; doc review by jmc@
|
|
|
|
|
|
|
| |
vfork() has only one semantic: "parent stalls until child does execve
or exit" and no other semantic. it is unfair to act as if pthread
vfork() suddenly lacks that semantic.
ok kurt millert kettenis beck
|
|
|
|
|
|
|
| |
uninitialized lock ends up in a locked state. This lead to a deadlock if we
called pthread_key_create().
ok marc@, kurt@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
isolate its usage to libpthread only and replace with generic non-static
mutex support in the one place it is needed:
- remove _FD_LOCK/UNLOCK from lseek and ftruncate in libc and make the
functions weak so that libpthread can override with its own new
versions that do the locking.
- remove _thread_fd_lock/unlock() weak functions from libc and adjust
libpthread for the change.
- add generic _thread_mutex_lock/unlock/destroy() weak functions in libc
to support non-static mutexes in libc and add libpthread and librthread
implementations for them. libc can utilize non-static mutexes via the
new _MUTEX_LOCK/UNLOCK/DESTROY() macros. Actually these new macros can
support both static and non-static mutexes but currently only using
them for non-static.
- make opendir/closedir/readdir/readdir_r/seekdir/telldir() thread-safe
for both thread libraries by using a non-static mutex in the struct
_dirdesc (typedef DIR), utilizing it in the *dir functions and remove
remaining and incorrect _FD_LOCK/UNLOCK() use in libc.
- add comments to both thread libraries to indicate libc depends on the
current implementation of static mutex initialization. suggested by
marc@
- major bump libc and libpthread due to function removal, structure
change and weak symbol conversions.
okay marc@, tedu@
|
| |
|
|
|
|
| |
allignment. okay marc@
|
| |
|
|
|
|
| |
calling _get_curthread() again. fixes some lint warnings. okay marc@
|
|
|
|
| |
merge _thread_fd_unlock_thread() into _thread_fd_unlock(). okay marc@
|
|
|
|
| |
applications that increase nofiles using setrlimit(2). ok marc@
|
| |
|
|
|
|
| |
build warnings noticed by david@. okay millert@ marc@
|
|
|
|
|
|
|
|
| |
When a fd enters the closing state prevent any threads from
polling the fd and reschedule the thread with the closing_fd
flag set. This fixes a class of deadlocks where a thread is
blocked waiting for data (that may never arrive) and a later
thread calls close() or dup2() on the fd. okay brad@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
| |
Add new sys/_types.h header
Include machine/_types.h or sys/_types.h where applicable
|
|
|
|
|
|
|
| |
From FreeBSD
'looks ok' fgsch@ miod@
man page reviewed by jmc@
|
|
|
|
|
|
| |
particular implementation of libpthread for libc. libc no longer
needs pthread.h to compile.
OK millert@, brad@, tedu@
|
|
|
|
|
|
|
|
| |
readlocks on a rwlock while there are writers waiting.
From: FreeBSD's libc_r
ok marc@
|
|
|
|
|
| |
pthread_stackseg_np added. Minor bump for these changes occurred
a day or so ago and will not be bumped again
|
| |
|
| |
|
|
|
|
|
|
|
| |
ITIMER_VIRTUAL for the profiled version. Fixes problems when programs
linked with libpthread try to use ITIMER_VIRTUAL (and have no way of
knowing that this will cause conflicts with the threads lib).
marc@ OK
|
| |
|
|
|
|
|
|
|
|
| |
non-thread-safe dl functions. Only enabled for ELF architectures
at this time as needed dlxxx support has not yet been added to the
a.out run time loader.
'doesn't break xmms at least' tedu@. Tested by others with no comment
|
|
|
|
| |
Also, for safety lock the _thread_fd_table when removing 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
|
|
|
|
|
| |
Clean up (compiler warning elimination). Compile check options added
but commented out as they have not been checked on all architectures, yet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of the thread regressions tests pass on i386, sparc, sparc64
(save the siginfo test on sparc64 due to a kernel issue) and alpha.
The tests should also pass on ppc.
In addition, it fixes the problems with the "mysql torture test"
provided by one of our users. The python port also appears to
work correctly with these changes.
Summary of changes:
* check_pending removed from thread structure, no longer used.
* unused elements of sigstatus structure removed. The sigstatus
structure is now used to keep track of siginfo data instead of
defining a local array in uthread_sig.c.
* _thread_kern_sched_sig removed
* _thread_sig_process goes away -- can't have a lock active when
signal handlers are called. Functions now call _thread_sig_handle
directly.
* _thread_clear_pending now used lib wide to clear pending flags.
It was named _clean_pending_flag and only used in uthread_sig.c.
The function clears both per thread signals, and per process signals.
* _thread_sig_handle now returns a value.
* unused debugging macros removed from the thread kernel
* dispatch pending signals after switching to a thread providing
that signal handling hasn't been deferred by the thread.
* process thread switchhooks before dispatching pending sigs
* check for thread cancellation before dispatching pending sigs
* re-wrote pthread-kill to do the correct thing. It now does
minimal thread-kill-specific processing and then calls the
existing code in uthread_sig to process the generated signal.
* shut the compiler up when compiling uthread_mutex.c
* no more "signal_lock". It does more harm than good.
* keep track of "per-process" signals.
* don't bother saving siginfo_t data for the scheduling signal.
* per posix: SIGSTOP cleared when SIGCONT received and vice versa.
* add _dispatch_signal to properly dispatch a signal to a thread.
It sets the appropriate signal mask, something that was missing
in the previous implementation. This fixes several bugs.
The previous method held a lock. If the signal handler longjmp-ed
the lock was never cleared and no more signals were processed.
|
|
|
|
|
|
|
|
|
|
|
| |
an arch/i386 patch previously commited and arch/sparc64 patches
from jason@ make the preemption_float test pass on those two
architectures.
Do not run signal handlers for a thread until the thread has
been made current, ensuring the proper context. Solves several
(if not all) of the '_pq_insert_tail: Already in priority queue'
problems.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
handling errors in the threads library. Most of the libc_r regression
tests are now ok. thread specific kill semantics are still not correct.
No negative comments after posting to tech@ a week or so ago.
siginfo test fails on sparc64 due to sparc64 oddity.
|
|
|
|
| |
a while ago by marc@ and brad@
|
|
|
|
| |
it EOPNOTSUPP.
|
|
|
|
|
|
|
|
|
| |
o Only poll file descriptors when needed.
o Change the way timing is achieved, counting scheduling ticks
instead of calculating the elapsed time via gettimeofday().
o Prevent an overflow when polling.
o Use curthread instead of _thread_run.
o Remove extra spaces; indent.
|
| |
|
| |
|
|
|
|
| |
make includes is needed in case you want to play.
|