summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Eliminate many lint warnings by either: using the appropriate type,kurt2007-05-1814-51/+70
| | | | | casting when safe or adding ARGSUSED where needed. Reviewed and improvements from millert@ and marc@. okay marc@
* lint warning corrections:kurt2007-05-018-15/+17
| | | | | | | - use the correct types - mark _thread_gc() w/ARGSUSED - fix a 'a cast does not yield an lvalue' okay marc@
* file descriptors are ints. make branch an int too for better structurekurt2007-05-011-3/+3
| | | | allignment. okay marc@
* more lint warning reductions. use int for all priority vars. okay marc@kurt2007-04-271-4/+4
|
* fix minor nit with previous commitkurt2007-04-271-2/+2
|
* fix thread_continuation_t typedef and use passed curthread instead ofkurt2007-04-275-17/+13
| | | | calling _get_curthread() again. fixes some lint warnings. okay marc@
* Remove unused function _thread_fd_unlock_owned() andkurt2007-04-272-47/+5
| | | | merge _thread_fd_unlock_thread() into _thread_fd_unlock(). okay marc@
* Use rlimit nofiles max to size fd/fdp tables instead of cur. Fixeskurt2007-04-2714-51/+63
| | | | applications that increase nofiles using setrlimit(2). ok marc@
* remove unused var. okay marc@kurt2007-04-261-7/+1
|
* Revert previous commit which introduced regressions in KDE.kurt2007-04-101-5/+2
|
* Upon fork() set the child's view of the stored file status flags inheritedkurt2007-04-071-2/+5
| | | | | | | | from the parent to all non-blocking. This prevents the child from restoring the file to be blocking upon close() and causing the parent to deadlock when it later attempts to utilize the blocking fd. Corrects the netbeans build failure caused by the jdk forkAndExec() function that replaces the std fd's before execvp(). okay marc@
* Remove duplicate definition of _POSIX_THREAD_ATTR_STACKSIZE and quietkurt2007-03-201-4/+1
| | | | build warnings noticed by david@. okay millert@ marc@
* Return ESRCH instead of segfaulting when a thread ID could not be found.kettenis2007-01-281-2/+2
| | | | ok marc@, krw@
* Normally pipes created by threaded apps are left non-blocking after beingkurt2006-12-011-5/+6
| | | | | | | | | | 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.
* select() and poll() don't _FD_LOCK their file descriptors, so there's nokurt2006-10-253-35/+12
| | | | | need to bail from _thread_kern_poll() when a file descriptor is in closing state. corrects segfault reported by ckuethe@
* Don't grab _FD_LOCK and queue up behind other threads askurt2006-10-171-22/+13
| | | | | | | this can potentially block indefinitely. Instead just protect against fd state transitions and perform the _thread_sys_shutdown(). Fixes deadlock reported by Tero Koskinen <tero.koskinen at iki.fi>. okay kettenis@
* Last Part of file descriptor race and deadlock corrections.kurt2006-10-0315-49/+167
| | | | | | | | 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@
* upon success dup2() returns newfd so don't overwrite it withkurt2006-10-031-3/+4
| | | | | _thread_fd_table_init()'s return value and blow it away. fixes firefox plugin problem noticed by jolan@
* style(9) extra spacekurt2006-09-261-2/+2
|
* - Use mmap to allocate thread stacks instead of malloc. This preventskurt2006-09-261-23/+17
| | | | | | | | | applications that install their own thread stack red-zones with mprotect PROT_NONE from entering the malloc pool when the pages are freed. - round up requested thread stack size to closest page boundary to simplify the red-zone calculations. okay brad@
* Part 2 of file descriptor race and deadlock corrections.kurt2006-09-2618-136/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* fix a bug where the logic was reversedkurt2006-09-231-2/+2
|
* Part 1 of file descriptor race and deadlock corrections.kurt2006-09-2227-218/+305
| | | | | | | | | | | | | | | | | | | | 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@
* Change a debug interface to take const char pointers so we don't avekrw2006-04-093-6/+6
| | | | | | | | | | to cast away constness whenever we want to pass in a string that is already const -- we copy the string if we want to use it, so having it be non-const in the first place does not make any sense. From tholo@ ok tedu@
* malloc(x * y) -> calloc(x, y) from adobriyan AT gmail.com, with tweaksdjm2006-04-021-6/+2
| | | | suggested by kjell@; ok otto@ pat@ millert@ jaredy@
* Add _thread_atexit_lock and _thread_atexit_unlock to the list ofotto2006-03-061-1/+3
| | | | weak functions; ok millert@.
* cap seconds to 100 million per man page and kernel nanosleep impl.kurt2006-02-161-2/+3
| | | | prevents userland from causing an overflow of tv_sec. okay marc@
* Adapt things to use __type_t instead of _BSD_TYPE_T_millert2006-01-062-11/+11
| | | | | Add new sys/_types.h header Include machine/_types.h or sys/_types.h where applicable
* Userland programs should include <errno.h> not <sys/errno.h>millert2005-12-211-2/+2
| | | | OK deraadt@
* - Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.brad2005-10-312-5/+5
| | | | | | | | - Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST. From stefanf FreeBSD ok fgsch@
* Add pthread_atfork(3)brad2005-10-305-5/+96
| | | | | | | From FreeBSD 'looks ok' fgsch@ miod@ man page reviewed by jmc@
* Don't use TAILQ_NEXT() on an element that has been removed. Similar tokrw2005-10-301-5/+10
| | | | | | | | otto@'s diff for uvm_aobj.c. Identical to a diff canacar@ developed independantly. ok brad@ 'looks correct' fgsch@
* Don't use TAILQ_NEXT() on an element that has been removed. Similar tokrw2005-10-291-3/+4
| | | | | | otto@'s diff for uvm_aobj.c. ok deraadt@ pedro@
* Use queue macros instead of directly accessing fields. ok marc@ miod@otto2005-10-141-5/+5
| | | | patrick@
* Grab the current time before calculating thread wake-up time.marc2005-01-281-19/+9
| | | | | Solves a problem where select/poll calls would return early without indicating any error. Tested by otto@ and kurt@ -- thanks.
* Add debug support.kettenis2005-01-231-1/+6
| | | | ok marc@
* Avoid using void pointers in additive expressionsbrad2004-12-121-2/+4
| | | | | | From FreeBSD ok marc@
* * make sure we leave the thread's cancellation point before we returnpat2004-11-303-4/+10
| | | | | | * plug a memory leak and FD_UNLOCK properly in writev ok marc
* Allow thread in FD{R,W}_WAIT states to be suspended.marc2004-09-181-2/+12
| | | | | Patch from Kurt Miller <truk at optonline.net> Commit reminder from millert@. OK brad@
* major bump to libc and libpthread to break the dependency of amarc2004-06-074-50/+19
| | | | | | particular implementation of libpthread for libc. libc no longer needs pthread.h to compile. OK millert@, brad@, tedu@
* pthead_supsend_all_np and pthread_resume_all_np from freebsd viamarc2004-05-013-117/+192
| | | | | | Kurt Miller <truk at optonline.net>. Kurt says: They're needed for the java hotspot compiler in the 1.3+ jdk OK brad@
* refresh curthread after a thread switch so it points to the realmarc2004-04-131-1/+11
| | | | current thread. ok deraadt@
* ansibrad2004-04-101-5/+2
|
* stylebrad2004-04-101-2/+2
|
* When poll(2)'ing for readability or writability of a file descriptorbrad2004-04-091-3/+7
| | | | | | | | | on behalf of a thread, we should check the POLLERR, POLLHUP, and POLLNVAL flags as well to wake up the thread in these cases. From: FreeBSD's libc_r ok marc@
* Apply patch from guenther at mho.com (pr3730) that fixes a doublemarc2004-04-061-2/+4
| | | | free in the threads library
* add pthread_attr_[get|set]stackbrad2004-02-223-1/+124
| | | | | | From: FreeBSD's libc_r ok marc@
* fixes function parameters to match the man page as wellbrad2004-02-161-2/+5
| | | | | | | | as adding a more aggressive arguement check. From: FreeBSD's libc_r. ok marc@
* Add missing const for function parameters to match POSIX.brad2004-02-162-4/+4
| | | | | | From: FreeBSD's libc_r ok marc@
* Add a simple work-around for deadlocking on recursivebrad2004-02-012-47/+85
| | | | | | | | readlocks on a rwlock while there are writers waiting. From: FreeBSD's libc_r ok marc@