summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread/uthread_fork.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* After forking, clear the 'thread joining this one' pointer in the child,guenther2010-07-121-1/+4
| | | | | | as the child only has the one thread remaining. ok marc@
* Make internal file descriptor handling async-signal safe by eliminatingkurt2009-12-061-4/+2
| | | | | | 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@
* After forking, the child is single threaded, so tell libc that. Thisguenther2009-10-211-1/+4
| | | | | | is needed to avoid deadlocks in popen() on FILE locking. ok kurt@
* - do not call pthread_atfork(3) handlers when a multithreaded programkurt2008-04-041-25/+30
| | | | | | 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@
* make pthread vfork() not call fork(), but actually call vfork(). ourderaadt2007-11-201-2/+10
| | | | | | | 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
* Use rlimit nofiles max to size fd/fdp tables instead of cur. Fixeskurt2007-04-271-2/+2
| | | | applications that increase nofiles using setrlimit(2). ok marc@
* 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@
* Part 2 of file descriptor race and deadlock corrections.kurt2006-09-261-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Part 1 of file descriptor race and deadlock corrections.kurt2006-09-221-1/+3
| | | | | | | | | | | | | | | | | | | | 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 pthread_atfork(3)brad2005-10-301-2/+22
| | | | | | | From FreeBSD 'looks ok' fgsch@ miod@ man page reviewed by jmc@
* Remove some double semicolons (hmm, do two semis equal a maxi?).millert2003-08-061-5/+5
| | | | I've skipped the GNU stuff for now. From Patrick Latifi.
* Start syncing with FreeBSD:fgsch2001-08-211-5/+6
| | | | | | | | | | 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.
* include stdlib.hd2000-01-061-1/+2
|
* really remove all other threads when fork()ing. (bug was in removing elements from a list whilest walking it)d1999-11-301-24/+15
|
* sync with FreeBSDd1999-11-251-39/+73
|
* Remove pthread_atfork(). It was only part of draft 10 for a little while and was removed before stddization.d1999-06-151-9/+1
|
* sync with FreeBSDd1999-05-261-2/+35
|
* pthread_atfork()d1999-01-171-1/+7
|
* identd1999-01-061-0/+1
|
* sync with FreeBSD (rwlock, gc thread, man pages)d1998-11-091-4/+4
| | | | | | | 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)
* experimental threaded libc - kernel onlyd1998-08-271-0/+132