diff options
Diffstat (limited to 'lib')
150 files changed, 324 insertions, 88 deletions
diff --git a/lib/libc_r/uthread/uthread_accept.c b/lib/libc_r/uthread/uthread_accept.c index 371da568bf0..5a6bd90fe9f 100644 --- a/lib/libc_r/uthread/uthread_accept.c +++ b/lib/libc_r/uthread/uthread_accept.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_accept.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_attr_getdetachstate.c b/lib/libc_r/uthread/uthread_attr_getdetachstate.c index 4715cb6f242..52ebdfb89c1 100644 --- a/lib/libc_r/uthread/uthread_attr_getdetachstate.c +++ b/lib/libc_r/uthread/uthread_attr_getdetachstate.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getdetachstate.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_getstackaddr.c b/lib/libc_r/uthread/uthread_attr_getstackaddr.c index 1850a324c61..0e0cb724b33 100644 --- a/lib/libc_r/uthread/uthread_attr_getstackaddr.c +++ b/lib/libc_r/uthread/uthread_attr_getstackaddr.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getstackaddr.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_getstacksize.c b/lib/libc_r/uthread/uthread_attr_getstacksize.c index de81106083d..c62ca413e62 100644 --- a/lib/libc_r/uthread/uthread_attr_getstacksize.c +++ b/lib/libc_r/uthread/uthread_attr_getstacksize.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getstacksize.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_init.c b/lib/libc_r/uthread/uthread_attr_init.c index c64e29fed11..04cca9e6cb8 100644 --- a/lib/libc_r/uthread/uthread_attr_init.c +++ b/lib/libc_r/uthread/uthread_attr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_init.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c b/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c index afe6b23c3cb..56c762c32f4 100644 --- a/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c +++ b/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setcreatesuspend_np.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_setdetachstate.c b/lib/libc_r/uthread/uthread_attr_setdetachstate.c index 6ec0dbc1c58..5f86679e299 100644 --- a/lib/libc_r/uthread/uthread_attr_setdetachstate.c +++ b/lib/libc_r/uthread/uthread_attr_setdetachstate.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setdetachstate.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_setprio.c b/lib/libc_r/uthread/uthread_attr_setprio.c index f6d54fcac16..4a548b3a201 100644 --- a/lib/libc_r/uthread/uthread_attr_setprio.c +++ b/lib/libc_r/uthread/uthread_attr_setprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setprio.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_setstackaddr.c b/lib/libc_r/uthread/uthread_attr_setstackaddr.c index ce54915d096..ccef1189723 100644 --- a/lib/libc_r/uthread/uthread_attr_setstackaddr.c +++ b/lib/libc_r/uthread/uthread_attr_setstackaddr.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setstackaddr.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_attr_setstacksize.c b/lib/libc_r/uthread/uthread_attr_setstacksize.c index 94e575e0dde..ee73ae39a9a 100644 --- a/lib/libc_r/uthread/uthread_attr_setstacksize.c +++ b/lib/libc_r/uthread/uthread_attr_setstacksize.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setstacksize.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_bind.c b/lib/libc_r/uthread/uthread_bind.c index 11edfbbe3d8..b638704dff3 100644 --- a/lib/libc_r/uthread/uthread_bind.c +++ b/lib/libc_r/uthread/uthread_bind.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_bind.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_clean.c b/lib/libc_r/uthread/uthread_clean.c index 9319f85efbe..c13519b0def 100644 --- a/lib/libc_r/uthread/uthread_clean.c +++ b/lib/libc_r/uthread/uthread_clean.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_clean.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_close.c b/lib/libc_r/uthread/uthread_close.c index 4bc4999ebda..7d95fbb3196 100644 --- a/lib/libc_r/uthread/uthread_close.c +++ b/lib/libc_r/uthread/uthread_close.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_close.c,v 1.3 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_cond.c b/lib/libc_r/uthread/uthread_cond.c index dd073a32948..b2ef3df1ac5 100644 --- a/lib/libc_r/uthread/uthread_cond.c +++ b/lib/libc_r/uthread/uthread_cond.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_cond.c,v 1.4 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <errno.h> @@ -86,7 +87,7 @@ pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * cond_attr) _thread_queue_init(&pcond->c_queue); pcond->c_flags |= COND_FLAGS_INITED; pcond->c_type = type; - memset(&pcond->lock,0,sizeof(pcond->lock)); + _SPINUNLOCK(&pcond->lock); *cond = pcond; } } @@ -151,6 +152,7 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex) * variable: */ _thread_queue_enq(&(*cond)->c_queue, _thread_run); + _thread_run->data.cond = cond; /* Unlock the mutex: */ if ((rval = pthread_mutex_unlock(mutex)) != 0) { @@ -223,6 +225,7 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, * variable: */ _thread_queue_enq(&(*cond)->c_queue, _thread_run); + _thread_run->data.cond = cond; /* Unlock the mutex: */ if ((rval = pthread_mutex_unlock(mutex)) != 0) { diff --git a/lib/libc_r/uthread/uthread_condattr_destroy.c b/lib/libc_r/uthread/uthread_condattr_destroy.c index 4179970ad9d..7e6aa2dc124 100644 --- a/lib/libc_r/uthread/uthread_condattr_destroy.c +++ b/lib/libc_r/uthread/uthread_condattr_destroy.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_condattr_destroy.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_condattr_init.c b/lib/libc_r/uthread/uthread_condattr_init.c index c87323dc197..0231bc78f7b 100644 --- a/lib/libc_r/uthread/uthread_condattr_init.c +++ b/lib/libc_r/uthread/uthread_condattr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_condattr_init.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libc_r/uthread/uthread_create.c b/lib/libc_r/uthread/uthread_create.c index 4ce34434f3e..178c35424b8 100644 --- a/lib/libc_r/uthread/uthread_create.c +++ b/lib/libc_r/uthread/uthread_create.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_create.c,v 1.5 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #include <stdlib.h> @@ -90,6 +91,7 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr, new_thread->arg = arg; timerclear(&new_thread->ru_utime); timerclear(&new_thread->ru_stime); + _SPINUNLOCK(&new_thread->lock); /* * Write a magic value to the thread structure diff --git a/lib/libc_r/uthread/uthread_detach.c b/lib/libc_r/uthread/uthread_detach.c index d471da6f068..d4fa639fef8 100644 --- a/lib/libc_r/uthread/uthread_detach.c +++ b/lib/libc_r/uthread/uthread_detach.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_detach.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_dup.c b/lib/libc_r/uthread/uthread_dup.c index 39d262d170b..c24031b8968 100644 --- a/lib/libc_r/uthread/uthread_dup.c +++ b/lib/libc_r/uthread/uthread_dup.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_dup.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <unistd.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_dup2.c b/lib/libc_r/uthread/uthread_dup2.c index 3e4ed27d359..2f34b8f7d32 100644 --- a/lib/libc_r/uthread/uthread_dup2.c +++ b/lib/libc_r/uthread/uthread_dup2.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_dup2.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_equal.c b/lib/libc_r/uthread/uthread_equal.c index 99ffb5d8b7d..4ec9505d579 100644 --- a/lib/libc_r/uthread/uthread_equal.c +++ b/lib/libc_r/uthread/uthread_equal.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_equal.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libc_r/uthread/uthread_execve.c b/lib/libc_r/uthread/uthread_execve.c index 0d289a44ab9..a223527d635 100644 --- a/lib/libc_r/uthread/uthread_execve.c +++ b/lib/libc_r/uthread/uthread_execve.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_execve.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <fcntl.h> diff --git a/lib/libc_r/uthread/uthread_exit.c b/lib/libc_r/uthread/uthread_exit.c index cedb60d2bca..780e99cb4e1 100644 --- a/lib/libc_r/uthread/uthread_exit.c +++ b/lib/libc_r/uthread/uthread_exit.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_exit.c,v 1.7 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_fchmod.c b/lib/libc_r/uthread/uthread_fchmod.c index 2156eeeb355..454483e410e 100644 --- a/lib/libc_r/uthread/uthread_fchmod.c +++ b/lib/libc_r/uthread/uthread_fchmod.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fchmod.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/types.h> #include <sys/stat.h> diff --git a/lib/libc_r/uthread/uthread_fchown.c b/lib/libc_r/uthread/uthread_fchown.c index ee3ca40d3b7..6b1d4ff1999 100644 --- a/lib/libc_r/uthread/uthread_fchown.c +++ b/lib/libc_r/uthread/uthread_fchown.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fchown.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/types.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_fcntl.c b/lib/libc_r/uthread/uthread_fcntl.c index 6ea013afe5d..e7e11a2e218 100644 --- a/lib/libc_r/uthread/uthread_fcntl.c +++ b/lib/libc_r/uthread/uthread_fcntl.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fcntl.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <stdarg.h> #include <unistd.h> diff --git a/lib/libc_r/uthread/uthread_find_thread.c b/lib/libc_r/uthread/uthread_find_thread.c index e4a59a0d83f..21a37e679c7 100644 --- a/lib/libc_r/uthread/uthread_find_thread.c +++ b/lib/libc_r/uthread/uthread_find_thread.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_find_thread.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_flock.c b/lib/libc_r/uthread/uthread_flock.c index de5b61d91a9..e228762f43c 100644 --- a/lib/libc_r/uthread/uthread_flock.c +++ b/lib/libc_r/uthread/uthread_flock.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_flock.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/file.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_fork.c b/lib/libc_r/uthread/uthread_fork.c index c9b5cee5f90..7f532f38adb 100644 --- a/lib/libc_r/uthread/uthread_fork.c +++ b/lib/libc_r/uthread/uthread_fork.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fork.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <string.h> diff --git a/lib/libc_r/uthread/uthread_fstat.c b/lib/libc_r/uthread/uthread_fstat.c index 20dac73fd72..c1e195f0c69 100644 --- a/lib/libc_r/uthread/uthread_fstat.c +++ b/lib/libc_r/uthread/uthread_fstat.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fstat.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_fsync.c b/lib/libc_r/uthread/uthread_fsync.c index 9141d47119e..4c953443e95 100644 --- a/lib/libc_r/uthread/uthread_fsync.c +++ b/lib/libc_r/uthread/uthread_fsync.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fsync.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <unistd.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_getdirentries.c b/lib/libc_r/uthread/uthread_getdirentries.c index 44e7520dce2..60cd50ec6e2 100644 --- a/lib/libc_r/uthread/uthread_getdirentries.c +++ b/lib/libc_r/uthread/uthread_getdirentries.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getdirentries.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <dirent.h> diff --git a/lib/libc_r/uthread/uthread_getpeername.c b/lib/libc_r/uthread/uthread_getpeername.c index 7b2cd03eb17..73c73e23ab7 100644 --- a/lib/libc_r/uthread/uthread_getpeername.c +++ b/lib/libc_r/uthread/uthread_getpeername.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getpeername.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_getprio.c b/lib/libc_r/uthread/uthread_getprio.c index 708b8f1adf7..b304013efa8 100644 --- a/lib/libc_r/uthread/uthread_getprio.c +++ b/lib/libc_r/uthread/uthread_getprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getprio.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_getsockname.c b/lib/libc_r/uthread/uthread_getsockname.c index 0b40fc585d8..c20e73ae8ce 100644 --- a/lib/libc_r/uthread/uthread_getsockname.c +++ b/lib/libc_r/uthread/uthread_getsockname.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getsockname.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_getsockopt.c b/lib/libc_r/uthread/uthread_getsockopt.c index fe3478b1015..cb1aa034497 100644 --- a/lib/libc_r/uthread/uthread_getsockopt.c +++ b/lib/libc_r/uthread/uthread_getsockopt.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getsockopt.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_info.c b/lib/libc_r/uthread/uthread_info.c index f8d7058306b..cd1f5816355 100644 --- a/lib/libc_r/uthread/uthread_info.c +++ b/lib/libc_r/uthread/uthread_info.c @@ -29,12 +29,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_info.c,v 1.5 1999/01/06 05:29:24 d Exp $ */ #include <stdio.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <stdlib.h> +#include <stddef.h> #ifdef _THREAD_SAFE #include <pthread.h> #include "pthread_private.h" @@ -68,6 +70,8 @@ static const struct s_thread_info thread_info[] = { {PS_STATE_MAX , "xxx"} }; +const static char info_lead[] = " -"; + /* Determine a filename for display purposes: */ static const char * truncname(const char *name, int maxlen) @@ -115,7 +119,7 @@ _thread_dump_info(void) char location[30]; /* Find last known file:line checkpoint: */ - if (pthread->fname) + if (pthread->fname && pthread->state != PS_RUNNING) snprintf(location, sizeof location, "%s:%d", truncname(pthread->fname, 21), pthread->lineno); else @@ -157,30 +161,84 @@ _thread_dump_info(void) case PS_FDR_WAIT: case PS_FDW_WAIT: /* Write the lock details: */ - snprintf(s, sizeof(s), " - fd %d [%s:%d]\n", + snprintf(s, sizeof(s), "%s fd %d [%s:%d]\n", + info_lead, pthread->data.fd.fd, truncname(pthread->data.fd.fname, 32), pthread->data.fd.branch); _thread_sys_write(fd, s, strlen(s)); s[0] = 0; - snprintf(s, sizeof(s), " - owner %pr/%pw\n", + snprintf(s, sizeof(s), "%s owner %pr/%pw\n", + info_lead, _thread_fd_table[pthread->data.fd.fd]->r_owner, _thread_fd_table[pthread->data.fd.fd]->w_owner); _thread_sys_write(fd, s, strlen(s)); break; case PS_SIGWAIT: - snprintf(s, sizeof(s), " - sigmask 0x%08lx\n", + snprintf(s, sizeof(s), "%s sigmask 0x%08lx\n", + info_lead, (unsigned long)pthread->sigmask); _thread_sys_write(fd, s, strlen(s)); break; + case PS_MUTEX_WAIT: + snprintf(s, sizeof(s), + "%s mutex %p\n", + info_lead, + pthread->data.mutex); + _thread_sys_write(fd, s, strlen(s)); + if (pthread->data.mutex) { + snprintf(s, sizeof(s), + "%s owner %p\n", + info_lead, + (*pthread->data.mutex)->m_owner); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_COND_WAIT: + snprintf(s, sizeof(s), + "%s cond %p\n", + info_lead, + pthread->data.cond); + _thread_sys_write(fd, s, strlen(s)); + break; + case PS_JOIN: + if (pthread->queue) { + struct pthread *t; - /* - * Trap other states that are not explicitly - * coded to dump information: - */ - default: - /* Nothing to do here. */ - break; + /* Locate the thread through its queue: */ + t = (struct pthread*)(( + (char *)pthread->queue) - + offsetof(struct pthread, join_queue)); + snprintf(s, sizeof(s), + "%s thread %p\n", info_lead, t); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_SLEEP_WAIT: + { + struct timeval tv; + struct timespec current_time; + struct timespec remaining_time; + double remain; + + gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); + timespecsub(&pthread->wakeup_time, + ¤t_time, &remaining_time); + remain = remaining_time.tv_sec + + (double)remaining_time.tv_nsec / 1e9; + snprintf(s, sizeof(s), + "%s wake in %f sec\n", + info_lead, remain); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_SELECT_WAIT: + /* XXX information in pthread->data.select_data */ + break; + default: + /* Nothing to do here. */ + break; } } diff --git a/lib/libc_r/uthread/uthread_ioctl.c b/lib/libc_r/uthread/uthread_ioctl.c index 79f075a2aff..e26b7174797 100644 --- a/lib/libc_r/uthread/uthread_ioctl.c +++ b/lib/libc_r/uthread/uthread_ioctl.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_ioctl.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <stdarg.h> #include <sys/ioctl.h> diff --git a/lib/libc_r/uthread/uthread_join.c b/lib/libc_r/uthread/uthread_join.c index 2043b76f5d2..9602ec52a25 100644 --- a/lib/libc_r/uthread/uthread_join.c +++ b/lib/libc_r/uthread/uthread_join.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_join.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_kill.c b/lib/libc_r/uthread/uthread_kill.c index 7572c05faff..132dea74464 100644 --- a/lib/libc_r/uthread/uthread_kill.c +++ b/lib/libc_r/uthread/uthread_kill.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_kill.c,v 1.5 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #include <signal.h> diff --git a/lib/libc_r/uthread/uthread_listen.c b/lib/libc_r/uthread/uthread_listen.c index 58d96dcbe44..880cb4c6b12 100644 --- a/lib/libc_r/uthread/uthread_listen.c +++ b/lib/libc_r/uthread/uthread_listen.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_listen.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_mattr_init.c b/lib/libc_r/uthread/uthread_mattr_init.c index 73226a6b471..d24958b111e 100644 --- a/lib/libc_r/uthread/uthread_mattr_init.c +++ b/lib/libc_r/uthread/uthread_mattr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mattr_init.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c index c145a1f8992..76311dfec2e 100644 --- a/lib/libc_r/uthread/uthread_mattr_kind_np.c +++ b/lib/libc_r/uthread/uthread_mattr_kind_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mattr_kind_np.c,v 1.3 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_multi_np.c b/lib/libc_r/uthread/uthread_multi_np.c index 64f360fdacf..4da9793804c 100644 --- a/lib/libc_r/uthread/uthread_multi_np.c +++ b/lib/libc_r/uthread/uthread_multi_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_multi_np.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <string.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_mutex.c b/lib/libc_r/uthread/uthread_mutex.c index 62d43d435e8..74127fde790 100644 --- a/lib/libc_r/uthread/uthread_mutex.c +++ b/lib/libc_r/uthread/uthread_mutex.c @@ -29,6 +29,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mutex.c,v 1.6 1999/01/06 05:29:25 d Exp $ + * */ #include <stdlib.h> #include <errno.h> @@ -98,8 +100,7 @@ pthread_mutex_init(pthread_mutex_t * mutex, pmutex->m_flags |= MUTEX_FLAGS_INITED; pmutex->m_owner = NULL; pmutex->m_type = type; - memset(&pmutex->lock, 0, - sizeof(pmutex->lock)); + _SPINUNLOCK(&pmutex->lock); *mutex = pmutex; } else { free(pmutex); @@ -248,6 +249,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) case PTHREAD_MUTEX_NORMAL: if ((*mutex)->m_owner == _thread_run) { /* Intentionally deadlock: */ + _thread_run->data.mutex = mutex; for (;;) _thread_kern_sched_state(PS_MUTEX_WAIT, __FILE__, __LINE__); } @@ -278,6 +280,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) * the mutex: */ _thread_queue_enq(&(*mutex)->m_queue, _thread_run); + _thread_run->data.mutex = mutex; /* Wait for the mutex: */ _thread_kern_sched_state_unlock( @@ -310,6 +313,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) * the mutex: */ _thread_queue_enq(&(*mutex)->m_queue, _thread_run); + _thread_run->data.mutex = mutex; /* Wait for the mutex: */ _thread_kern_sched_state_unlock( diff --git a/lib/libc_r/uthread/uthread_mutexattr_destroy.c b/lib/libc_r/uthread/uthread_mutexattr_destroy.c index 5642cbef589..fcb3863bcab 100644 --- a/lib/libc_r/uthread/uthread_mutexattr_destroy.c +++ b/lib/libc_r/uthread/uthread_mutexattr_destroy.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mutexattr_destroy.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdlib.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_nanosleep.c b/lib/libc_r/uthread/uthread_nanosleep.c index 4ec7d3f3172..450b505bf12 100644 --- a/lib/libc_r/uthread/uthread_nanosleep.c +++ b/lib/libc_r/uthread/uthread_nanosleep.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_nanosleep.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdio.h> #include <errno.h> @@ -41,31 +42,27 @@ nanosleep(const struct timespec * time_to_sleep, struct timespec * time_remaining) { int ret = 0; + struct timespec start_time; + struct timespec wakeup_time; struct timespec current_time; - struct timespec current_time1; struct timespec remaining_time; struct timeval tv; /* Check if the time to sleep is legal: */ - if (time_to_sleep == NULL || time_to_sleep->tv_nsec < 0 || time_to_sleep->tv_nsec > 1000000000) { + if (time_to_sleep == NULL || time_to_sleep->tv_nsec < 0 || time_to_sleep->tv_nsec > 1000000000 || time_to_sleep->tv_sec < 0) { /* Return an EINVAL error : */ errno = EINVAL; ret = -1; } else { /* Get the current time: */ gettimeofday(&tv, NULL); - TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); + TIMEVAL_TO_TIMESPEC(&tv, &start_time); /* Calculate the time for the current thread to wake up: */ - _thread_run->wakeup_time.tv_sec = current_time.tv_sec + time_to_sleep->tv_sec; - _thread_run->wakeup_time.tv_nsec = current_time.tv_nsec + time_to_sleep->tv_nsec; + timespecadd(time_to_sleep, &start_time, &wakeup_time); - /* Check if the nanosecond field has overflowed: */ - if (_thread_run->wakeup_time.tv_nsec >= 1000000000) { - /* Wrap the nanosecond field: */ - _thread_run->wakeup_time.tv_sec += 1; - _thread_run->wakeup_time.tv_nsec -= 1000000000; - } + _thread_run->wakeup_time.tv_sec = wakeup_time.tv_sec; + _thread_run->wakeup_time.tv_nsec = wakeup_time.tv_nsec; _thread_run->interrupted = 0; /* Reschedule the current thread to sleep: */ @@ -73,31 +70,15 @@ nanosleep(const struct timespec * time_to_sleep, /* Get the current time: */ gettimeofday(&tv, NULL); - TIMEVAL_TO_TIMESPEC(&tv, ¤t_time1); + TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); /* Calculate the remaining time to sleep: */ - remaining_time.tv_sec = time_to_sleep->tv_sec + current_time.tv_sec - current_time1.tv_sec; - remaining_time.tv_nsec = time_to_sleep->tv_nsec + current_time.tv_nsec - current_time1.tv_nsec; - - /* Check if the nanosecond field has underflowed: */ - if (remaining_time.tv_nsec < 0) { - /* Handle the underflow: */ - remaining_time.tv_sec -= 1; - remaining_time.tv_nsec += 1000000000; - } - - /* Check if the nanosecond field has overflowed: */ - if (remaining_time.tv_nsec >= 1000000000) { - /* Handle the overflow: */ - remaining_time.tv_sec += 1; - remaining_time.tv_nsec -= 1000000000; - } + timespecsub(&wakeup_time, ¤t_time, &remaining_time); /* Check if the sleep was longer than the required time: */ if (remaining_time.tv_sec < 0) { /* Reset the time left: */ - remaining_time.tv_sec = 0; - remaining_time.tv_nsec = 0; + timespecclear(&remaining_time); } /* Check if the time remaining is to be returned: */ diff --git a/lib/libc_r/uthread/uthread_once.c b/lib/libc_r/uthread/uthread_once.c index c55ba9eaf74..43ce7c39266 100644 --- a/lib/libc_r/uthread/uthread_once.c +++ b/lib/libc_r/uthread/uthread_once.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_once.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libc_r/uthread/uthread_pipe.c b/lib/libc_r/uthread/uthread_pipe.c index 48ef8ed9886..65610f01302 100644 --- a/lib/libc_r/uthread/uthread_pipe.c +++ b/lib/libc_r/uthread/uthread_pipe.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_pipe.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <unistd.h> #include <fcntl.h> diff --git a/lib/libc_r/uthread/uthread_queue.c b/lib/libc_r/uthread/uthread_queue.c index 5225ab8838e..b30b5b9d425 100644 --- a/lib/libc_r/uthread/uthread_queue.c +++ b/lib/libc_r/uthread/uthread_queue.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_queue.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdio.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_recvfrom.c b/lib/libc_r/uthread/uthread_recvfrom.c index e8a374160b1..905f14239f9 100644 --- a/lib/libc_r/uthread/uthread_recvfrom.c +++ b/lib/libc_r/uthread/uthread_recvfrom.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_recvfrom.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libc_r/uthread/uthread_recvmsg.c b/lib/libc_r/uthread/uthread_recvmsg.c index 44a4a6552cc..0b99b11c78d 100644 --- a/lib/libc_r/uthread/uthread_recvmsg.c +++ b/lib/libc_r/uthread/uthread_recvmsg.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_recvmsg.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libc_r/uthread/uthread_resume_np.c b/lib/libc_r/uthread/uthread_resume_np.c index 7c5f46adfce..6e211f34ece 100644 --- a/lib/libc_r/uthread/uthread_resume_np.c +++ b/lib/libc_r/uthread/uthread_resume_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_resume_np.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_select.c b/lib/libc_r/uthread/uthread_select.c index d6202db0140..7793633fd75 100644 --- a/lib/libc_r/uthread/uthread_select.c +++ b/lib/libc_r/uthread/uthread_select.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_select.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <unistd.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_sendmsg.c b/lib/libc_r/uthread/uthread_sendmsg.c index 9d97c121dcf..db1b49d2016 100644 --- a/lib/libc_r/uthread/uthread_sendmsg.c +++ b/lib/libc_r/uthread/uthread_sendmsg.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sendmsg.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libc_r/uthread/uthread_sendto.c b/lib/libc_r/uthread/uthread_sendto.c index 7dedaaa496c..306ffbfca74 100644 --- a/lib/libc_r/uthread/uthread_sendto.c +++ b/lib/libc_r/uthread/uthread_sendto.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sendto.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libc_r/uthread/uthread_seterrno.c b/lib/libc_r/uthread/uthread_seterrno.c index 570807f1fc7..e63e9ba8d4d 100644 --- a/lib/libc_r/uthread/uthread_seterrno.c +++ b/lib/libc_r/uthread/uthread_seterrno.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_seterrno.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libc_r/uthread/uthread_setprio.c b/lib/libc_r/uthread/uthread_setprio.c index dd89f156a50..87a50d0f5ba 100644 --- a/lib/libc_r/uthread/uthread_setprio.c +++ b/lib/libc_r/uthread/uthread_setprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_setprio.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_setsockopt.c b/lib/libc_r/uthread/uthread_setsockopt.c index a14b338eecd..6681943db7c 100644 --- a/lib/libc_r/uthread/uthread_setsockopt.c +++ b/lib/libc_r/uthread/uthread_setsockopt.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_setsockopt.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_shutdown.c b/lib/libc_r/uthread/uthread_shutdown.c index 855be90368a..4923d34cec4 100644 --- a/lib/libc_r/uthread/uthread_shutdown.c +++ b/lib/libc_r/uthread/uthread_shutdown.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_shutdown.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index 85aca6cbe57..350ce71c6cf 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_sig.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sig.c,v 1.4 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #include <fcntl.h> diff --git a/lib/libc_r/uthread/uthread_sigaction.c b/lib/libc_r/uthread/uthread_sigaction.c index 40f3850008e..156d60a6583 100644 --- a/lib/libc_r/uthread/uthread_sigaction.c +++ b/lib/libc_r/uthread/uthread_sigaction.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigaction.c,v 1.3 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_sigblock.c b/lib/libc_r/uthread/uthread_sigblock.c index fb1e0850128..5b317d01472 100644 --- a/lib/libc_r/uthread/uthread_sigblock.c +++ b/lib/libc_r/uthread/uthread_sigblock.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigblock.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_sigmask.c b/lib/libc_r/uthread/uthread_sigmask.c index 23d6b7ff2a3..bdaf30e09f8 100644 --- a/lib/libc_r/uthread/uthread_sigmask.c +++ b/lib/libc_r/uthread/uthread_sigmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigmask.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <errno.h> #include <signal.h> diff --git a/lib/libc_r/uthread/uthread_signal.c b/lib/libc_r/uthread/uthread_signal.c index c9ece329762..2e1f3d21f60 100644 --- a/lib/libc_r/uthread/uthread_signal.c +++ b/lib/libc_r/uthread/uthread_signal.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_signal.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_sigprocmask.c b/lib/libc_r/uthread/uthread_sigprocmask.c index 81b602f581c..c3f0b1dda16 100644 --- a/lib/libc_r/uthread/uthread_sigprocmask.c +++ b/lib/libc_r/uthread/uthread_sigprocmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigprocmask.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_sigsetmask.c b/lib/libc_r/uthread/uthread_sigsetmask.c index bf48d7b4fa0..1f416551142 100644 --- a/lib/libc_r/uthread/uthread_sigsetmask.c +++ b/lib/libc_r/uthread/uthread_sigsetmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigsetmask.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_sigsuspend.c b/lib/libc_r/uthread/uthread_sigsuspend.c index 0ae9a4f7b3e..e0035c0fa1a 100644 --- a/lib/libc_r/uthread/uthread_sigsuspend.c +++ b/lib/libc_r/uthread/uthread_sigsuspend.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigsuspend.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_sigwait.c b/lib/libc_r/uthread/uthread_sigwait.c index e8d6d4ae0ca..8432e879646 100644 --- a/lib/libc_r/uthread/uthread_sigwait.c +++ b/lib/libc_r/uthread/uthread_sigwait.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigwait.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libc_r/uthread/uthread_single_np.c b/lib/libc_r/uthread/uthread_single_np.c index e36c856c637..39c90837653 100644 --- a/lib/libc_r/uthread/uthread_single_np.c +++ b/lib/libc_r/uthread/uthread_single_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_single_np.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <string.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_socket.c b/lib/libc_r/uthread/uthread_socket.c index 7b5fe00dd2a..ea848d3c144 100644 --- a/lib/libc_r/uthread/uthread_socket.c +++ b/lib/libc_r/uthread/uthread_socket.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_socket.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libc_r/uthread/uthread_spec.c b/lib/libc_r/uthread/uthread_spec.c index c5783331063..8cf4959f1ca 100644 --- a/lib/libc_r/uthread/uthread_spec.c +++ b/lib/libc_r/uthread/uthread_spec.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_spec.c,v 1.4 1999/01/06 05:29:29 d Exp $ */ #include <signal.h> #include <stdlib.h> diff --git a/lib/libc_r/uthread/uthread_suspend_np.c b/lib/libc_r/uthread/uthread_suspend_np.c index 871683ad92a..632dbf5169b 100644 --- a/lib/libc_r/uthread/uthread_suspend_np.c +++ b/lib/libc_r/uthread/uthread_suspend_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_suspend_np.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libc_r/uthread/uthread_wait4.c b/lib/libc_r/uthread/uthread_wait4.c index dda8aeea61c..5017fe5c1ac 100644 --- a/lib/libc_r/uthread/uthread_wait4.c +++ b/lib/libc_r/uthread/uthread_wait4.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_wait4.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <errno.h> #include <sys/wait.h> diff --git a/lib/libc_r/uthread/uthread_yield.c b/lib/libc_r/uthread/uthread_yield.c index 877f5e6b0e8..1844be51fcc 100644 --- a/lib/libc_r/uthread/uthread_yield.c +++ b/lib/libc_r/uthread/uthread_yield.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_yield.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libpthread/uthread/uthread_accept.c b/lib/libpthread/uthread/uthread_accept.c index 371da568bf0..5a6bd90fe9f 100644 --- a/lib/libpthread/uthread/uthread_accept.c +++ b/lib/libpthread/uthread/uthread_accept.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_accept.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_attr_getdetachstate.c b/lib/libpthread/uthread/uthread_attr_getdetachstate.c index 4715cb6f242..52ebdfb89c1 100644 --- a/lib/libpthread/uthread/uthread_attr_getdetachstate.c +++ b/lib/libpthread/uthread/uthread_attr_getdetachstate.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getdetachstate.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_getstackaddr.c b/lib/libpthread/uthread/uthread_attr_getstackaddr.c index 1850a324c61..0e0cb724b33 100644 --- a/lib/libpthread/uthread/uthread_attr_getstackaddr.c +++ b/lib/libpthread/uthread/uthread_attr_getstackaddr.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getstackaddr.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_getstacksize.c b/lib/libpthread/uthread/uthread_attr_getstacksize.c index de81106083d..c62ca413e62 100644 --- a/lib/libpthread/uthread/uthread_attr_getstacksize.c +++ b/lib/libpthread/uthread/uthread_attr_getstacksize.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_getstacksize.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_init.c b/lib/libpthread/uthread/uthread_attr_init.c index c64e29fed11..04cca9e6cb8 100644 --- a/lib/libpthread/uthread/uthread_attr_init.c +++ b/lib/libpthread/uthread/uthread_attr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_init.c,v 1.2 1999/01/06 05:29:21 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libpthread/uthread/uthread_attr_setcreatesuspend_np.c b/lib/libpthread/uthread/uthread_attr_setcreatesuspend_np.c index afe6b23c3cb..56c762c32f4 100644 --- a/lib/libpthread/uthread/uthread_attr_setcreatesuspend_np.c +++ b/lib/libpthread/uthread/uthread_attr_setcreatesuspend_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setcreatesuspend_np.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_setdetachstate.c b/lib/libpthread/uthread/uthread_attr_setdetachstate.c index 6ec0dbc1c58..5f86679e299 100644 --- a/lib/libpthread/uthread/uthread_attr_setdetachstate.c +++ b/lib/libpthread/uthread/uthread_attr_setdetachstate.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setdetachstate.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_setprio.c b/lib/libpthread/uthread/uthread_attr_setprio.c index f6d54fcac16..4a548b3a201 100644 --- a/lib/libpthread/uthread/uthread_attr_setprio.c +++ b/lib/libpthread/uthread/uthread_attr_setprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setprio.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_setstackaddr.c b/lib/libpthread/uthread/uthread_attr_setstackaddr.c index ce54915d096..ccef1189723 100644 --- a/lib/libpthread/uthread/uthread_attr_setstackaddr.c +++ b/lib/libpthread/uthread/uthread_attr_setstackaddr.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setstackaddr.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_attr_setstacksize.c b/lib/libpthread/uthread/uthread_attr_setstacksize.c index 94e575e0dde..ee73ae39a9a 100644 --- a/lib/libpthread/uthread/uthread_attr_setstacksize.c +++ b/lib/libpthread/uthread/uthread_attr_setstacksize.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_attr_setstacksize.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_bind.c b/lib/libpthread/uthread/uthread_bind.c index 11edfbbe3d8..b638704dff3 100644 --- a/lib/libpthread/uthread/uthread_bind.c +++ b/lib/libpthread/uthread/uthread_bind.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_bind.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_clean.c b/lib/libpthread/uthread/uthread_clean.c index 9319f85efbe..c13519b0def 100644 --- a/lib/libpthread/uthread/uthread_clean.c +++ b/lib/libpthread/uthread/uthread_clean.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_clean.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_close.c b/lib/libpthread/uthread/uthread_close.c index 4bc4999ebda..7d95fbb3196 100644 --- a/lib/libpthread/uthread/uthread_close.c +++ b/lib/libpthread/uthread/uthread_close.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_close.c,v 1.3 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_cond.c b/lib/libpthread/uthread/uthread_cond.c index dd073a32948..b2ef3df1ac5 100644 --- a/lib/libpthread/uthread/uthread_cond.c +++ b/lib/libpthread/uthread/uthread_cond.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_cond.c,v 1.4 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <errno.h> @@ -86,7 +87,7 @@ pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * cond_attr) _thread_queue_init(&pcond->c_queue); pcond->c_flags |= COND_FLAGS_INITED; pcond->c_type = type; - memset(&pcond->lock,0,sizeof(pcond->lock)); + _SPINUNLOCK(&pcond->lock); *cond = pcond; } } @@ -151,6 +152,7 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex) * variable: */ _thread_queue_enq(&(*cond)->c_queue, _thread_run); + _thread_run->data.cond = cond; /* Unlock the mutex: */ if ((rval = pthread_mutex_unlock(mutex)) != 0) { @@ -223,6 +225,7 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, * variable: */ _thread_queue_enq(&(*cond)->c_queue, _thread_run); + _thread_run->data.cond = cond; /* Unlock the mutex: */ if ((rval = pthread_mutex_unlock(mutex)) != 0) { diff --git a/lib/libpthread/uthread/uthread_condattr_destroy.c b/lib/libpthread/uthread/uthread_condattr_destroy.c index 4179970ad9d..7e6aa2dc124 100644 --- a/lib/libpthread/uthread/uthread_condattr_destroy.c +++ b/lib/libpthread/uthread/uthread_condattr_destroy.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_condattr_destroy.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <stdlib.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_condattr_init.c b/lib/libpthread/uthread/uthread_condattr_init.c index c87323dc197..0231bc78f7b 100644 --- a/lib/libpthread/uthread/uthread_condattr_init.c +++ b/lib/libpthread/uthread/uthread_condattr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_condattr_init.c,v 1.2 1999/01/06 05:29:22 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libpthread/uthread/uthread_create.c b/lib/libpthread/uthread/uthread_create.c index 4ce34434f3e..178c35424b8 100644 --- a/lib/libpthread/uthread/uthread_create.c +++ b/lib/libpthread/uthread/uthread_create.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_create.c,v 1.5 1999/01/06 05:29:22 d Exp $ */ #include <errno.h> #include <stdlib.h> @@ -90,6 +91,7 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr, new_thread->arg = arg; timerclear(&new_thread->ru_utime); timerclear(&new_thread->ru_stime); + _SPINUNLOCK(&new_thread->lock); /* * Write a magic value to the thread structure diff --git a/lib/libpthread/uthread/uthread_detach.c b/lib/libpthread/uthread/uthread_detach.c index d471da6f068..d4fa639fef8 100644 --- a/lib/libpthread/uthread/uthread_detach.c +++ b/lib/libpthread/uthread/uthread_detach.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_detach.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_dup.c b/lib/libpthread/uthread/uthread_dup.c index 39d262d170b..c24031b8968 100644 --- a/lib/libpthread/uthread/uthread_dup.c +++ b/lib/libpthread/uthread/uthread_dup.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_dup.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <unistd.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_dup2.c b/lib/libpthread/uthread/uthread_dup2.c index 3e4ed27d359..2f34b8f7d32 100644 --- a/lib/libpthread/uthread/uthread_dup2.c +++ b/lib/libpthread/uthread/uthread_dup2.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_dup2.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_equal.c b/lib/libpthread/uthread/uthread_equal.c index 99ffb5d8b7d..4ec9505d579 100644 --- a/lib/libpthread/uthread/uthread_equal.c +++ b/lib/libpthread/uthread/uthread_equal.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_equal.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libpthread/uthread/uthread_execve.c b/lib/libpthread/uthread/uthread_execve.c index 0d289a44ab9..a223527d635 100644 --- a/lib/libpthread/uthread/uthread_execve.c +++ b/lib/libpthread/uthread/uthread_execve.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_execve.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <fcntl.h> diff --git a/lib/libpthread/uthread/uthread_exit.c b/lib/libpthread/uthread/uthread_exit.c index cedb60d2bca..780e99cb4e1 100644 --- a/lib/libpthread/uthread/uthread_exit.c +++ b/lib/libpthread/uthread/uthread_exit.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_exit.c,v 1.7 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_fchmod.c b/lib/libpthread/uthread/uthread_fchmod.c index 2156eeeb355..454483e410e 100644 --- a/lib/libpthread/uthread/uthread_fchmod.c +++ b/lib/libpthread/uthread/uthread_fchmod.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fchmod.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/types.h> #include <sys/stat.h> diff --git a/lib/libpthread/uthread/uthread_fchown.c b/lib/libpthread/uthread/uthread_fchown.c index ee3ca40d3b7..6b1d4ff1999 100644 --- a/lib/libpthread/uthread/uthread_fchown.c +++ b/lib/libpthread/uthread/uthread_fchown.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fchown.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/types.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_fcntl.c b/lib/libpthread/uthread/uthread_fcntl.c index 6ea013afe5d..e7e11a2e218 100644 --- a/lib/libpthread/uthread/uthread_fcntl.c +++ b/lib/libpthread/uthread/uthread_fcntl.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fcntl.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <stdarg.h> #include <unistd.h> diff --git a/lib/libpthread/uthread/uthread_find_thread.c b/lib/libpthread/uthread/uthread_find_thread.c index e4a59a0d83f..21a37e679c7 100644 --- a/lib/libpthread/uthread/uthread_find_thread.c +++ b/lib/libpthread/uthread/uthread_find_thread.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_find_thread.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_flock.c b/lib/libpthread/uthread/uthread_flock.c index de5b61d91a9..e228762f43c 100644 --- a/lib/libpthread/uthread/uthread_flock.c +++ b/lib/libpthread/uthread/uthread_flock.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_flock.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <sys/file.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_fork.c b/lib/libpthread/uthread/uthread_fork.c index c9b5cee5f90..7f532f38adb 100644 --- a/lib/libpthread/uthread/uthread_fork.c +++ b/lib/libpthread/uthread/uthread_fork.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fork.c,v 1.3 1999/01/06 05:29:23 d Exp $ */ #include <errno.h> #include <string.h> diff --git a/lib/libpthread/uthread/uthread_fstat.c b/lib/libpthread/uthread/uthread_fstat.c index 20dac73fd72..c1e195f0c69 100644 --- a/lib/libpthread/uthread/uthread_fstat.c +++ b/lib/libpthread/uthread/uthread_fstat.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fstat.c,v 1.2 1999/01/06 05:29:23 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_fsync.c b/lib/libpthread/uthread/uthread_fsync.c index 9141d47119e..4c953443e95 100644 --- a/lib/libpthread/uthread/uthread_fsync.c +++ b/lib/libpthread/uthread/uthread_fsync.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_fsync.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <unistd.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_getdirentries.c b/lib/libpthread/uthread/uthread_getdirentries.c index 44e7520dce2..60cd50ec6e2 100644 --- a/lib/libpthread/uthread/uthread_getdirentries.c +++ b/lib/libpthread/uthread/uthread_getdirentries.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getdirentries.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <dirent.h> diff --git a/lib/libpthread/uthread/uthread_getpeername.c b/lib/libpthread/uthread/uthread_getpeername.c index 7b2cd03eb17..73c73e23ab7 100644 --- a/lib/libpthread/uthread/uthread_getpeername.c +++ b/lib/libpthread/uthread/uthread_getpeername.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getpeername.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_getprio.c b/lib/libpthread/uthread/uthread_getprio.c index 708b8f1adf7..b304013efa8 100644 --- a/lib/libpthread/uthread/uthread_getprio.c +++ b/lib/libpthread/uthread/uthread_getprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getprio.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_getsockname.c b/lib/libpthread/uthread/uthread_getsockname.c index 0b40fc585d8..c20e73ae8ce 100644 --- a/lib/libpthread/uthread/uthread_getsockname.c +++ b/lib/libpthread/uthread/uthread_getsockname.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getsockname.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_getsockopt.c b/lib/libpthread/uthread/uthread_getsockopt.c index fe3478b1015..cb1aa034497 100644 --- a/lib/libpthread/uthread/uthread_getsockopt.c +++ b/lib/libpthread/uthread/uthread_getsockopt.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_getsockopt.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_info.c b/lib/libpthread/uthread/uthread_info.c index f8d7058306b..cd1f5816355 100644 --- a/lib/libpthread/uthread/uthread_info.c +++ b/lib/libpthread/uthread/uthread_info.c @@ -29,12 +29,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_info.c,v 1.5 1999/01/06 05:29:24 d Exp $ */ #include <stdio.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <stdlib.h> +#include <stddef.h> #ifdef _THREAD_SAFE #include <pthread.h> #include "pthread_private.h" @@ -68,6 +70,8 @@ static const struct s_thread_info thread_info[] = { {PS_STATE_MAX , "xxx"} }; +const static char info_lead[] = " -"; + /* Determine a filename for display purposes: */ static const char * truncname(const char *name, int maxlen) @@ -115,7 +119,7 @@ _thread_dump_info(void) char location[30]; /* Find last known file:line checkpoint: */ - if (pthread->fname) + if (pthread->fname && pthread->state != PS_RUNNING) snprintf(location, sizeof location, "%s:%d", truncname(pthread->fname, 21), pthread->lineno); else @@ -157,30 +161,84 @@ _thread_dump_info(void) case PS_FDR_WAIT: case PS_FDW_WAIT: /* Write the lock details: */ - snprintf(s, sizeof(s), " - fd %d [%s:%d]\n", + snprintf(s, sizeof(s), "%s fd %d [%s:%d]\n", + info_lead, pthread->data.fd.fd, truncname(pthread->data.fd.fname, 32), pthread->data.fd.branch); _thread_sys_write(fd, s, strlen(s)); s[0] = 0; - snprintf(s, sizeof(s), " - owner %pr/%pw\n", + snprintf(s, sizeof(s), "%s owner %pr/%pw\n", + info_lead, _thread_fd_table[pthread->data.fd.fd]->r_owner, _thread_fd_table[pthread->data.fd.fd]->w_owner); _thread_sys_write(fd, s, strlen(s)); break; case PS_SIGWAIT: - snprintf(s, sizeof(s), " - sigmask 0x%08lx\n", + snprintf(s, sizeof(s), "%s sigmask 0x%08lx\n", + info_lead, (unsigned long)pthread->sigmask); _thread_sys_write(fd, s, strlen(s)); break; + case PS_MUTEX_WAIT: + snprintf(s, sizeof(s), + "%s mutex %p\n", + info_lead, + pthread->data.mutex); + _thread_sys_write(fd, s, strlen(s)); + if (pthread->data.mutex) { + snprintf(s, sizeof(s), + "%s owner %p\n", + info_lead, + (*pthread->data.mutex)->m_owner); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_COND_WAIT: + snprintf(s, sizeof(s), + "%s cond %p\n", + info_lead, + pthread->data.cond); + _thread_sys_write(fd, s, strlen(s)); + break; + case PS_JOIN: + if (pthread->queue) { + struct pthread *t; - /* - * Trap other states that are not explicitly - * coded to dump information: - */ - default: - /* Nothing to do here. */ - break; + /* Locate the thread through its queue: */ + t = (struct pthread*)(( + (char *)pthread->queue) - + offsetof(struct pthread, join_queue)); + snprintf(s, sizeof(s), + "%s thread %p\n", info_lead, t); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_SLEEP_WAIT: + { + struct timeval tv; + struct timespec current_time; + struct timespec remaining_time; + double remain; + + gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); + timespecsub(&pthread->wakeup_time, + ¤t_time, &remaining_time); + remain = remaining_time.tv_sec + + (double)remaining_time.tv_nsec / 1e9; + snprintf(s, sizeof(s), + "%s wake in %f sec\n", + info_lead, remain); + _thread_sys_write(fd, s, strlen(s)); + } + break; + case PS_SELECT_WAIT: + /* XXX information in pthread->data.select_data */ + break; + default: + /* Nothing to do here. */ + break; } } diff --git a/lib/libpthread/uthread/uthread_ioctl.c b/lib/libpthread/uthread/uthread_ioctl.c index 79f075a2aff..e26b7174797 100644 --- a/lib/libpthread/uthread/uthread_ioctl.c +++ b/lib/libpthread/uthread/uthread_ioctl.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_ioctl.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <stdarg.h> #include <sys/ioctl.h> diff --git a/lib/libpthread/uthread/uthread_join.c b/lib/libpthread/uthread/uthread_join.c index 2043b76f5d2..9602ec52a25 100644 --- a/lib/libpthread/uthread/uthread_join.c +++ b/lib/libpthread/uthread/uthread_join.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_join.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_kill.c b/lib/libpthread/uthread/uthread_kill.c index 7572c05faff..132dea74464 100644 --- a/lib/libpthread/uthread/uthread_kill.c +++ b/lib/libpthread/uthread/uthread_kill.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_kill.c,v 1.5 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #include <signal.h> diff --git a/lib/libpthread/uthread/uthread_listen.c b/lib/libpthread/uthread/uthread_listen.c index 58d96dcbe44..880cb4c6b12 100644 --- a/lib/libpthread/uthread/uthread_listen.c +++ b/lib/libpthread/uthread/uthread_listen.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_listen.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_mattr_init.c b/lib/libpthread/uthread/uthread_mattr_init.c index 73226a6b471..d24958b111e 100644 --- a/lib/libpthread/uthread/uthread_mattr_init.c +++ b/lib/libpthread/uthread/uthread_mattr_init.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mattr_init.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <string.h> #include <stdlib.h> diff --git a/lib/libpthread/uthread/uthread_mattr_kind_np.c b/lib/libpthread/uthread/uthread_mattr_kind_np.c index c145a1f8992..76311dfec2e 100644 --- a/lib/libpthread/uthread/uthread_mattr_kind_np.c +++ b/lib/libpthread/uthread/uthread_mattr_kind_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mattr_kind_np.c,v 1.3 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_multi_np.c b/lib/libpthread/uthread/uthread_multi_np.c index 64f360fdacf..4da9793804c 100644 --- a/lib/libpthread/uthread/uthread_multi_np.c +++ b/lib/libpthread/uthread/uthread_multi_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_multi_np.c,v 1.2 1999/01/06 05:29:24 d Exp $ */ #include <string.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_mutex.c b/lib/libpthread/uthread/uthread_mutex.c index 62d43d435e8..74127fde790 100644 --- a/lib/libpthread/uthread/uthread_mutex.c +++ b/lib/libpthread/uthread/uthread_mutex.c @@ -29,6 +29,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mutex.c,v 1.6 1999/01/06 05:29:25 d Exp $ + * */ #include <stdlib.h> #include <errno.h> @@ -98,8 +100,7 @@ pthread_mutex_init(pthread_mutex_t * mutex, pmutex->m_flags |= MUTEX_FLAGS_INITED; pmutex->m_owner = NULL; pmutex->m_type = type; - memset(&pmutex->lock, 0, - sizeof(pmutex->lock)); + _SPINUNLOCK(&pmutex->lock); *mutex = pmutex; } else { free(pmutex); @@ -248,6 +249,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) case PTHREAD_MUTEX_NORMAL: if ((*mutex)->m_owner == _thread_run) { /* Intentionally deadlock: */ + _thread_run->data.mutex = mutex; for (;;) _thread_kern_sched_state(PS_MUTEX_WAIT, __FILE__, __LINE__); } @@ -278,6 +280,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) * the mutex: */ _thread_queue_enq(&(*mutex)->m_queue, _thread_run); + _thread_run->data.mutex = mutex; /* Wait for the mutex: */ _thread_kern_sched_state_unlock( @@ -310,6 +313,7 @@ pthread_mutex_lock(pthread_mutex_t * mutex) * the mutex: */ _thread_queue_enq(&(*mutex)->m_queue, _thread_run); + _thread_run->data.mutex = mutex; /* Wait for the mutex: */ _thread_kern_sched_state_unlock( diff --git a/lib/libpthread/uthread/uthread_mutexattr_destroy.c b/lib/libpthread/uthread/uthread_mutexattr_destroy.c index 5642cbef589..fcb3863bcab 100644 --- a/lib/libpthread/uthread/uthread_mutexattr_destroy.c +++ b/lib/libpthread/uthread/uthread_mutexattr_destroy.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_mutexattr_destroy.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdlib.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_nanosleep.c b/lib/libpthread/uthread/uthread_nanosleep.c index 4ec7d3f3172..450b505bf12 100644 --- a/lib/libpthread/uthread/uthread_nanosleep.c +++ b/lib/libpthread/uthread/uthread_nanosleep.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_nanosleep.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdio.h> #include <errno.h> @@ -41,31 +42,27 @@ nanosleep(const struct timespec * time_to_sleep, struct timespec * time_remaining) { int ret = 0; + struct timespec start_time; + struct timespec wakeup_time; struct timespec current_time; - struct timespec current_time1; struct timespec remaining_time; struct timeval tv; /* Check if the time to sleep is legal: */ - if (time_to_sleep == NULL || time_to_sleep->tv_nsec < 0 || time_to_sleep->tv_nsec > 1000000000) { + if (time_to_sleep == NULL || time_to_sleep->tv_nsec < 0 || time_to_sleep->tv_nsec > 1000000000 || time_to_sleep->tv_sec < 0) { /* Return an EINVAL error : */ errno = EINVAL; ret = -1; } else { /* Get the current time: */ gettimeofday(&tv, NULL); - TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); + TIMEVAL_TO_TIMESPEC(&tv, &start_time); /* Calculate the time for the current thread to wake up: */ - _thread_run->wakeup_time.tv_sec = current_time.tv_sec + time_to_sleep->tv_sec; - _thread_run->wakeup_time.tv_nsec = current_time.tv_nsec + time_to_sleep->tv_nsec; + timespecadd(time_to_sleep, &start_time, &wakeup_time); - /* Check if the nanosecond field has overflowed: */ - if (_thread_run->wakeup_time.tv_nsec >= 1000000000) { - /* Wrap the nanosecond field: */ - _thread_run->wakeup_time.tv_sec += 1; - _thread_run->wakeup_time.tv_nsec -= 1000000000; - } + _thread_run->wakeup_time.tv_sec = wakeup_time.tv_sec; + _thread_run->wakeup_time.tv_nsec = wakeup_time.tv_nsec; _thread_run->interrupted = 0; /* Reschedule the current thread to sleep: */ @@ -73,31 +70,15 @@ nanosleep(const struct timespec * time_to_sleep, /* Get the current time: */ gettimeofday(&tv, NULL); - TIMEVAL_TO_TIMESPEC(&tv, ¤t_time1); + TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); /* Calculate the remaining time to sleep: */ - remaining_time.tv_sec = time_to_sleep->tv_sec + current_time.tv_sec - current_time1.tv_sec; - remaining_time.tv_nsec = time_to_sleep->tv_nsec + current_time.tv_nsec - current_time1.tv_nsec; - - /* Check if the nanosecond field has underflowed: */ - if (remaining_time.tv_nsec < 0) { - /* Handle the underflow: */ - remaining_time.tv_sec -= 1; - remaining_time.tv_nsec += 1000000000; - } - - /* Check if the nanosecond field has overflowed: */ - if (remaining_time.tv_nsec >= 1000000000) { - /* Handle the overflow: */ - remaining_time.tv_sec += 1; - remaining_time.tv_nsec -= 1000000000; - } + timespecsub(&wakeup_time, ¤t_time, &remaining_time); /* Check if the sleep was longer than the required time: */ if (remaining_time.tv_sec < 0) { /* Reset the time left: */ - remaining_time.tv_sec = 0; - remaining_time.tv_nsec = 0; + timespecclear(&remaining_time); } /* Check if the time remaining is to be returned: */ diff --git a/lib/libpthread/uthread/uthread_once.c b/lib/libpthread/uthread/uthread_once.c index c55ba9eaf74..43ce7c39266 100644 --- a/lib/libpthread/uthread/uthread_once.c +++ b/lib/libpthread/uthread/uthread_once.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_once.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libpthread/uthread/uthread_pipe.c b/lib/libpthread/uthread/uthread_pipe.c index 48ef8ed9886..65610f01302 100644 --- a/lib/libpthread/uthread/uthread_pipe.c +++ b/lib/libpthread/uthread/uthread_pipe.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_pipe.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <unistd.h> #include <fcntl.h> diff --git a/lib/libpthread/uthread/uthread_queue.c b/lib/libpthread/uthread/uthread_queue.c index 5225ab8838e..b30b5b9d425 100644 --- a/lib/libpthread/uthread/uthread_queue.c +++ b/lib/libpthread/uthread/uthread_queue.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_queue.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <stdio.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_recvfrom.c b/lib/libpthread/uthread/uthread_recvfrom.c index e8a374160b1..905f14239f9 100644 --- a/lib/libpthread/uthread/uthread_recvfrom.c +++ b/lib/libpthread/uthread/uthread_recvfrom.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_recvfrom.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libpthread/uthread/uthread_recvmsg.c b/lib/libpthread/uthread/uthread_recvmsg.c index 44a4a6552cc..0b99b11c78d 100644 --- a/lib/libpthread/uthread/uthread_recvmsg.c +++ b/lib/libpthread/uthread/uthread_recvmsg.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_recvmsg.c,v 1.2 1999/01/06 05:29:25 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libpthread/uthread/uthread_resume_np.c b/lib/libpthread/uthread/uthread_resume_np.c index 7c5f46adfce..6e211f34ece 100644 --- a/lib/libpthread/uthread/uthread_resume_np.c +++ b/lib/libpthread/uthread/uthread_resume_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_resume_np.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_select.c b/lib/libpthread/uthread/uthread_select.c index d6202db0140..7793633fd75 100644 --- a/lib/libpthread/uthread/uthread_select.c +++ b/lib/libpthread/uthread/uthread_select.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_select.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <unistd.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_sendmsg.c b/lib/libpthread/uthread/uthread_sendmsg.c index 9d97c121dcf..db1b49d2016 100644 --- a/lib/libpthread/uthread/uthread_sendmsg.c +++ b/lib/libpthread/uthread/uthread_sendmsg.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sendmsg.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libpthread/uthread/uthread_sendto.c b/lib/libpthread/uthread/uthread_sendto.c index 7dedaaa496c..306ffbfca74 100644 --- a/lib/libpthread/uthread/uthread_sendto.c +++ b/lib/libpthread/uthread/uthread_sendto.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sendto.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libpthread/uthread/uthread_seterrno.c b/lib/libpthread/uthread/uthread_seterrno.c index 570807f1fc7..e63e9ba8d4d 100644 --- a/lib/libpthread/uthread/uthread_seterrno.c +++ b/lib/libpthread/uthread/uthread_seterrno.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_seterrno.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> diff --git a/lib/libpthread/uthread/uthread_setprio.c b/lib/libpthread/uthread/uthread_setprio.c index dd89f156a50..87a50d0f5ba 100644 --- a/lib/libpthread/uthread/uthread_setprio.c +++ b/lib/libpthread/uthread/uthread_setprio.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_setprio.c,v 1.2 1999/01/06 05:29:26 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_setsockopt.c b/lib/libpthread/uthread/uthread_setsockopt.c index a14b338eecd..6681943db7c 100644 --- a/lib/libpthread/uthread/uthread_setsockopt.c +++ b/lib/libpthread/uthread/uthread_setsockopt.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_setsockopt.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_shutdown.c b/lib/libpthread/uthread/uthread_shutdown.c index 855be90368a..4923d34cec4 100644 --- a/lib/libpthread/uthread/uthread_shutdown.c +++ b/lib/libpthread/uthread/uthread_shutdown.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_shutdown.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <errno.h> #include <sys/types.h> diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c index 85aca6cbe57..350ce71c6cf 100644 --- a/lib/libpthread/uthread/uthread_sig.c +++ b/lib/libpthread/uthread/uthread_sig.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sig.c,v 1.4 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #include <fcntl.h> diff --git a/lib/libpthread/uthread/uthread_sigaction.c b/lib/libpthread/uthread/uthread_sigaction.c index 40f3850008e..156d60a6583 100644 --- a/lib/libpthread/uthread/uthread_sigaction.c +++ b/lib/libpthread/uthread/uthread_sigaction.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigaction.c,v 1.3 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_sigblock.c b/lib/libpthread/uthread/uthread_sigblock.c index fb1e0850128..5b317d01472 100644 --- a/lib/libpthread/uthread/uthread_sigblock.c +++ b/lib/libpthread/uthread/uthread_sigblock.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigblock.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_sigmask.c b/lib/libpthread/uthread/uthread_sigmask.c index 23d6b7ff2a3..bdaf30e09f8 100644 --- a/lib/libpthread/uthread/uthread_sigmask.c +++ b/lib/libpthread/uthread/uthread_sigmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigmask.c,v 1.2 1999/01/06 05:29:27 d Exp $ */ #include <errno.h> #include <signal.h> diff --git a/lib/libpthread/uthread/uthread_signal.c b/lib/libpthread/uthread/uthread_signal.c index c9ece329762..2e1f3d21f60 100644 --- a/lib/libpthread/uthread/uthread_signal.c +++ b/lib/libpthread/uthread/uthread_signal.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_signal.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_sigprocmask.c b/lib/libpthread/uthread/uthread_sigprocmask.c index 81b602f581c..c3f0b1dda16 100644 --- a/lib/libpthread/uthread/uthread_sigprocmask.c +++ b/lib/libpthread/uthread/uthread_sigprocmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigprocmask.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_sigsetmask.c b/lib/libpthread/uthread/uthread_sigsetmask.c index bf48d7b4fa0..1f416551142 100644 --- a/lib/libpthread/uthread/uthread_sigsetmask.c +++ b/lib/libpthread/uthread/uthread_sigsetmask.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigsetmask.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_sigsuspend.c b/lib/libpthread/uthread/uthread_sigsuspend.c index 0ae9a4f7b3e..e0035c0fa1a 100644 --- a/lib/libpthread/uthread/uthread_sigsuspend.c +++ b/lib/libpthread/uthread/uthread_sigsuspend.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigsuspend.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_sigwait.c b/lib/libpthread/uthread/uthread_sigwait.c index e8d6d4ae0ca..8432e879646 100644 --- a/lib/libpthread/uthread/uthread_sigwait.c +++ b/lib/libpthread/uthread/uthread_sigwait.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_sigwait.c,v 1.3 1999/01/06 05:29:28 d Exp $ */ #include <signal.h> #include <errno.h> diff --git a/lib/libpthread/uthread/uthread_single_np.c b/lib/libpthread/uthread/uthread_single_np.c index e36c856c637..39c90837653 100644 --- a/lib/libpthread/uthread/uthread_single_np.c +++ b/lib/libpthread/uthread/uthread_single_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_single_np.c,v 1.2 1999/01/06 05:29:28 d Exp $ */ #include <string.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_socket.c b/lib/libpthread/uthread/uthread_socket.c index 7b5fe00dd2a..ea848d3c144 100644 --- a/lib/libpthread/uthread/uthread_socket.c +++ b/lib/libpthread/uthread/uthread_socket.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_socket.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <sys/types.h> #include <sys/socket.h> diff --git a/lib/libpthread/uthread/uthread_spec.c b/lib/libpthread/uthread/uthread_spec.c index c5783331063..8cf4959f1ca 100644 --- a/lib/libpthread/uthread/uthread_spec.c +++ b/lib/libpthread/uthread/uthread_spec.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_spec.c,v 1.4 1999/01/06 05:29:29 d Exp $ */ #include <signal.h> #include <stdlib.h> diff --git a/lib/libpthread/uthread/uthread_suspend_np.c b/lib/libpthread/uthread/uthread_suspend_np.c index 871683ad92a..632dbf5169b 100644 --- a/lib/libpthread/uthread/uthread_suspend_np.c +++ b/lib/libpthread/uthread/uthread_suspend_np.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_suspend_np.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <errno.h> #ifdef _THREAD_SAFE diff --git a/lib/libpthread/uthread/uthread_wait4.c b/lib/libpthread/uthread/uthread_wait4.c index dda8aeea61c..5017fe5c1ac 100644 --- a/lib/libpthread/uthread/uthread_wait4.c +++ b/lib/libpthread/uthread/uthread_wait4.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_wait4.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #include <errno.h> #include <sys/wait.h> diff --git a/lib/libpthread/uthread/uthread_yield.c b/lib/libpthread/uthread/uthread_yield.c index 877f5e6b0e8..1844be51fcc 100644 --- a/lib/libpthread/uthread/uthread_yield.c +++ b/lib/libpthread/uthread/uthread_yield.c @@ -29,6 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $OpenBSD: uthread_yield.c,v 1.2 1999/01/06 05:29:29 d Exp $ */ #ifdef _THREAD_SAFE #include <pthread.h> |