Commit Diff


commit - 0e4068e8c46ae0b45616fe13ac01a449b68fbc06
commit + d08f40666b32fd5bce69f1b40ea18d2e52e97a26
blob - c5f5dcd04aad6280997bf50b24abbb717042dd7a
blob + 59446be8c4885fd0feb9c92c55b4d49f9de0973f
--- include/u.h
+++ include/u.h
@@ -5,8 +5,14 @@ extern "C" {
 #endif
 
 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
-#define __EXTENSIONS__ 1 /* SunOS */
-/* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
+#if defined(__sun__)
+#	define __EXTENSIONS__ 1 /* SunOS */
+#	if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__)
+		/* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
+#	else
+#		define __MAKECONTEXT_V2_SOURCE 1
+#	endif
+#endif
 #define _BSD_SOURCE 1
 #define _NETBSD_SOURCE 1	/* NetBSD */
 #define _SVID_SOURCE 1
blob - 387b6400d43c2da86de97f89f47e5298c5ac364b
blob + 4d55b06fcaf55d93e67ecf8d5a063b3a4e366a70
--- src/libthread/thread.c
+++ src/libthread/thread.c
@@ -126,7 +126,7 @@ threadalloc(void (*fn)(void*), void *arg, uint stack)
 	/* leave a few words open on both ends */
 	t->context.uc.uc_stack.ss_sp = t->stk+8;
 	t->context.uc.uc_stack.ss_size = t->stksize-64;
-#ifdef __sun__		/* sigh */
+#if defined(__sun__) && !defined(__MAKECONTEXT_V2_SOURCE)		/* sigh */
 	/* can avoid this with __MAKECONTEXT_V2_SOURCE but only on SunOS 5.9 */
 	t->context.uc.uc_stack.ss_sp = 
 		(char*)t->context.uc.uc_stack.ss_sp