PERFORCE change 65504 for review

David Xu davidxu at FreeBSD.org
Fri Nov 19 20:02:13 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=65504

Change 65504 by davidxu at davidxu_alona on 2004/11/20 04:01:43

	1. simplify code. 2. undef errno.

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 edit

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 (text+ko) ====

@@ -37,22 +37,16 @@
 #include "libc_private.h"
 #include "thr_private.h"
 
+#undef errno
 extern	int	errno;
 
 int *
 __error(void)
 {
-	struct pthread *curthread;
+	struct pthread *curthread = _get_curthread();
 
-	if (__isthreaded == 0)
+	if (curthread != NULL && curthread != _thr_initial)
+		return (&curthread->error);
+	else
 		return (&errno);
-	else if (_kse_in_critical())
-		return &(_get_curkse()->k_error);
-	else {
-		curthread = _get_curthread();
-		if ((curthread == NULL) || (curthread == _thr_initial))
-			return (&errno);
-		else
-			return (&curthread->error);
-	}
 }


More information about the p4-projects mailing list