Commit Diff


commit - bc5d57712754818a2320a385afbf1c0c9558a4b3
commit + c54b8b69ede9d92e802baa1163d9cd734b034fb4
blob - 1f86742133760826e7669c7620f0e6e428bcb2bd
blob + 10000b5720ad1852b74ea0ea7c62b49ba42717f4
--- include/libc.h
+++ include/libc.h
@@ -904,17 +904,6 @@ extern	int	post9pservice(int, char*);
 #	endif
 #endif
 
-/* this really shouldn't be here */
-#if defined(__OpenBSD__) || (defined(__NetBSD__) && !defined(sched_yield))
-#define sched_yield() \
-	do { \
-		struct timespec ts; \
-		ts.tv_sec = 0; \
-		ts.tv_nsec = 10; \
-		nanosleep(&ts, NULL); \
-	} while(0)
-#endif
-
 /* command line */
 extern char	*argv0;
 extern void __fixargv0(void);
blob - c3f0081fbcec9f2a55677c76256f4adf56843a13
blob + 466f3eab6d2213f940eb74dcbb4d4980706bda78
--- include/u.h
+++ include/u.h
@@ -154,6 +154,7 @@ typedef int32_t s32int;
  * Gcc is too smart for its own good.
  */
 #if defined(__GNUC__)
+#	undef strcmp	/* causes way too many warnings */
 #	if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
 #		undef AUTOLIB
 #		define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
blob - 5da602eb54a8a9112107bc1ca3ea38a3893e498f
blob + 7a5c79fd0f39975319f75313defb330f2e4339e9
--- src/lib9/sleep.c
+++ src/lib9/sleep.c
@@ -1,9 +1,19 @@
 #include <u.h>
 #define NOPLAN9DEFINES
+#include <sys/param.h>
 #include <sys/time.h>
 #include <sched.h>
 #include <libc.h>
 
+#if defined(__NetBSD__) || (defined(__OpenBSD__) && OpenBSD <= 200511)
+#	define sched_yield() \
+#		do{ struct timespec ts; \
+#			ts.tv_sec = 0; \
+#			ts.tv_nsec = 10; \
+#			nanosleep(&ts, 0); \
+#		}while(0)
+#endif
+
 int
 p9sleep(long milli)
 {
blob - 57fd1bd82900f128810c8ee3c691cc9086112a9d
blob + 00af62aae7ae3c0ffa3bedc4a650a03868cdfc90
--- src/libthread/386-ucontext.h
+++ src/libthread/386-ucontext.h
@@ -5,6 +5,8 @@ typedef struct ucontext ucontext_t;
 
 extern	int		swapcontext(ucontext_t*, ucontext_t*);
 extern	void		makecontext(ucontext_t*, void(*)(), int, ...);
+extern	int		getmcontext(mcontext_t*);
+extern	void		setmcontext(mcontetx_t*);
 
 /*-
  * Copyright (c) 1999 Marcel Moolenaar
blob - fdbc712ad6c8b5f007a79b13c896d9ec134503fc
blob + b9e8888e4c193ec6bb9a73d1c102415398414742
--- src/libthread/BSD.c
+++ src/libthread/BSD.c
@@ -33,7 +33,7 @@ _threadlock(Lock *l, int block, ulong pc)
 	for(i=0; i<1000; i++){
 		if(!_tas(&l->held))
 			return 1;
-		sched_yield();
+		sleep(0);
 	}
 	/* increasingly slow */
 	for(i=0; i<10; i++){
blob - 7ffb413c2b2f7bd29985587a404236844c5d86db
blob + 1a59436fa45e281f029c9ebd49b2c0cbec2acaff
--- src/libthread/OpenBSD-386-asm.s
+++ src/libthread/OpenBSD-386-asm.s
@@ -96,4 +96,5 @@ ENTRY(rfork_thread)
 	movl    %ebp, %esp
 	popl    %ebp
 	PIC_PROLOGUE
-	jmp     PIC_PLT(_C_LABEL(__cerror))
\ No newline at end of file
+	jmp     PIC_PLT(_C_LABEL(__cerror))
+