Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpthread Only copy the ucontext_t in pthread_setcontex...
details: https://anonhg.NetBSD.org/src/rev/f9edda4122d6
branches: trunk
changeset: 781523:f9edda4122d6
user: matt <matt%NetBSD.org@localhost>
date: Wed Sep 12 14:55:48 2012 +0000
description:
Only copy the ucontext_t in pthread_setcontext if _UC_TLSBASE is set.
Conditionalize the test on _UC_TLSBASE being defined.
diffstat:
lib/libpthread/pthread_specific.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (39 lines):
diff -r 52f83eedf60a -r f9edda4122d6 lib/libpthread/pthread_specific.c
--- a/lib/libpthread/pthread_specific.c Wed Sep 12 14:13:43 2012 +0000
+++ b/lib/libpthread/pthread_specific.c Wed Sep 12 14:55:48 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_specific.c,v 1.22 2012/09/12 02:00:53 manu Exp $ */
+/* $NetBSD: pthread_specific.c,v 1.23 2012/09/12 14:55:48 matt Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_specific.c,v 1.22 2012/09/12 02:00:53 manu Exp $");
+__RCSID("$NetBSD: pthread_specific.c,v 1.23 2012/09/12 14:55:48 matt Exp $");
/* Functions and structures dealing with thread-specific data */
@@ -89,9 +89,16 @@
int
pthread_setcontext(const ucontext_t *ucp)
{
+#ifdef _UC_TLSBASE
ucontext_t uc;
-
- (void)memcpy(&uc, ucp, sizeof(uc));
- uc.uc_flags &= ~_UC_TLSBASE;
- return _sys_setcontext(&uc);
+ /*
+ * Only copy and clear _UC_TLSBASE if it is set.
+ */
+ if (ucp->uc_flags & _UC_TLSBASE) {
+ uc = *ucp;
+ uc.uc_flags &= ~_UC_TLSBASE;
+ ucp = &uc;
+ }
+#endif /* _UC_TLSBASE */
+ return _sys_setcontext(ucp);
}
Home |
Main Index |
Thread Index |
Old Index