summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Make the pthread scheduler block signals while restoring a newlystsp2011-01-251-1/+12
| | | | | selected thread's state. Fixes random qemu crashes. ok miod@
* Add sched_get_priority_{min,max}. tested in a bulk by landry@.fgsch2010-11-072-1/+47
| | | | input and ok from phessler@ and guenther@
* Change basep parameter of getdirentries() to be off_t *, not long *millert2010-10-282-4/+4
| | | | | | | | 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@
* Fix PR 6417: if we're starting a thread and there's no other threadsguenther2010-07-131-2/+3
| | | | | | | running, then we need to start a gc thread...except when this is the very call to start a gc thread! "This works for me" marc@
* Fix PR 6376: restore more thread library state if execve fails,guenther2010-07-133-46/+55
| | | | | | | including the scheduling timer, sigmask, fd nonblocking status, and handling of the signals used by the thread library. ok marc@, additional testing by ajacoutot@
* 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@
* Instead of (manually) closing the _thread_kern_pipe before callingguenther2010-06-272-6/+20
| | | | | execve(), just set the close-on-exec flag. Fixes PRs 6183 and 6376. ok marc@, "seems clearly better" tedu@
* Add support for pthread_rwlock_timed locks.tedu2010-04-121-9/+45
| | | | from brad. ok kurt, who's too busy to commit
* Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependentmiod2010-02-031-2/+2
| | | | | | | files or directories when applicable. The inspiration and name of MACHINE_CPU come from NetBSD, although the way to provide it to Makefiles is completely different. ok kettenis@
* Make SO_RCVTIMEO and SO_SNDTIMEO work with pthreads. Fixes at least some offgsch2010-01-0313-38/+128
| | | | | 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-0611-83/+124
| | | | | | 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 the handle locking in stdio to use flockfile/funlockfilekurt2009-11-091-131/+122
| | | | | | | | | | | | | internally when and where required. Macros in <stdio.h> are updated to automatically call the underlying functions when the process is threaded to obtain the necessary locking. A private mutex is added to protect __sglue, the internal list of FILE handles, and another to protect the one-time initialization. Some routines in libc that use getc() change to use getc_unlocked() as they're either protected by their own lock or aren't thread-safe routines anyway. committing on behalf of and okay guenther@ now that we have install media space available.
* Remove mutext from list of held mutexes in _mutex_reinit(). Correctskurt2009-10-281-2/+9
| | | | | a failure to lock the _atfork_mutex after forking. Tested by ajacoutot@ and myself. okay guenther@
* define ENOTSUP EOPNOTSUPP is no longer neededderaadt2009-10-271-6/+1
|
* Back out previous commit, as it caused too much growth for the installguenther2009-10-221-122/+131
| | | | media to fit
* Change libpthread's f*lockfile() routines to stop acting as no-opsguenther2009-10-211-131/+122
| | | | | | | | | for FILEs that don't have real file-descriptors: the fake FILEs used internally by snprintf/asprintf/vfprintf and friends now avoid unnecessary locking by calling the internal __vfprintf() routine directly and we do want to do locking on FILEs created with funopen(). ok kurt@
* 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@
* - add a symbol to help gdb location pthread internals (_thread_ctx_offset)kurt2009-07-251-1/+2
| | | | ok kettenis@
* Increase default thread stack size to 256K on 32bit archs and 512K onkurt2009-04-211-2/+7
| | | | | 64bit archs to accommodate the growing number of ports that put large buffers on the stack. Supported by many with no objections.
* honor MSG_DONTWAITjakemsr2009-04-112-2/+4
| | | | ok marc@, guenther@
* Add pthread_attr_[sg]etguardsize() to match rthread, including manpagesguenther2008-12-187-22/+148
| | | | | | Bump lib minor ok otto@ kurt@ marc@; doc review by jmc@
* 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@)
* the license on this is PD; david leonard says soderaadt2008-10-021-1/+3
|
* Application-specified thread stacks didn't work with libpthreadguenther2008-07-071-11/+7
| | | | | | | because it treated the supplied memory as holding an internal data structure instead of as the stack space itself ok kurt@, "looks ok" otto@, tested on hppa by kettenis@
* Adjust the _SEM_CHECK_VALIDITY macro to detect NULL sem_t instead ofkurt2008-06-201-2/+4
| | | | | | segfaulting. okay marc@ todd@
* zap last thread_malloc_init reference. otto@ okfgsch2008-06-141-2/+1
|
* Don't grab the fd read lock for getsockopt(2), setsockopt(2),kurt2008-06-034-18/+66
| | | | | | | | getpeername(2) or getsockname(2). Its not needed and causes threads to block when another thread is blocked and holding the read lock. Instead just protect against fd state transitions. Blocking problem reported by David S H Rosenthal from lockss.org okay beck@ "looks sane" deraadt@
* 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
|
* 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@
* - make arc4random*() functions thread safe. Use a custom spinlock functionkurt2008-01-011-1/+3
| | | | | | | | | | | 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
* 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@
* _FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, sokurt2007-06-056-9/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* 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@
* Return ESRCH instead of segfaulting when a thread ID could not be found.kettenis2007-01-281-2/+2
| | | | ok marc@, krw@