summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
* So passes uthreadsguenther2012-09-01138-18732/+0
| | | | | Like autumn leaves on water don't fear the tedu@
* remove unused variablechl2012-01-181-2/+1
| | | | ok guenther@
* Make openat(), pread(), preadv(), pwrite(), and pwritev() cancellationguenther2012-01-178-6/+345
| | | | | | points. ok fgsch@
* threads waiting on PS_FDW_WAIT state should not be interruptible iffgsch2011-10-077-9/+19
| | | | | | | | | SA_RESTART is set, with connect(2) being the exception thus getting its own state. as pointed by kurt, threads on this and PS_FDR_WAIT states need to be set to PS_RUNNING since the current signal dispatching code only looks at the current thread. ok kurt@
* make sure that `references' is not optimized away as it is required for thefgsch2011-09-281-2/+2
| | | | | static version of pthread. fixes quite a few regression tests. miod@ ok
* For threads in PS_FDR_WAIT state, check SA_RESTART before marking it asfgsch2011-09-137-9/+24
| | | | | | | | interrupted, thus simulating the system call restart behaviour in the non-pthreads case. Add a state for kevent since it shouldn't be restarted regardless of SA_RESTART being present. guenther@ ok.
* The scheduling loop can change errno, so we need to restore it evenguenther2011-09-051-4/+4
| | | | | | when not switching threads; issue observed by fgsch@ ok marc@
* Handle F_DUPFD_CLOEXEC the same as we do F_DUPFD.matthew2011-07-191-1/+2
| | | | ok guenther@
* When context switching, if the 'new' thread is the same as the 'old'guenther2011-07-071-1/+10
| | | | | | | thread, then the save and restore of errno, FPU, and regs is unnecessary and can be skipped. "looks reasonable" marc@
* check that thread specific keys are valid, and cleanup code a little.tedu2011-07-051-21/+14
| | | | ok guenther
* In pthread_key_delete(), only scan other threads if the key was allocatedguenther2011-07-031-12/+12
| | | | | | and handle the case of specific_data being NULL. Pointed out by fgsch@, ok tedu@
* pthread_key_delete should delete the data, so it's not reused bytedu2011-07-021-1/+13
| | | | | a later pthread_key_create. bug report from Henry Precheur. ok guenther mikeb
* More NULL -> 0 fallout.miod2011-04-091-3/+3
|
* 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
|