diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2011-10-07 08:59:44 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2011-10-07 08:59:44 +0000 |
commit | b23a7d170a14cb792d7509f6e9cb8fff06971122 (patch) | |
tree | c2b4041e1896aa4928673b57c586ba72676342d6 | |
parent | 1979c4a83f8a62aaeef5782796282d7baf97af04 (diff) |
threads waiting on PS_FDW_WAIT state should not be interruptible if
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@
-rw-r--r-- | lib/libpthread/uthread/pthread_private.h | 3 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_cancel.c | 3 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_connect.c | 5 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_info_openbsd.c | 4 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_kern.c | 5 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_sig.c | 5 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_suspend_np.c | 3 |
7 files changed, 19 insertions, 9 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h index 106a03317f1..78b5754f5a1 100644 --- a/lib/libpthread/uthread/pthread_private.h +++ b/lib/libpthread/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.77 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.78 2011/10/07 08:59:42 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -487,6 +487,7 @@ enum pthread_state { PS_DEAD, PS_DEADLOCK, PS_KEVENT_WAIT, + PS_CONNECT_WAIT, PS_STATE_MAX }; diff --git a/lib/libpthread/uthread/uthread_cancel.c b/lib/libpthread/uthread/uthread_cancel.c index b2079e24a55..b133dd4ca57 100644 --- a/lib/libpthread/uthread/uthread_cancel.c +++ b/lib/libpthread/uthread/uthread_cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_cancel.c,v 1.17 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: uthread_cancel.c,v 1.18 2011/10/07 08:59:43 fgsch Exp $ */ /* * David Leonard <d@openbsd.org>, 1999. Public domain. */ @@ -39,6 +39,7 @@ pthread_cancel(pthread_t pthread) break; case PS_SPINBLOCK: + case PS_CONNECT_WAIT: case PS_FDR_WAIT: case PS_FDW_WAIT: case PS_KEVENT_WAIT: diff --git a/lib/libpthread/uthread/uthread_connect.c b/lib/libpthread/uthread/uthread_connect.c index 1e4937d48bf..b160df91dbc 100644 --- a/lib/libpthread/uthread/uthread_connect.c +++ b/lib/libpthread/uthread/uthread_connect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_connect.c,v 1.8 2007/05/01 18:16:37 kurt Exp $ */ +/* $OpenBSD: uthread_connect.c,v 1.9 2011/10/07 08:59:43 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -64,7 +64,8 @@ connect(int fd, const struct sockaddr * name, socklen_t namelen) /* Set the timeout: */ _thread_kern_set_timeout(NULL); - _thread_kern_sched_state(PS_FDW_WAIT, __FILE__, __LINE__); + _thread_kern_sched_state(PS_CONNECT_WAIT, + __FILE__, __LINE__); /* * Check if the operation was diff --git a/lib/libpthread/uthread/uthread_info_openbsd.c b/lib/libpthread/uthread/uthread_info_openbsd.c index bbaa4ba5168..b8a415a5604 100644 --- a/lib/libpthread/uthread/uthread_info_openbsd.c +++ b/lib/libpthread/uthread/uthread_info_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_info_openbsd.c,v 1.16 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: uthread_info_openbsd.c,v 1.17 2011/10/07 08:59:43 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> @@ -57,6 +57,7 @@ static const struct s_thread_info thread_info[] = { {PS_SIGTHREAD , "sigthread"}, {PS_MUTEX_WAIT , "mutex_wait"}, {PS_COND_WAIT , "cond_wait"}, + {PS_CONNECT_WAIT, "connect_wait"}, {PS_FDLR_WAIT , "fdlr_wait"}, {PS_FDLW_WAIT , "fdlw_wait"}, {PS_FDR_WAIT , "fdr_wait"}, @@ -174,6 +175,7 @@ _thread_dump_entry(pthread_t pthread, int fd, int verbose) /* Process according to thread state: */ switch (pthread->state) { /* File descriptor read lock wait: */ + case PS_CONNECT_WAIT: case PS_FDLR_WAIT: case PS_FDLW_WAIT: case PS_FDR_WAIT: diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c index a7ea95e295d..fa06b812c94 100644 --- a/lib/libpthread/uthread/uthread_kern.c +++ b/lib/libpthread/uthread/uthread_kern.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_kern.c,v 1.40 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: uthread_kern.c,v 1.41 2011/10/07 08:59:43 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -225,6 +225,7 @@ _thread_kern_sched(struct sigcontext * scp) _spinblock_count++; /* FALLTHROUGH */ + case PS_CONNECT_WAIT: case PS_FDR_WAIT: case PS_FDW_WAIT: case PS_KEVENT_WAIT: @@ -734,6 +735,7 @@ _thread_kern_poll(int wait_reqd) break; /* File descriptor write wait: */ + case PS_CONNECT_WAIT: case PS_FDW_WAIT: /* if fd is closing then reschedule this thread */ if (_thread_fd_table[pthread->data.fd.fd]->state == FD_ENTRY_CLOSING) { @@ -860,6 +862,7 @@ _thread_kern_poll(int wait_reqd) break; /* File descriptor write wait: */ + case PS_CONNECT_WAIT: case PS_FDW_WAIT: if ((nfds < _thread_max_pfdtsize) && (_thread_pfd_table[nfds].revents diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c index 2a1a791fcc7..08d3f7fc67f 100644 --- a/lib/libpthread/uthread/uthread_sig.c +++ b/lib/libpthread/uthread/uthread_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sig.c,v 1.27 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: uthread_sig.c,v 1.28 2011/10/07 08:59:43 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -328,11 +328,12 @@ _thread_signal(pthread_t pthread, int sig) * other than the scheduling alarm: */ case PS_FDR_WAIT: + case PS_FDW_WAIT: if (_thread_sigact[sig - 1].sa_flags & SA_RESTART) interrupted = 0; /* FALLTHROUGH */ - case PS_FDW_WAIT: + case PS_CONNECT_WAIT: case PS_KEVENT_WAIT: case PS_POLL_WAIT: case PS_SLEEP_WAIT: diff --git a/lib/libpthread/uthread/uthread_suspend_np.c b/lib/libpthread/uthread/uthread_suspend_np.c index 500cdd12420..fe2a1adb941 100644 --- a/lib/libpthread/uthread/uthread_suspend_np.c +++ b/lib/libpthread/uthread/uthread_suspend_np.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_suspend_np.c,v 1.11 2011/09/13 23:56:00 fgsch Exp $ */ +/* $OpenBSD: uthread_suspend_np.c,v 1.12 2011/10/07 08:59:43 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -106,6 +106,7 @@ suspend_common(struct pthread *thread) PTHREAD_SET_STATE(thread, PS_SUSPENDED); break; + case PS_CONNECT_WAIT: case PS_FDR_WAIT: case PS_FDW_WAIT: case PS_KEVENT_WAIT: |