summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread/uthread_fd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Make SO_RCVTIMEO and SO_SNDTIMEO work with pthreads. Fixes at least some offgsch2010-01-031-3/+31
| | | | | the issues seen with www/varnish. With input and help from guenther@ and kurt@. guenther@ ok
* Make internal file descriptor handling async-signal safe by eliminatingkurt2009-12-061-48/+91
| | | | | | 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@
* Fix PR #5942: preserve errno across fd flag updates, so that successfulderaadt2008-10-021-1/+4
| | | | | | | calls to close(), closefrom(), and dup2() don't change it. ok tedu@, deraadt@, kurt@, millert@, art@, marco@ (miscommit: originally by guenther@)
* Eliminate many lint warnings by either: using the appropriate type,kurt2007-05-181-2/+2
| | | | | casting when safe or adding ARGSUSED where needed. Reviewed and improvements from millert@ and marc@. okay marc@
* Remove unused function _thread_fd_unlock_owned() andkurt2007-04-271-44/+4
| | | | 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-271-9/+9
| | | | applications that increase nofiles using setrlimit(2). ok marc@
* 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.
* style(9) extra spacekurt2006-09-261-2/+2
|
* Part 2 of file descriptor race and deadlock corrections.kurt2006-09-261-69/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-221-84/+187
| | | | | | | | | | | | | | | | | | | | 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@
* major bump to libc and libpthread to break the dependency of amarc2004-06-071-33/+10
| | | | | | particular implementation of libpthread for libc. libc no longer needs pthread.h to compile. OK millert@, brad@, tedu@
* fix bug that would leave an FD locked if dup'd, then closed.marc2003-02-141-5/+23
| | | | Also, for safety lock the _thread_fd_table when removing entries.
* AARRGGH! 2nd try, handle the case where from_fd == to_fd in _thread_fd_table_dupmarc2003-02-051-2/+2
|
* handle the case where from_fd == to_fd in _thread_fd_table_dupmarc2003-02-051-15/+18
|
* thread fd handling, part 2. Don't mung file flags until forcedmarc2003-02-051-11/+15
| | | | | | | | 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.
* Part 1 of thread fd handling fixes. In the new scheme fd_table_entriesmarc2003-02-041-21/+127
| | | | | | | | | | | | | | | | | 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
* return (func(...)) not needed when the current function and funcmarc2003-01-191-3/+2
| | | | | | 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.
* get rid of compiler warningsmarc2002-11-121-2/+1
|
* thread safe libc -- 2nd try. OK miod@, millert@marc2002-11-051-30/+11
| | | | Thanks to miod@ for m68k and vax fixes
* back out previous patch.. there are still some vax/m68k issuesmarc2002-11-031-11/+30
|
* libc changes for thread safety. Tested on:marc2002-11-031-30/+11
| | | | | | | 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.
* removes duplicate functions and factor out common code so the needed (butmarc2002-10-301-463/+222
| | | | | | | | 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
* put changes back, this time ALL the files.fgsch2001-09-041-3/+3
|
* Back out fgsch@'s tree breaking commits.todd2001-08-301-3/+3
| | | | Test next time, ok?
* fix some const warnings.fgsch2001-08-301-3/+3
| | | | more sync with freebsd.
* Start syncing with FreeBSD:fgsch2001-08-211-25/+29
| | | | | | | | | | 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.
* sync with FreeBSDd1999-11-251-23/+63
|
* sync with FreeBSDd1999-05-261-3/+3
|
* initialise locks properlyd1999-01-101-2/+2
|
* preserve FreeBSD identsd1998-12-231-2/+2
|
* sync with FreeBSD (rwlock, gc thread, man pages)d1998-11-091-3/+6
| | | | | | | 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/+719