PERFORCE change 32055 for review
Peter Wemm
peter at FreeBSD.org
Thu May 29 14:51:43 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=32055
Change 32055 by peter at peter_daintree on 2003/05/29 14:51:15
IFC @32051
Affected files ...
.. //depot/projects/hammer/contrib/amd/conf/transp/transp_sockets.c#2 integrate
.. //depot/projects/hammer/contrib/binutils/bfd/elf64-alpha.c#5 integrate
.. //depot/projects/hammer/crypto/openssh/sshd.c#5 integrate
.. //depot/projects/hammer/lib/libc/rpc/svc_vc.c#3 integrate
.. //depot/projects/hammer/lib/libc/stdlib/realpath.c#6 integrate
.. //depot/projects/hammer/lib/libc/xdr/xdr_rec.c#3 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_init.c#7 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_private.h#9 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_sig.c#9 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_spinlock.c#5 integrate
.. //depot/projects/hammer/lib/libthr/arch/i386/i386/_setcurthread.c#7 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_cond.c#5 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_create.c#6 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_exit.c#5 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_gc.c#4 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_join.c#4 integrate
.. //depot/projects/hammer/lib/libthr/thread/thr_mutex.c#6 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#23 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#29 integrate
.. //depot/projects/hammer/release/doc/ja_JP.eucJP/errata/article.sgml#5 integrate
.. //depot/projects/hammer/release/doc/ja_JP.eucJP/hardware/common/dev.sgml#6 integrate
.. //depot/projects/hammer/release/doc/ja_JP.eucJP/relnotes/common/new.sgml#6 integrate
.. //depot/projects/hammer/share/man/man4/axe.4#2 integrate
.. //depot/projects/hammer/share/man/man4/mac_portacl.4#2 integrate
.. //depot/projects/hammer/share/man/man4/man4.i386/pae.4#3 integrate
.. //depot/projects/hammer/share/man/man4/man4.i386/sbni.4#2 integrate
.. //depot/projects/hammer/share/man/man4/man4.i386/vpd.4#2 integrate
.. //depot/projects/hammer/share/man/man4/my.4#2 integrate
.. //depot/projects/hammer/share/man/man4/rndtest.4#2 integrate
.. //depot/projects/hammer/share/man/man4/rue.4#2 integrate
.. //depot/projects/hammer/share/man/man4/sbsh.4#2 integrate
.. //depot/projects/hammer/sys/amd64/amd64/identcpu.c#11 integrate
.. //depot/projects/hammer/sys/contrib/dev/acpica/nsalloc.c#5 integrate
.. //depot/projects/hammer/sys/ia64/ia64/machdep.c#16 integrate
.. //depot/projects/hammer/sys/ia64/ia64/trap.c#11 integrate
.. //depot/projects/hammer/sys/ia64/ia64/unaligned.c#3 integrate
.. //depot/projects/hammer/sys/ia64/include/cpu.h#7 integrate
.. //depot/projects/hammer/sys/kern/kern_sysctl.c#7 integrate
.. //depot/projects/hammer/sys/kern/subr_mbuf.c#11 integrate
.. //depot/projects/hammer/sys/kern/uipc_syscalls.c#8 integrate
.. //depot/projects/hammer/sys/kern/vfs_cluster.c#8 integrate
.. //depot/projects/hammer/sys/net/if_loop.c#7 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/tick.c#5 integrate
Differences ...
==== //depot/projects/hammer/contrib/amd/conf/transp/transp_sockets.c#2 (text+ko) ====
@@ -50,6 +50,9 @@
#include <am_defs.h>
#include <amu.h>
+#ifndef RPC_MAXDATASIZE
+#define RPC_MAXDATASIZE 9000
+#endif
/*
* find the IP address that can be used to connect to the local host
@@ -216,6 +219,8 @@
int
create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp)
{
+ int maxrec = RPC_MAXDATASIZE;
+
/* first create TCP service */
if (tcp_soAMQp) {
*tcp_soAMQp = socket(AF_INET, SOCK_STREAM, 0);
@@ -231,6 +236,9 @@
return 2;
}
}
+#ifdef SVCSET_CONNMAXREC
+ SVC_CONTROL(*tcp_amqpp, SVCSET_CONNMAXREC, &maxrec);
+#endif
/* next create UDP service */
if (udp_soAMQp) {
==== //depot/projects/hammer/contrib/binutils/bfd/elf64-alpha.c#5 (text+ko) ====
@@ -19,6 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* $FreeBSD: src/contrib/binutils/bfd/elf64-alpha.c,v 1.18 2003/05/28 03:32:33 obrien Exp $ */
+
/* We need a published ABI spec for this. Until one comes out, don't
assume this'll remain unchanged forever. */
@@ -4490,8 +4492,20 @@
value -= gp;
goto default_reloc;
+ case R_ALPHA_GPREL32:
+ /* If the target section was a removed linkonce section,
+ r_symndx will be zero. In this case, assume that the
+ switch will not be used, so don't fill it in. If we
+ do nothing here, we'll get relocation truncated messages,
+ due to the placement of the application above 4GB. */
+ if (r_symndx == 0)
+ {
+ r = bfd_reloc_ok;
+ break;
+ }
+ /* FALLTHRU */
+
case R_ALPHA_GPREL16:
- case R_ALPHA_GPREL32:
case R_ALPHA_GPRELLOW:
if (dynamic_symbol_p)
{
==== //depot/projects/hammer/crypto/openssh/sshd.c#5 (text+ko) ====
@@ -43,7 +43,7 @@
#include "includes.h"
RCSID("$OpenBSD: sshd.c,v 1.263 2003/02/16 17:09:57 markus Exp $");
-RCSID("$FreeBSD: src/crypto/openssh/sshd.c,v 1.33 2003/04/23 17:10:53 des Exp $");
+RCSID("$FreeBSD: src/crypto/openssh/sshd.c,v 1.34 2003/05/28 19:39:33 des Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@@ -835,9 +835,10 @@
/* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
saved_argc = ac;
saved_argv = av;
- saved_argv = xmalloc(sizeof(*saved_argv) * ac);
+ saved_argv = xmalloc(sizeof(*saved_argv) * (ac + 1));
for (i = 0; i < ac; i++)
saved_argv[i] = xstrdup(av[i]);
+ saved_argv[ac] = NULL;
#ifndef HAVE_SETPROCTITLE
/* Prepare for later setproctitle emulation */
==== //depot/projects/hammer/lib/libc/rpc/svc_vc.c#3 (text+ko) ====
@@ -34,7 +34,7 @@
static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/rpc/svc_vc.c,v 1.17 2003/01/26 23:01:49 mbr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/rpc/svc_vc.c,v 1.19 2003/05/29 19:43:22 mbr Exp $");
/*
* svc_vc.c, Server side for Connection Oriented based RPC.
@@ -487,8 +487,15 @@
cfp = (struct cf_conn *)xprt->xp_p1;
+ cm = NULL;
+ sa = (struct sockaddr *)xprt->xp_rtaddr.buf;
if (cfp->nonblock) {
- len = _read(sock, buf, (size_t)len);
+ if (sa->sa_family == AF_LOCAL) {
+ cm = (struct cmessage *)xprt->xp_verf.oa_base;
+ if ((len = __msgread_withcred(sock, buf, len, cm)) > 0)
+ xprt->xp_p2 = &cm->cmcred;
+ } else
+ len = _read(sock, buf, (size_t)len);
if (len < 0) {
if (errno == EAGAIN)
len = 0;
@@ -517,8 +524,6 @@
}
} while ((pollfd.revents & POLLIN) == 0);
- cm = NULL;
- sa = (struct sockaddr *)xprt->xp_rtaddr.buf;
if (sa->sa_family == AF_LOCAL) {
cm = (struct cmessage *)xprt->xp_verf.oa_base;
if ((len = __msgread_withcred(sock, buf, len, cm)) > 0) {
==== //depot/projects/hammer/lib/libc/stdlib/realpath.c#6 (text+ko) ====
@@ -30,7 +30,7 @@
static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.19 2003/05/01 19:03:14 nectar Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.20 2003/05/28 08:23:01 fjoe Exp $");
#include "namespace.h"
#include <sys/param.h>
@@ -119,7 +119,7 @@
*/
if (resolved_len > 1) {
resolved[resolved_len - 1] = '\0';
- q = strrchr(resolved, '/');
+ q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}
@@ -158,7 +158,7 @@
} else if (resolved_len > 1) {
/* Strip the last path component. */
resolved[resolved_len - 1] = '\0';
- q = strrchr(resolved, '/');
+ q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}
==== //depot/projects/hammer/lib/libc/xdr/xdr_rec.c#3 (text+ko) ====
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/xdr/xdr_rec.c,v 1.19 2003/02/27 13:40:01 nectar Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/xdr/xdr_rec.c,v 1.20 2003/05/28 09:13:09 mbr Exp $");
/*
* xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
@@ -489,16 +489,7 @@
XDR *xdrs;
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- enum xprt_stat xstat;
- if (rstrm->nonblock) {
- if (__xdrrec_getrec(xdrs, &xstat, FALSE))
- return FALSE;
- if (!rstrm->in_haveheader && xstat == XPRT_IDLE)
- return TRUE;
- return FALSE;
- }
-
while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
if (! skip_input_bytes(rstrm, rstrm->fbtbc))
return (TRUE);
@@ -719,6 +710,8 @@
{
u_int32_t header;
+ if (rstrm->nonblock)
+ return FALSE;
if (! get_input_bytes(rstrm, (char *)(void *)&header, sizeof(header)))
return (FALSE);
header = ntohl(header);
==== //depot/projects/hammer/lib/libpthread/thread/thr_init.c#7 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/thread/thr_init.c,v 1.52 2003/05/16 19:58:29 deischen Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_init.c,v 1.53 2003/05/29 17:10:45 deischen Exp $
*/
/* Allocate space for global thread variables here: */
@@ -515,6 +515,7 @@
if (_lock_init(&_keytable_lock, LCK_ADAPTIVE,
_thr_lock_wait, _thr_lock_wakeup) != 0)
PANIC("Cannot initialize thread specific keytable lock");
+ _thr_spinlock_init();
/* Clear pending signals and get the process signal mask. */
sigemptyset(&_thr_proc_sigpending);
==== //depot/projects/hammer/lib/libpthread/thread/thr_private.h#9 (text+ko) ====
@@ -31,7 +31,7 @@
*
* Private thread definitions for the uthread kernel.
*
- * $FreeBSD: src/lib/libpthread/thread/thr_private.h,v 1.87 2003/05/16 19:58:29 deischen Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_private.h,v 1.88 2003/05/29 17:10:45 deischen Exp $
*/
#ifndef _THR_PRIVATE_H
@@ -1114,6 +1114,7 @@
void _thr_sched_switch(struct pthread *);
void _thr_sched_switch_unlocked(struct pthread *);
void _thr_set_timeout(const struct timespec *);
+void _thr_seterrno(struct pthread *, int);
void _thr_sig_handler(int, siginfo_t *, ucontext_t *);
void _thr_sig_check_pending(struct pthread *);
void _thr_sig_rundown(struct pthread *, ucontext_t *,
@@ -1121,7 +1122,7 @@
void _thr_sig_send(struct pthread *pthread, int sig);
void _thr_sig_wrapper(void);
void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf);
-void _thr_seterrno(struct pthread *, int);
+void _thr_spinlock_init(void);
void _thr_enter_cancellation_point(struct pthread *);
void _thr_leave_cancellation_point(struct pthread *);
int _thr_setconcurrency(int new_level);
==== //depot/projects/hammer/lib/libpthread/thread/thr_sig.c#9 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/thread/thr_sig.c,v 1.51 2003/05/24 02:29:25 deischen Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_sig.c,v 1.52 2003/05/29 17:10:45 deischen Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
@@ -175,7 +175,7 @@
void
_thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
{
- void (*sigfunc)(int, siginfo_t *, void *);
+ __siginfohandler_t *sigfunc;
struct kse *curkse;
curkse = _get_curkse();
@@ -184,7 +184,8 @@
sigfunc = _thread_sigact[sig - 1].sa_sigaction;
ucp->uc_sigmask = _thr_proc_sigmask;
if (((__sighandler_t *)sigfunc != SIG_DFL) &&
- ((__sighandler_t *)sigfunc != SIG_IGN)) {
+ ((__sighandler_t *)sigfunc != SIG_IGN) &&
+ (sigfunc != (__siginfohandler_t *)_thr_sig_handler)) {
if (((_thread_sigact[sig - 1].sa_flags & SA_SIGINFO)
!= 0) || (info == NULL))
(*(sigfunc))(sig, info, ucp);
==== //depot/projects/hammer/lib/libpthread/thread/thr_spinlock.c#5 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/thread/thr_spinlock.c,v 1.15 2003/04/28 23:56:12 deischen Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_spinlock.c,v 1.16 2003/05/29 17:10:45 deischen Exp $
*
*/
@@ -40,6 +40,20 @@
#include "spinlock.h"
#include "thr_private.h"
+#define MAX_SPINLOCKS 5
+
+struct spinlock_extra {
+ struct lock lock;
+ kse_critical_t crit;
+};
+
+static void init_spinlock(spinlock_t *lck);
+
+static struct lock spinlock_static_lock;
+static struct spinlock_extra extra[MAX_SPINLOCKS];
+static int spinlock_count = 0;
+static int initialized = 0;
+
/*
* These are for compatability only. Spinlocks of this type
* are deprecated.
@@ -48,12 +62,13 @@
void
_spinunlock(spinlock_t *lck)
{
+ struct spinlock_extra *extra;
kse_critical_t crit;
- crit = (kse_critical_t)lck->fname;
- atomic_store_rel_long(&lck->access_lock, 0);
- if (crit != NULL)
- _kse_critical_leave(crit);
+ extra = (struct spinlock_extra *)lck->fname;
+ crit = extra->crit;
+ KSE_LOCK_RELEASE(_get_curkse(), &extra->lock);
+ _kse_critical_leave(crit);
}
@@ -66,21 +81,21 @@
void
_spinlock(spinlock_t *lck)
{
+ struct spinlock_extra *extra;
kse_critical_t crit;
+ THR_ASSERT(__isthreaded != 0, "Spinlock called when not threaded.");
+ THR_ASSERT(initialized != 0, "Spinlocks not initialized.");
/*
* Try to grab the lock and loop if another thread grabs
* it before we do.
*/
- if (_kse_isthreaded())
- crit = _kse_critical_enter();
- else
- crit = NULL;
- while(_atomic_lock(&lck->access_lock)) {
- while (lck->access_lock)
- ;
- }
- lck->fname = (char *)crit;
+ crit = _kse_critical_enter();
+ if (lck->fname == NULL)
+ init_spinlock(lck);
+ extra = (struct spinlock_extra *)lck->fname;
+ KSE_LOCK_ACQUIRE(_get_curkse(), &extra->lock);
+ extra->crit = crit;
}
/*
@@ -98,3 +113,40 @@
{
_spinlock(lck);
}
+
+static void
+init_spinlock(spinlock_t *lck)
+{
+ struct kse *curkse = _get_curkse();
+
+ KSE_LOCK_ACQUIRE(curkse, &spinlock_static_lock);
+ if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
+ lck->fname = (char *)&extra[spinlock_count];
+ spinlock_count++;
+ }
+ KSE_LOCK_RELEASE(curkse, &spinlock_static_lock);
+ THR_ASSERT(lck->fname != NULL, "Exceeded max spinlocks");
+}
+
+void
+_thr_spinlock_init(void)
+{
+ int i;
+
+ if (initialized != 0) {
+ _lock_destroy(&spinlock_static_lock);
+ for (i = 0; i < MAX_SPINLOCKS; i++) {
+ _lock_destroy(&extra[i].lock);
+ }
+ }
+
+ if (_lock_init(&spinlock_static_lock, LCK_ADAPTIVE,
+ _kse_lock_wait, _kse_lock_wakeup) != 0)
+ PANIC("Cannot initialize spinlock_static_lock");
+ for (i = 0; i < MAX_SPINLOCKS; i++) {
+ if (_lock_init(&extra[i].lock, LCK_ADAPTIVE,
+ _kse_lock_wait, _kse_lock_wakeup) != 0)
+ PANIC("Cannot initialize spinlock extra");
+ }
+ initialized = 1;
+}
==== //depot/projects/hammer/lib/libthr/arch/i386/i386/_setcurthread.c#7 (text+ko) ====
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/arch/i386/i386/_setcurthread.c,v 1.8 2003/05/25 22:40:57 mtm Exp $
+ * $FreeBSD: src/lib/libthr/arch/i386/i386/_setcurthread.c,v 1.9 2003/05/29 20:49:17 mtm Exp $
*/
#include <sys/types.h>
@@ -111,6 +111,8 @@
if (ldt_free == NULL) {
/* Concurrent thread limit reached */
*err = curthread->error = EAGAIN;
+ if (thr != _thread_initial)
+ _SPINUNLOCK(&ldt_lock);
return (NULL);
}
==== //depot/projects/hammer/lib/libthr/thread/thr_cond.c#5 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_cond.c,v 1.6 2003/05/24 01:02:16 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_cond.c,v 1.7 2003/05/29 20:54:00 mtm Exp $
*/
#include <stdlib.h>
#include <errno.h>
@@ -38,8 +38,15 @@
#include "thr_private.h"
/*
+ * Proctect two different threads calling a pthread_cond_* function
+ * from accidentally initializing the condition variable twice.
+ */
+static spinlock_t static_cond_lock = _SPINLOCK_INITIALIZER;
+
+/*
* Prototypes
*/
+static inline int cond_init(pthread_cond_t *);
static pthread_t cond_queue_deq(pthread_cond_t);
static void cond_queue_remove(pthread_cond_t, pthread_t);
static void cond_queue_enq(pthread_cond_t, pthread_t);
@@ -202,7 +209,7 @@
* If the condition variable is statically initialized, perform dynamic
* initialization.
*/
- if (*cond == NULL && (rval = pthread_cond_init(cond, NULL)) != 0)
+ if (*cond == PTHREAD_COND_INITIALIZER && (rval = cond_init(cond)) != 0)
return (rval);
@@ -363,7 +370,7 @@
* If the condition variable is statically initialized, perform dynamic
* initialization.
*/
- if (*cond == NULL && (rval = pthread_cond_init(cond, NULL)) != 0)
+ if (*cond == PTHREAD_COND_INITIALIZER && (rval = cond_init(cond)) != 0)
return (rval);
COND_LOCK(*cond);
@@ -518,3 +525,14 @@
pthread->flags |= PTHREAD_FLAGS_IN_CONDQ;
pthread->data.cond = cond;
}
+
+static inline int
+cond_init(pthread_cond_t *cond)
+{
+ _SPINLOCK(&static_cond_lock);
+ if (*cond == PTHREAD_COND_INITIALIZER)
+ return (_pthread_cond_init(cond, NULL));
+ _SPINUNLOCK(&static_cond_lock);
+ return (0);
+}
+
==== //depot/projects/hammer/lib/libthr/thread/thr_create.c#6 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_create.c,v 1.9 2003/05/26 00:37:07 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_create.c,v 1.10 2003/05/29 20:40:50 mtm Exp $
*/
#include <errno.h>
#include <stdlib.h>
@@ -171,7 +171,6 @@
new_thread->uniqueid = next_uniqueid++;
THREAD_LIST_LOCK;
- _thread_critical_enter(new_thread);
/*
* Check if the garbage collector thread
@@ -182,8 +181,6 @@
/* Add the thread to the linked list of all threads: */
TAILQ_INSERT_HEAD(&_thread_list, new_thread, tle);
- THREAD_LIST_UNLOCK;
-
/*
* Create the thread.
*
@@ -200,11 +197,11 @@
PANIC("thr_create");
}
+ THREAD_LIST_UNLOCK;
+
/* Return a pointer to the thread structure: */
(*thread) = new_thread;
- _thread_critical_exit(new_thread);
-
/*
* Start a garbage collector thread
* if necessary.
==== //depot/projects/hammer/lib/libthr/thread/thr_exit.c#5 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.6 2003/05/25 08:31:33 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.8 2003/05/29 20:46:53 mtm Exp $
*/
#include <errno.h>
#include <unistd.h>
@@ -94,7 +94,7 @@
void
_pthread_exit(void *status)
{
- pthread_t pthread;
+ pthread_t pthread, joiner;
int exitNow = 0;
/* Check if this thread is already in the process of exiting: */
@@ -122,10 +122,27 @@
_thread_cleanupspecific();
}
+retry:
+ /*
+ * Proper lock order, to minimize deadlocks, between joining
+ * and exiting threads is: DEAD_LIST, THREAD_LIST, exiting, joiner.
+ * In order to do this *and* protect from races, we must resort
+ * this test-and-retry loop.
+ */
+ joiner = curthread->joiner;
+
/* Lock the dead list first to maintain correct lock order */
DEAD_LIST_LOCK;
+ THREAD_LIST_LOCK;
_thread_critical_enter(curthread);
+ if (joiner != curthread->joiner) {
+ _thread_critical_exit(curthread);
+ THREAD_LIST_UNLOCK;
+ DEAD_LIST_UNLOCK;
+ goto retry;
+ }
+
/* Check if there is a thread joining this one: */
if (curthread->joiner != NULL) {
pthread = curthread->joiner;
@@ -151,34 +168,35 @@
* Add this thread to the list of dead threads, and
* also remove it from the active threads list.
*/
- THREAD_LIST_LOCK;
TAILQ_INSERT_HEAD(&_dead_list, curthread, dle);
TAILQ_REMOVE(&_thread_list, curthread, tle);
PTHREAD_SET_STATE(curthread, PS_DEAD);
_thread_critical_exit(curthread);
+ /* If we're the last thread, call it quits */
+ if (TAILQ_EMPTY(&_thread_list))
+ exitNow = 1;
+
+ THREAD_LIST_UNLOCK;
+
/*
* Signal the garbage collector thread that there is something
- * to clean up.
+ * to clean up. But don't allow it to free the memory until after
+ * it is retired by holding on to the dead list lock.
*/
if (pthread_cond_signal(&_gc_cond) != 0)
PANIC("Cannot signal gc cond");
- /* If we're the last thread, call it quits */
- if (TAILQ_EMPTY(&_thread_list))
- exitNow = 1;
+ if (exitNow)
+ exit(0);
- THREAD_LIST_UNLOCK;
DEAD_LIST_UNLOCK;
- if (exitNow)
- exit(0);
-
/*
- * Retire the architecture specific id so that it can be used for
- * new threads.
+ * This function will not return unless we are the last
+ * thread, which we can't be because we've already checked
+ * for that.
*/
- _retire_thread(curthread->arch_id);
_thr_exit();
/* This point should not be reached. */
==== //depot/projects/hammer/lib/libthr/thread/thr_gc.c#4 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_gc.c,v 1.5 2003/05/26 00:37:07 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_gc.c,v 1.6 2003/05/29 20:46:53 mtm Exp $
*
* Garbage collector thread. Frees memory allocated for dead threads.
*
@@ -142,6 +142,13 @@
pthread_cln = pthread;
_SPINUNLOCK(&pthread->lock);
+
+ /*
+ * Retire the architecture specific id so it may be
+ * used for new threads.
+ */
+ _retire_thread(pthread_cln->arch_id);
+
}
/*
==== //depot/projects/hammer/lib/libthr/thread/thr_join.c#4 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_join.c,v 1.6 2003/05/26 00:28:49 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_join.c,v 1.8 2003/05/29 20:46:53 mtm Exp $
*/
#include <errno.h>
#include <pthread.h>
@@ -107,9 +107,10 @@
/* Check if the thread is not dead: */
if (pthread->state != PS_DEAD) {
- _thread_critical_enter(curthread);
/* Set the running thread to be the joiner: */
pthread->joiner = curthread;
+ _SPINUNLOCK(&pthread->lock);
+ _thread_critical_enter(curthread);
/* Keep track of which thread we're joining to: */
curthread->join_status.thread = pthread;
@@ -118,11 +119,19 @@
PTHREAD_SET_STATE(curthread, PS_JOIN);
/* Wait for our signal to wake up. */
_thread_critical_exit(curthread);
- _SPINUNLOCK(&pthread->lock);
THREAD_LIST_UNLOCK;
DEAD_LIST_UNLOCK;
_thread_suspend(curthread, NULL);
+ /*
+ * XXX - For correctness reasons.
+ * We must aquire these in the same order and also
+ * importantly, release in the same order, order because
+ * otherwise we might deadlock with the joined thread
+ * when we attempt to release one of these locks.
+ */
+ DEAD_LIST_LOCK;
+ THREAD_LIST_LOCK;
_thread_critical_enter(curthread);
}
@@ -134,6 +143,8 @@
if ((ret == 0) && (thread_return != NULL))
*thread_return = curthread->join_status.ret;
_thread_critical_exit(curthread);
+ THREAD_LIST_UNLOCK;
+ DEAD_LIST_UNLOCK;
} else {
/*
* The thread exited (is dead) without being detached, and no
@@ -149,9 +160,9 @@
/* Make the thread collectable by the garbage collector. */
pthread->attr.flags |= PTHREAD_DETACHED;
_SPINUNLOCK(&pthread->lock);
+ THREAD_LIST_UNLOCK;
if (pthread_cond_signal(&_gc_cond) != 0)
PANIC("Cannot signal gc cond");
- THREAD_LIST_UNLOCK;
DEAD_LIST_UNLOCK;
}
==== //depot/projects/hammer/lib/libthr/thread/thr_mutex.c#6 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_mutex.c,v 1.8 2003/05/23 09:48:20 mtm Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_mutex.c,v 1.9 2003/05/29 20:58:31 mtm Exp $
*/
#include <stdlib.h>
#include <errno.h>
@@ -101,7 +101,7 @@
if (mutex == NULL)
ret = EINVAL;
- else if (*mutex == NULL)
+ else if (*mutex == PTHREAD_MUTEX_INITIALIZER)
ret = _pthread_mutex_init(mutex, NULL);
else {
/*
@@ -269,35 +269,25 @@
static int
init_static(pthread_mutex_t *mutex)
{
- int ret;
-
_SPINLOCK(&static_init_lock);
-
- if (*mutex == NULL)
- ret = _pthread_mutex_init(mutex, NULL);
- else
- ret = 0;
-
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER) {
+ _SPINUNLOCK(&static_init_lock);
+ return(_pthread_mutex_init(mutex, NULL));
+ }
_SPINUNLOCK(&static_init_lock);
-
- return (ret);
+ return (0);
}
static int
init_static_private(pthread_mutex_t *mutex)
{
- int ret;
-
_SPINLOCK(&static_init_lock);
-
- if (*mutex == NULL)
- ret = _pthread_mutex_init(mutex, &static_mattr);
- else
- ret = 0;
-
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER) {
+ _SPINUNLOCK(&static_init_lock);
+ return (_pthread_mutex_init(mutex, &static_mattr));
+ }
_SPINUNLOCK(&static_init_lock);
-
- return (ret);
+ return (0);
}
int
@@ -312,7 +302,8 @@
* If the mutex is statically initialized, perform the dynamic
* initialization:
*/
- else if ((*mutex != NULL) || (ret = init_static(mutex)) == 0)
+ else if ((*mutex != PTHREAD_MUTEX_INITIALIZER) ||
+ (ret = init_static(mutex)) == 0)
ret = mutex_lock_common(mutex, 1);
return (ret);
@@ -330,7 +321,8 @@
* If the mutex is statically initialized, perform the dynamic
* initialization marking the mutex private (delete safe):
*/
- else if ((*mutex != NULL) || (ret = init_static_private(mutex)) == 0)
+ else if ((*mutex != PTHREAD_MUTEX_INITIALIZER) ||
+ (ret = init_static_private(mutex)) == 0)
ret = mutex_lock_common(mutex, 1);
return (ret);
@@ -514,7 +506,8 @@
* If the mutex is statically initialized, perform the dynamic
* initialization:
*/
- else if ((*mutex != NULL) || ((ret = init_static(mutex)) == 0))
+ else if ((*mutex != PTHREAD_MUTEX_INITIALIZER) ||
+ ((ret = init_static(mutex)) == 0))
ret = mutex_lock_common(mutex, 0);
return (ret);
@@ -535,7 +528,8 @@
* If the mutex is statically initialized, perform the dynamic
* initialization marking it private (delete safe):
*/
- else if ((*mutex != NULL) || ((ret = init_static_private(mutex)) == 0))
+ else if ((*mutex != PTHREAD_MUTEX_INITIALIZER) ||
+ ((ret = init_static_private(mutex)) == 0))
ret = mutex_lock_common(mutex, 0);
return (ret);
==== //depot/projects/hammer/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#23 (text+ko) ====
@@ -31,7 +31,7 @@
<sect1 id="support">
<sect1info>
- <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml,v 1.155 2003/05/24 18:50:20 hrs Exp $</pubdate>
+ <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml,v 1.156 2003/05/28 21:01:22 hrs Exp $</pubdate>
</sect1info>
<title>Supported Devices</title>
@@ -688,7 +688,7 @@
<para>ICM PSC-2401 SCSI</para>
</listitem>
<listitem>
- <para>Melco IFC-SC</para>
+ <para>MELCO IFC-SC</para>
</listitem>
<listitem>
<para>RATOC REX-5536, REX-5536AM, REX-5536M,
@@ -1273,7 +1273,7 @@
(PCMPC100 V2)</para>
</listitem>
<listitem>
- <para>Melco LPC-T/LPC2-T/LPC2-CLT/LPC2-TX/LPC3-TX/LPC3-CLX</para>
+ <para>MELCO LPC-T/LPC2-T/LPC2-CLT/LPC2-TX/LPC3-TX/LPC3-CLX</para>
</listitem>
<listitem>
<para>NDC Ethernet Instant-Link</para>
@@ -1609,7 +1609,7 @@
<para>LinkSys USB10T, USB10TA, USB10TX, USB100TX, USB100H1</para>
</listitem>
<listitem>
- <para>Melco LUA-TX, LUA2-TX</para>
+ <para>MELCO LUA-TX, LUA2-TX</para>
</listitem>
<listitem>
<para>Planex UE-200TX</para>
@@ -1716,7 +1716,7 @@
<para>GREEN HOUSE GH-USB100B</para>
</listitem>
<listitem>
- <para>Melco LUA-KTX</para>
+ <para>MELCO LUA-KTX</para>
</listitem>
</itemizedlist>
@@ -2345,7 +2345,7 @@
<para>Lucent WaveLAN/IEEE 802.11</para>
</listitem>
<listitem>
- <para>Melco Airconnect WLI-PCM-S11, WLI-PCM-L11</para>
+ <para>MELCO Airconnect WLI-PCM-S11, WLI-PCM-L11</para>
</listitem>
<listitem>
<para>NCR WaveLAN/IEEE 802.11</para>
@@ -2428,7 +2428,7 @@
<para>Icom SL-200</para>
</listitem>
<listitem>
- <para>Melco WLI-PCM</para>
+ <para>MELCO WLI-PCM</para>
</listitem>
<listitem>
<para>NEL SSMagic</para>
@@ -3306,21 +3306,21 @@
<para>Matshita CF-VFDU03 floppy drive</para>
</listitem>
<listitem>
- <para>Melco USB2.0 MO Drive MO-CH640U2</para>
+ <para>MELCO USB2.0 MO Drive MO-CH640U2</para>
</listitem>
<listitem>
- <para>Melco USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI</para>
+ <para>I-O DATA USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI</para>
</listitem>
<listitem>
- <para>Melco USB Flash Disk <quote>PetitDrive</quote>,
+ <para>MELCO USB Flash Disk <quote>PetitDrive</quote>,
RUF-32M, -64M, -128M, -256M</para>
</listitem>
<listitem>
- <para>Melco USB2.0 Flash Disk <quote>PetitDrive2</quote>,
+ <para>MELCO USB2.0 Flash Disk <quote>PetitDrive2</quote>,
RUF-256M/U2, -512M/U2</para>
</listitem>
<listitem>
- <para>Melco USB Flash Disk <quote>ClipDrive</quote>,
+ <para>MELCO USB Flash Disk <quote>ClipDrive</quote>,
RUF-C32M, -C64M, -C128M, -C256M, -C512M</para>
</listitem>
<listitem>
@@ -3521,7 +3521,7 @@
<para arch="i386,pc98">FAX-Modem/PCCARD
<itemizedlist>
<listitem>
- <para>Melco IGM-PCM56K/IGM-PCM56KH</para>
+ <para>MELCO IGM-PCM56K/IGM-PCM56KH</para>
</listitem>
<listitem>
<para>Nokia Card Phone 2.0 (gsm900/dcs1800 HSCSD terminal)</para>
==== //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#29 (text+ko) ====
@@ -3,7 +3,7 @@
<corpauthor>The FreeBSD Project</corpauthor>
- <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.572 2003/05/27 15:43:59 bmah Exp $</pubdate>
+ <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.573 2003/05/28 21:01:22 hrs Exp $</pubdate>
<copyright>
<year>2000</year>
@@ -735,7 +735,7 @@
<para>The format of the <filename>/etc/pwd.db</filename> and
<filename>/etc/spwd.db</filename> password databases created by
- &man.pwd.mkdb.8; is now byte-order dependent. The pre-processed
+ &man.pwd.mkdb.8; is now byte-order independent. The pre-processed
password databases can now be moved between machines of
different architectures. The format includes version numbers on
entries to ensure compatibility with old binaries.</para>
==== //depot/projects/hammer/release/doc/ja_JP.eucJP/errata/article.sgml#5 (text+ko) ====
@@ -1,8 +1,8 @@
<!--
FreeBSD Japanese Documentation Project
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list