sunos fixes
diff --git a/include/u.h b/include/u.h
index b7319ae..df82ac5 100644
--- a/include/u.h
+++ b/include/u.h
@@ -6,6 +6,7 @@
 
 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
 #define __EXTENSIONS__ 1 /* SunOS */
+#define __MAKECONTEXT_V2_SOURCE 1 /* SunOS */
 #define _BSD_SOURCE 1
 #define _SVID_SOURCE 1
 #define _XOPEN_SOURCE 1000
diff --git a/src/cmd/draw/colors.c b/src/cmd/draw/colors.c
index d623f4e..130067f 100644
--- a/src/cmd/draw/colors.c
+++ b/src/cmd/draw/colors.c
@@ -106,7 +106,7 @@
 		exits("usage");
 	}
 
-	if(initdraw(nil, nil, "colors") < 0)
+	if(initdraw(0, 0, "colors") < 0)
 		sysfatal("initdraw failed: %r");
 	einit(Emouse);
 
diff --git a/src/lib9/fmt/dofmt.c b/src/lib9/fmt/dofmt.c
index d516631..97bbc92 100644
--- a/src/lib9/fmt/dofmt.c
+++ b/src/lib9/fmt/dofmt.c
@@ -78,7 +78,6 @@
 		if(fmt == nil)
 			return -1;
 	}
-	return 0;	/* not reached */
 }
 
 void *
diff --git a/src/lib9/fmt/strtod.c b/src/lib9/fmt/strtod.c
index bef81f0..fbc1c59 100644
--- a/src/lib9/fmt/strtod.c
+++ b/src/lib9/fmt/strtod.c
@@ -377,7 +377,6 @@
 		a++;
 	cont:;
 	}
-	return 0;
 }
 
 static void
diff --git a/src/lib9/qlock.c b/src/lib9/qlock.c
index a979c44..7d9d064 100644
--- a/src/lib9/qlock.c
+++ b/src/lib9/qlock.c
@@ -100,7 +100,6 @@
 		l->readers++;
 		return 1;
 	}
-	return 1;
 }
 
 void
diff --git a/src/lib9/utf/utflen.c b/src/lib9/utf/utflen.c
index 56f65fe..769805a 100644
--- a/src/lib9/utf/utflen.c
+++ b/src/lib9/utf/utflen.c
@@ -34,5 +34,4 @@
 			s += chartorune(&rune, s);
 		n++;
 	}
-	return 0;
 }
diff --git a/src/lib9/utf/utfrrune.c b/src/lib9/utf/utfrrune.c
index 63f0c43..cff12b5 100644
--- a/src/lib9/utf/utfrrune.c
+++ b/src/lib9/utf/utfrrune.c
@@ -42,5 +42,4 @@
 			s1 = s;
 		s += c1;
 	}
-	return 0;
 }
diff --git a/src/lib9/utf/utfrune.c b/src/lib9/utf/utfrune.c
index c954c78..52b8359 100644
--- a/src/lib9/utf/utfrune.c
+++ b/src/lib9/utf/utfrune.c
@@ -41,5 +41,4 @@
 			return s;
 		s += n;
 	}
-	return 0;
 }
diff --git a/src/libString/s_getline.c b/src/libString/s_getline.c
index e46dc12..86c9bf0 100644
--- a/src/libString/s_getline.c
+++ b/src/libString/s_getline.c
@@ -68,5 +68,4 @@
 		}
 		c = Bgetc(fp);
 	}
-	return 0;
 }
diff --git a/src/libbio/brdstr.c b/src/libbio/brdstr.c
index b3612a5..52baf51 100644
--- a/src/libbio/brdstr.c
+++ b/src/libbio/brdstr.c
@@ -108,5 +108,4 @@
 		bp->icount = 0;
 		bp->gbuf = bp->ebuf;
 	}
-	return 0;	/* never happens */
 }
diff --git a/src/libdraw/x11-draw.c b/src/libdraw/x11-draw.c
index b80bd2e..0ccd8c0 100644
--- a/src/libdraw/x11-draw.c
+++ b/src/libdraw/x11-draw.c
@@ -115,7 +115,7 @@
 		}else{
 			/* this doesn't work on rob's mac?  */
 			return 0;
-			gc = _x.gcsimplesrc;
+			/* gc = _x.gcsimplesrc;
 			if(dst->chan == CMAP8 && _x.usetable)
 				sdval = _x.tox11[sdval];
 
@@ -127,6 +127,7 @@
 				XSetStipple(_x.display, gc, xmask->pixmap);
 				_x.gcsimplesrcpixmap = xmask->pixmap;
 			}
+			*/
 		}
 		XSetTSOrigin(_x.display, gc, mp.x, mp.y);
 		XFillRectangle(_x.display, xdst->pixmap, gc, dp.x, dp.y,
diff --git a/src/libthread/pthread.c b/src/libthread/pthread.c
index 38eb7d7..dbeda7e 100644
--- a/src/libthread/pthread.c
+++ b/src/libthread/pthread.c
@@ -74,7 +74,7 @@
 		r->asleep = 0;
 		pthread_cond_signal(&r->cond);
 	}
-	unlock(&r->l);
+	unlock(r->l);
 }
 
 static void
@@ -85,7 +85,7 @@
 	Proc *p;
 
 	a = (void**)v;
-	fn = a[0];
+	fn = (void(*)(void*))a[0];
 	p = a[1];
 	free(a);
 	p->osprocid = pthread_self();
@@ -104,7 +104,7 @@
 	a = malloc(2*sizeof a[0]);
 	if(a == nil)
 		sysfatal("_procstart malloc: %r");
-	a[0] = fn;
+	a[0] = (void*)fn;
 	a[1] = p;
 
 	if(pthread_create(&p->osprocid, nil, (void*(*)(void*))startprocfn, (void*)a) < 0){
diff --git a/src/libthread/sysofiles.sh b/src/libthread/sysofiles.sh
index 7734f77..83b8355 100644
--- a/src/libthread/sysofiles.sh
+++ b/src/libthread/sysofiles.sh
@@ -8,7 +8,13 @@
 *-FreeBSD-5.*)
 	echo pthread.o
 	;;
-*)
+*-Linux-*)
 	echo `uname`.o `uname`asm.o
+	;;
+*-FreeBSD-*)
+	echo `uname`.o `uname`asm.o
+	;;
+*)
+	echo pthread.o
 esac