* Makefile: cosmetics
* socketmodule.c: get rid of makepair(); fix makesocketaddr to fix
  broken recvfrom()
* socketmodule: get rid of getStrarg()
* ceval.h: move eval_code() to new file eval.h, so compile.h is no
  longer needed.
* ceval.c: move thread comments to ceval.h; always make save/restore
  thread functions available (for dynloaded modules)
* cdmodule.c, listobject.c: don't include compile.h
* flmodule.c: include ceval.h
* import.c: include eval.h instead of ceval.h
* cgen.py: add forground(); noport(); winopen(""); to initgl().
* bltinmodule.c, socketmodule.c, fileobject.c, posixmodule.c,
  selectmodule.c:
  adapt to threads (add BGN/END SAVE macros)
* stdwinmodule.c: adapt to threads and use a special stdwin lock.
* pythonmain.c: don't include getpythonpath().
* pythonrun.c: use BGN/END SAVE instead of direct calls; also more
  BGN/END SAVE calls etc.
* thread.c: bigger stack size for sun; change exit() to _exit()
* threadmodule.c: use BGN/END SAVE macros where possible
* timemodule.c: adapt better to threads; use BGN/END SAVE; add
  longsleep internal function if BSD_TIME; cosmetics
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8ae1758..367e21c 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -73,6 +73,7 @@
 
 #include "allobjects.h"
 #include "modsupport.h"
+#include "ceval.h"
 
 extern char *strerror PROTO((int));
 
@@ -128,9 +129,13 @@
 	int (*func) FPROTO((const char *));
 {
 	char *path1;
+	int res;
 	if (!getstrarg(args, &path1))
 		return NULL;
-	if ((*func)(path1) < 0)
+	BGN_SAVE
+	res = (*func)(path1);
+	END_SAVE
+	if (res < 0)
 		return posix_error();
 	INCREF(None);
 	return None;
@@ -142,9 +147,13 @@
 	int (*func) FPROTO((const char *, const char *));
 {
 	char *path1, *path2;
+	int res;
 	if (!getstrstrarg(args, &path1, &path2))
 		return NULL;
-	if ((*func)(path1, path2) < 0)
+	BGN_SAVE
+	res = (*func)(path1, path2);
+	END_SAVE
+	if (res < 0)
 		return posix_error();
 	INCREF(None);
 	return None;
@@ -157,9 +166,13 @@
 {
 	char *path;
 	int i;
+	int res;
 	if (!getstrintarg(args, &path, &i))
 		return NULL;
-	if ((*func)(path, i) < 0)
+	BGN_SAVE
+	res = (*func)(path, i);
+	END_SAVE
+	if (res < 0)
 		return posix_error();
 	INCREF(None);
 	return None;
@@ -174,9 +187,13 @@
 	struct stat st;
 	char *path;
 	object *v;
+	int res;
 	if (!getstrarg(args, &path))
 		return NULL;
-	if ((*statfunc)(path, &st) != 0)
+	BGN_SAVE
+	res = (*statfunc)(path, &st);
+	END_SAVE
+	if (res != 0)
 		return posix_error();
 	v = newtupleobject(10);
 	if (v == NULL)
@@ -227,10 +244,14 @@
 	object *args;
 {
 	char buf[1026];
+	char *res;
 	extern char *getcwd PROTO((char *, int));
 	if (!getnoarg(args))
 		return NULL;
-	if (getcwd(buf, sizeof buf) == NULL)
+	BGN_SAVE
+	res = getcwd(buf, sizeof buf);
+	END_SAVE
+	if (res == NULL)
 		return posix_error();
 	return newstringobject(buf);
 }
@@ -284,10 +305,14 @@
 	struct direct *ep;
 	if (!getstrarg(args, &name))
 		return NULL;
-	if ((dirp = opendir(name)) == NULL)
+	BGN_SAVE
+	if ((dirp = opendir(name)) == NULL) {
+		RET_SAVE
 		return posix_error();
+	}
 	if ((d = newlistobject(0)) == NULL) {
 		closedir(dirp);
+		RET_SAVE
 		return NULL;
 	}
 	while ((ep = readdir(dirp)) != NULL) {
@@ -306,6 +331,7 @@
 		DECREF(v);
 	}
 	closedir(dirp);
+	END_SAVE
 #endif /* !MSDOS */
 
 	return d;
@@ -368,11 +394,13 @@
 	object *args;
 {
 	char *command;
-	int sts;
+	long sts;
 	if (!getstrarg(args, &command))
 		return NULL;
+	BGN_SAVE
 	sts = system(command);
-	return newintobject((long)sts);
+	END_SAVE
+	return newintobject(sts);
 }
 
 #ifndef MSDOS
@@ -411,9 +439,13 @@
 	extern int uname PROTO((struct utsname *));
 	struct utsname u;
 	object *v;
+	int res;
 	if (!getnoarg(args))
 		return NULL;
-	if (uname(&u) < 0)
+	BGN_SAVE
+	res = uname(&u);
+	END_SAVE
+	if (res < 0)
 		return posix_error();
 	v = newtupleobject(5);
 	if (v == NULL)
@@ -443,6 +475,7 @@
 	object *args;
 {
 	char *path;
+	int res;
 
 #ifdef UTIME_STRUCT
 	struct utimbuf buf;
@@ -459,7 +492,10 @@
 
 	if (!getargs(args, "(s(ll))", &path, &ATIME, &MTIME))
 		return NULL;
-	if (utime(path, UTIME_ARG) < 0)
+	BGN_SAVE
+	res = utime(path, UTIME_ARG);
+	END_SAVE
+	if (res < 0)
 		return posix_error();
 	INCREF(None);
 	return None;
@@ -648,7 +684,9 @@
 	FILE *fp;
 	if (!getargs(args, "(ss)", &name, &mode))
 		return NULL;
+	BGN_SAVE
 	fp = popen(name, mode);
+	END_SAVE
 	if (fp == NULL)
 		return posix_error();
 	/* From now on, ignore SIGPIPE and let the error checking
@@ -664,8 +702,11 @@
 {
 	object *v;
 	int pid, sts;
-	if (args == NULL)
+	if (args == NULL) {
+		BGN_SAVE
 		pid = wait(&sts);
+		END_SAVE
+	}
 	else {
 #ifdef NO_WAITPID
 		err_setstr(PosixError,
@@ -674,7 +715,9 @@
 		int options;
 		if (!getintintarg(args, &pid, &options))
 			return NULL;
+		BGN_SAVE
 		pid = waitpid(pid, &sts, options);
+		END_SAVE
 #endif
 	}
 	if (pid == -1)
@@ -719,7 +762,9 @@
 	int n;
 	if (!getstrarg(args, &path))
 		return NULL;
+	BGN_SAVE
 	n = readlink(path, buf, (int) sizeof buf);
+	END_SAVE
 	if (n < 0)
 		return posix_error();
 	return newsizedstringobject(buf, n);