[uClibc-cvs] uClibc/ldso/ldso/m68k dl-syscalls.h,1.7,1.8

Erik Andersen andersen at uclibc.org
Wed May 12 22:54:54 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso/m68k
In directory nail:/tmp/cvs-serv535/ldso/m68k

Modified Files:
	dl-syscalls.h 
Log Message:
Add a local '_dl_errno' to be used by syscalls in ldso, allowing
useful syscall failure diagnostics.


Index: dl-syscalls.h
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/m68k/dl-syscalls.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/dl-syscalls.h	19 Mar 2002 10:43:32 -0000	1.7
+++ b/dl-syscalls.h	12 May 2004 22:54:52 -0000	1.8
@@ -18,6 +18,9 @@
 #define __NR_stat		106
 #define __NR_mprotect		125
 
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
 
 /* Here are the macros which define how this platform makes
  * system calls.  This particular variant does _not_ set 
@@ -31,8 +34,8 @@
 	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
 	/* avoid using res which is declared to be in register d0; \
 	   errno might expand to a function call and clobber it.  */ \
-		/* int __err = -(res); \
-		errno = __err; */ \
+		int __err = -(res); \
+		_dl_errno = __err; \
 		res = -1; \
 	} \
 	return (type) (res); \
@@ -48,8 +51,8 @@
 			: "=g" (__res)					\
 			: "i" (__NR_##name)				\
 			: "cc", "%d0");					\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\
@@ -67,8 +70,8 @@
 			: "i" (__NR_##name),				\
 			  "g" ((long)a)					\
 			: "cc", "%d0", "%d1");				\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\
@@ -88,8 +91,8 @@
 			  "a" ((long)a),				\
 			  "g" ((long)b)					\
 			: "cc", "%d0", "%d1", "%d2");			\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\
@@ -111,8 +114,8 @@
 			  "a" ((long)b),				\
 			  "g" ((long)c)					\
 			: "cc", "%d0", "%d1", "%d2", "%d3");		\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\
@@ -137,8 +140,8 @@
 			  "g" ((long)d)					\
 			: "cc", "%d0", "%d1", "%d2", "%d3",		\
 			  "%d4");					\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\
@@ -165,8 +168,8 @@
 			  "g" ((long)e)					\
 			: "cc", "%d0", "%d1", "%d2", "%d3",		\
 			  "%d4", "%d5");				\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
-    /* errno = -__res; */							\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		\
+    _dl_errno = -__res; 						\
     __res = -1;								\
   }									\
   return (type)__res;							\




More information about the uClibc-cvs mailing list