summaryrefslogtreecommitdiffstats
path: root/lib/libpthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Return the proper values upon failure per POSIX for pthread_sigmask(3) andkurt2008-04-242-5/+12
| | | | | | | sigprocmask(2) in threaded programs. From Philip Guenther <guenther at sendmail.com> via PR library/5795. okay marc@
* - do not call pthread_atfork(3) handlers when a multithreaded programkurt2008-04-042-27/+49
| | | | | | calls vfork(2). "untested, but looks OK" marc@ - document vfork(2), popen(3) and system(3) don't call atfork handlers in multithreaded programs. okay jmc@
* Use fileno() instead of peeking into FILE *; Paul Stoeberderaadt2008-03-231-4/+4
|
* bumpotto2008-03-161-1/+1
|
* Relocate internal pipe file descriptor if newfd collides with it. Fixeskurt2008-02-021-7/+32
| | | | | bsd_auth(2) issue when compiled with threads. Reported by Joachim Wieland <joachim.wieland at credativ.de>. okay otto@ marc@
* Properly align stack such that code that uses SSE2 instructions doesn't crash.kettenis2008-01-281-3/+7
| | | | ok espie@, beck@
* crank libc and libpthread, because libc cannot build lint libraries anymore if a syscall is OBSOL..deraadt2008-01-051-2/+2
|
* - make arc4random*() functions thread safe. Use a custom spinlock functionkurt2008-01-013-3/+18
| | | | | | | | | | | instead of the generic pthread macros since free(3) uses __arc4_getbyte() when freeing small sized allocations and the generic pthread macros call malloc(3). - eliminate passing pointers to a static variable with global scope (rs) for additional code clarity and reduction. - shlib minor bumps for libc and libpthread due to new functions. From andreas@ with some bits from me. okay tedu@ marc@ w/some spot checking from millert@
* make pthread vfork() not call fork(), but actually call vfork(). ourderaadt2007-11-203-6/+17
| | | | | | | 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
* apparently this function cannot return EBUSY, so back out -r1.7;jmc2007-07-261-6/+2
| | | | from pjanzen; ok marc
* Initialize the locks in key_table. On hppa _SPINLOCK_LOCKED is 0, so ankettenis2007-07-203-4/+17
| | | | | | | uninitialized lock ends up in a locked state. This lead to a deadlock if we called pthread_key_create(). ok marc@, kurt@
* Report the correct stack size and top for the primordial thread inkurt2007-07-081-15/+18
| | | | pthread_stackseg_np(). With input and okay marc@
* On hppa, function pointers may be be pointers to PLT entries. Handle thosekettenis2007-07-071-1/+12
| | | | | | | | by replicating part of $$dyncall in the code that sets up a thread's initial stack frame. Also make sure we actually reserve some space for that initial stack frame. ok miod@
* _FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, sokurt2007-06-059-12/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* typoskurt2007-06-051-3/+3
|
* convert to new .Dd format;jmc2007-05-3162-124/+124
|
* clean up lint warnings related to the nfds_t type. okay marc@ millert@kurt2007-05-216-25/+33
|
* 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@
* give _POSIX_THREAD_* defines a value of 1 so applications thatkurt2007-03-151-8/+8
| | | | | conditionally compile code using these defines will work. okay tedu@, marc@, milllert@
* Move landisk to hardware floating point. At the moment the FPU context ismiod2007-03-022-9/+77
| | | | | | | | | | | | | | | always saved upon context switches, as FPU registers are heavily used for long long computations (don't ask). Gcc default to -m4. Credits to drahn@ otto@ and deraadt@ for feedback and help testing. Upgrade procedure if you don't want to use the damn snapshots: - build and install new kernel, reboot off it - build new gcc, do not install it yet - make includes - install new gcc - build and install lib/csu and lib/libc - make build
* pthread bits for sh; help deraadt@, ok kettenis@miod2007-02-194-3/+116
|
* 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.
* Use correct define to detect soft fpu on arm, dont complain on lint so much.drahn2006-11-241-8/+4
|
* typo; from daniel maticjmc2006-11-151-2/+2
|
* 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@
* Preliminary userland bits for OpenBSD/landisk, many things coming frommiod2006-10-102-0/+64
| | | | NetBSD.
* libc/shlib_versionderaadt2006-10-101-2/+2
|
* 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@
* powerpc stack needs a bit more headroom; needed because of mmap()edotto2006-09-291-2/+2
| | | | stacks; report by Antoine Jacoutot; ok kurt@
* 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@
* Bump minimum stack size; current setting causes hangs or illegalotto2006-05-301-2/+2
| | | | | instructions once every few runs. Problem noted by Botond Botyanszki. ok marc@
* Change a debug interface to take const char pointers so we don't avekrw2006-04-095-9/+9
| | | | | | | | | | 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@