All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.6-rc3-mm2 [sparc, sparc64, mips syscall broken]
Date: Wed, 5 May 2004 10:33:58 -0700	[thread overview]
Message-ID: <20040505103358.5717d7ee.pj@sgi.com> (raw)
In-Reply-To: <20040505013135.7689e38d.akpm@osdl.org>

She doesn't build for sparc64 either (using crosstool).  And I'd
wager a pretty penny this applies to sparc and mips as well.

The patch kernel-syscalls-retval-fix.patch is missing a bunch of
semicolons.  Several lines that look like:

	__syscall_return(type, __res) \

should instead be:

	__syscall_return(type, __res); \

Here's the 2.6.6-rc3-mm2 kernel-syscalls-retval-fix.patch updated with
this change, for all three sparc, sparc64, and mips.  I am only able to
test build sparc64, and unable to test boot any of this.  With this
change, sparc64 built.

============================ snip ============================



Index: 2.6.6-rc3-mm2/include/asm-alpha/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-alpha/unistd.h	2004-05-05 09:35:45.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-alpha/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -378,8 +378,12 @@
 
 #if defined(__GNUC__)
 
+#ifdef __KERNEL__
+#define _syscall_return(type)	return ((type) _sc_ret)
+#else
 #define _syscall_return(type)						\
 	return (_sc_err ? errno = _sc_ret, _sc_ret = -1L : 0), (type) _sc_ret
+#endif
 
 #define _syscall_clobbers						\
 	"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",			\
Index: 2.6.6-rc3-mm2/include/asm-arm26/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-arm26/unistd.h	2004-05-05 09:33:36.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-arm26/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -277,6 +277,9 @@
 #define __syscall(name) "swi\t" __sys1(__NR_##name) "\n\t"
 #endif
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res)					\
 do {									\
 	if ((unsigned long)(res) >= (unsigned long)(-125)) {		\
@@ -285,6 +288,7 @@
 	}								\
 	return (type) (res);						\
 } while (0)
+#endif
 
 #define _syscall0(type,name)						\
 type name(void) {							\
Index: 2.6.6-rc3-mm2/include/asm-arm/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-arm/unistd.h	2004-05-05 09:33:34.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-arm/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -324,6 +324,9 @@
 #endif
 #endif
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res)					\
 do {									\
 	if ((unsigned long)(res) >= (unsigned long)(-125)) {		\
@@ -332,6 +335,7 @@
 	}								\
 	return (type) (res);						\
 } while (0)
+#endif
 
 #define _syscall0(type,name)						\
 type name(void) {							\
Index: 2.6.6-rc3-mm2/include/asm-h8300/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-h8300/unistd.h	2004-05-05 09:33:42.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-h8300/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -276,6 +276,9 @@
 /* user-visible error numbers are in the range -1 - -122: see
    <asm-m68k/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -287,6 +290,7 @@
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 #define _syscall0(type, name)							\
 type name(void)									\
Index: 2.6.6-rc3-mm2/include/asm-i386/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-i386/unistd.h	2004-05-05 09:33:43.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-i386/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -293,6 +293,9 @@
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -301,6 +304,7 @@
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 #define _syscall0(type,name) \
Index: 2.6.6-rc3-mm2/include/asm-m68knommu/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-m68knommu/unistd.h	2004-05-05 09:33:46.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-m68knommu/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -226,17 +226,18 @@
 /* user-visible error numbers are in the range -1 - -122: see
    <asm-m68k/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	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; \
+		errno = -(res); \
 		res = -1; \
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 #define _syscall0(type, name)							\
 type name(void)									\
@@ -248,11 +249,7 @@
 			: "=g" (__res)						\
 			: "i" (__NR_##name)					\
 			: "cc", "%d0");						\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 #define _syscall1(type, name, atype, a)						\
@@ -267,11 +264,7 @@
 			: "i" (__NR_##name),					\
 			  "g" ((long)a)						\
 			: "cc", "%d0", "%d1");					\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 #define _syscall2(type, name, atype, a, btype, b)				\
@@ -288,11 +281,7 @@
 			  "a" ((long)a),					\
 			  "g" ((long)b)						\
 			: "cc", "%d0", "%d1", "%d2");				\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 #define _syscall3(type, name, atype, a, btype, b, ctype, c)			\
@@ -311,11 +300,7 @@
 			  "a" ((long)b),					\
 			  "g" ((long)c)						\
 			: "cc", "%d0", "%d1", "%d2", "%d3");			\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 #define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d)		\
@@ -337,11 +322,7 @@
 			  "g" ((long)d)						\
 			: "cc", "%d0", "%d1", "%d2", "%d3",			\
 			  "%d4");						\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 #define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e)	\
@@ -365,11 +346,7 @@
 			  "g" ((long)e)						\
 			: "cc", "%d0", "%d1", "%d2", "%d3",			\
 			  "%d4", "%d5");					\
-  if ((unsigned long)(__res) >= (unsigned long)(-125)) {				\
-    errno = -__res;								\
-    __res = -1;									\
-  }										\
-  return (type)__res;								\
+  __syscall_return(type, __res);						\
 }
 
 
Index: 2.6.6-rc3-mm2/include/asm-m68k/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-m68k/unistd.h	2004-05-05 09:33:46.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-m68k/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -244,6 +244,9 @@
 /* user-visible error numbers are in the range -1 - -124: see
    <asm-m68k/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -255,6 +258,7 @@
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 #define _syscall0(type,name) \
 type name(void) \
Index: 2.6.6-rc3-mm2/include/asm-mips/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-mips/unistd.h	2004-05-05 09:35:58.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-mips/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -820,6 +820,16 @@
 
 #ifndef __ASSEMBLY__
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
+do { \
+	if (__a3 == 0) \
+		return (type)(res); \
+	errno = res; \
+	return -1; \
+} while (0)
+
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 #define _syscall0(type,name) \
 type name(void) \
@@ -837,10 +847,7 @@
 	: "i" (__NR_##name) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 /*
@@ -864,10 +871,7 @@
 	: "r" (__a0), "i" (__NR_##name) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #define _syscall2(type,name,atype,a,btype,b) \
@@ -888,10 +892,7 @@
 	: "r" (__a0), "r" (__a1), "i" (__NR_##name) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
@@ -913,10 +914,7 @@
 	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
@@ -938,10 +936,7 @@
 	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #if (_MIPS_SIM == _MIPS_SIM_ABI32)
@@ -974,10 +969,7 @@
 	  "m" ((unsigned long)e) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
@@ -1006,10 +998,7 @@
 	  "m" ((unsigned long)e), "m" ((unsigned long)f) \
 	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
@@ -1036,10 +1025,7 @@
 	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
 	: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
@@ -1064,10 +1050,7 @@
 	  "i" (__NR_##name) \
 	: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
 	\
-	if (__a3 == 0) \
-		return (type) __v0; \
-	errno = __v0; \
-	return -1; \
+	__syscall_return(type, __v0); \
 }
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
Index: 2.6.6-rc3-mm2/include/asm-parisc/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-parisc/unistd.h	2004-05-05 09:33:49.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-parisc/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -739,6 +739,17 @@
 
 #define SYS_ify(syscall_name)   __NR_##syscall_name
 
+#ifdef __KERNEL__
+#define __syscall_return __sys_res
+#else
+#define __syscall_return					\
+        if (__sys_res >= (unsigned long)-4095) {		\
+		errno = -__sys_res;				\
+                __sys_res = (unsigned long)-1;			\
+        }							\
+        __sys_res;						\
+#endif
+
 /* The system call number MUST ALWAYS be loaded in the delay slot of
    the ble instruction, or restarting system calls WILL NOT WORK.  See
    arch/parisc/kernel/signal.c - dhd, 2000-07-26 */
@@ -755,11 +766,7 @@
 			  );                                    \
                 __sys_res = __res;                              \
         }                                                       \
-        if (__sys_res >= (unsigned long)-4095) {                \
-		errno = -__sys_res;				\
-                __sys_res = (unsigned long)-1;                 \
-        }                                                       \
-        __sys_res;                                              \
+	__syscall_return					\
 })
 
 #define K_LOAD_ARGS_0()
Index: 2.6.6-rc3-mm2/include/asm-ppc64/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-ppc64/unistd.h	2004-05-05 09:33:51.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-ppc64/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -286,6 +286,19 @@
 
 #ifndef __ASSEMBLY__
 
+#ifdef __KERNEL__
+#define __syscall_return						\
+	if (__sc_err & 0x10000000)					\
+		__sc_ret = - __sc_ret;
+#else
+#define __syscall_return						\
+	if (__sc_err & 0x10000000)					\
+	{								\
+		errno = __sc_ret;					\
+		__sc_ret = -1;						\
+	}
+#endif
+
 /* On powerpc a system call basically clobbers the same registers like a
  * function call, with the exception of LR (which is needed for the
  * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
@@ -317,11 +330,7 @@
 		__sc_ret = __sc_3;					\
 		__sc_err = __sc_0;					\
 	}								\
-	if (__sc_err & 0x10000000)					\
-	{								\
-		errno = __sc_ret;					\
-		__sc_ret = -1;						\
-	}								\
+	__syscall_return						\
 	return (type) __sc_ret
 
 #define __sc_loadargs_0(name, dummy...)					\
Index: 2.6.6-rc3-mm2/include/asm-ppc/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-ppc/unistd.h	2004-05-05 09:33:49.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-ppc/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -277,6 +277,19 @@
 
 #define __NR(n)	#n
 
+#ifdef __KERNEL__
+#define __syscall_return						\
+	if (__sc_err & 0x10000000)					\
+		__sc_ret = - __sc_ret;
+#else
+#define __syscall_return						\
+	if (__sc_err & 0x10000000)					\
+	{								\
+		errno = __sc_ret;					\
+		__sc_ret = -1;						\
+	}
+#endif
+
 /* On powerpc a system call basically clobbers the same registers like a
  * function call, with the exception of LR (which is needed for the
  * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
@@ -307,11 +320,7 @@
 		__sc_ret = __sc_3;					\
 		__sc_err = __sc_0;					\
 	}								\
-	if (__sc_err & 0x10000000)					\
-	{								\
-		errno = __sc_ret;					\
-		__sc_ret = -1;						\
-	}								\
+	__syscall_return						\
 	return (type) __sc_ret
 
 #define __sc_loadargs_0(name, dummy...)					\
Index: 2.6.6-rc3-mm2/include/asm-s390/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-s390/unistd.h	2004-05-05 09:35:45.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-s390/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -360,6 +360,9 @@
 
 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res)			     \
 do {							     \
 	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -368,6 +371,7 @@
 	}						     \
 	return (type) (res);				     \
 } while (0)
+#endif
 
 #define _svc_clobber "1", "cc", "memory"
 
Index: 2.6.6-rc3-mm2/include/asm-sh/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-sh/unistd.h	2004-05-05 09:33:51.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-sh/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -286,6 +286,9 @@
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-124)) { \
@@ -297,6 +300,7 @@
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 #define _syscall0(type,name) \
Index: 2.6.6-rc3-mm2/include/asm-sparc64/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-sparc64/unistd.h	2004-05-05 09:33:53.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-sparc64/unistd.h	2004-05-05 10:02:44.000000000 -0700
@@ -303,6 +303,16 @@
  *          find a free slot in the 0-282 range.
  */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
+#define __syscall_return(type, res)		\
+	if (res >= 0)				\
+		return (type)res;		\
+	errno = -res;				\
+	return -1;
+#endif
+
 #define _syscall0(type,name) \
 type name(void) \
 { \
@@ -314,10 +324,7 @@
 		      : "=r" (__res)\
 		      : "r" (__g1) \
 		      : "o0", "cc"); \
-if (__res >= 0) \
-    return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall1(type,name,type1,arg1) \
@@ -332,10 +339,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__g1) \
 		      : "cc"); \
-if (__res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall2(type,name,type1,arg1,type2,arg2) \
@@ -351,10 +355,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__g1) \
 		      : "cc"); \
-if (__res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
@@ -371,10 +372,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
 		      : "cc"); \
-if (__res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -392,10 +390,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
 		      : "cc"); \
-if (__res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 } 
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
@@ -415,10 +410,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
 		      : "cc"); \
-if (__res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 #ifdef __KERNEL_SYSCALLS__
 
Index: 2.6.6-rc3-mm2/include/asm-sparc/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-sparc/unistd.h	2004-05-05 09:33:52.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-sparc/unistd.h	2004-05-05 10:02:24.000000000 -0700
@@ -302,6 +302,16 @@
  *          find a free slot in the 0-282 range.
  */
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
+#define __syscall_return(type, res)		\
+	if (res < -255 || res >= 0)		\
+		return (type)res;		\
+	errno = -res;				\
+	return -1;
+#endif
+
 #define _syscall0(type,name) \
 type name(void) \
 { \
@@ -315,10 +325,7 @@
 		      : "=r" (__res)\
 		      : "r" (__g1) \
 		      : "o0", "cc"); \
-if (__res < -255 || __res >= 0) \
-    return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall1(type,name,type1,arg1) \
@@ -335,10 +342,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__g1) \
 		      : "cc"); \
-if (__res < -255 || __res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall2(type,name,type1,arg1,type2,arg2) \
@@ -356,10 +360,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__g1) \
 		      : "cc"); \
-if (__res < -255 || __res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
@@ -378,10 +379,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
 		      : "cc"); \
-if (__res < -255 || __res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -401,10 +399,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
 		      : "cc"); \
-if (__res < -255 || __res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 } 
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
@@ -426,10 +421,7 @@
 		      : "=r" (__res), "=&r" (__o0) \
 		      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
 		      : "cc"); \
-if (__res < -255 || __res>=0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+	__syscall_return(type, __res); \
 }
 #ifdef __KERNEL_SYSCALLS__
 
Index: 2.6.6-rc3-mm2/include/asm-v850/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-v850/unistd.h	2004-05-05 09:33:54.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-v850/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -245,6 +245,9 @@
 #define __builtin_expect(x, expected_value) (x)
 #endif
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res)					      \
   do {									      \
 	  /* user-visible error numbers are in the range -1 - -124:	      \
@@ -255,7 +258,7 @@
 	  }								      \
 	  return (type) (res);						      \
   } while (0)
-
+#endif
 
 #define _syscall0(type, name)						      \
 type name (void)							      \
Index: 2.6.6-rc3-mm2/include/asm-x86_64/unistd.h
===================================================================
--- 2.6.6-rc3-mm2.orig/include/asm-x86_64/unistd.h	2004-05-05 09:35:55.000000000 -0700
+++ 2.6.6-rc3-mm2/include/asm-x86_64/unistd.h	2004-05-05 09:36:24.000000000 -0700
@@ -560,6 +560,9 @@
 
 #define __syscall_clobber "r11","rcx","memory" 
 
+#ifdef __KERNEL__
+#define __syscall_return(type, res) return ((type)(res))
+#else
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-127)) { \
@@ -568,6 +571,7 @@
 	} \
 	return (type) (res); \
 } while (0)
+#endif
 
 #ifndef __KERNEL_SYSCALLS__
 
============================ snip ============================


-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

  parent reply	other threads:[~2004-05-05 17:35 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-05  8:31 2.6.6-rc3-mm2 Andrew Morton
2004-05-05  8:46 ` 2.6.6-rc3-mm2 Fabio Coatti
2004-05-05  9:07 ` 2.6.6-rc3-mm2 Onur Kucuk
2004-05-05 11:12 ` 2.6.6-rc3-mm2 (4KSTACK) Dominik Karall
2004-05-05 11:10   ` Ralf Hildebrandt
2004-05-05 11:13   ` Jan-Benedict Glaw
2004-05-05 11:24   ` Arjan van de Ven
2004-05-05 11:30   ` Andrew Morton
2004-05-05 12:09     ` Rene Herman
2004-05-05 16:47     ` Steve Lord
2004-05-05 18:48       ` Felipe Alfaro Solana
2004-05-05 19:51       ` Arjan van de Ven
2004-05-05 19:56         ` Steve Lord
2004-05-05 19:59         ` Arjan van de Ven
2004-05-06 17:44       ` Max Valdez
2004-05-05 20:31     ` Bill Davidsen
2004-05-05 23:04       ` Bartlomiej Zolnierkiewicz
2004-05-06 12:55         ` Norberto Bensa
2004-05-06 13:33           ` Bartlomiej Zolnierkiewicz
2004-05-06 18:47             ` Norberto Bensa
2004-05-09 17:00         ` Bill Davidsen
2004-05-09 18:25           ` Bartlomiej Zolnierkiewicz
2004-05-11 16:24             ` Bill Davidsen
2004-05-11 23:27               ` Bartlomiej Zolnierkiewicz
2004-05-11 23:50                 ` Andrew Morton
2004-05-12  0:05                   ` Valdis.Kletnieks
2004-05-12 16:07                   ` Bill Davidsen
2004-05-12 16:20                     ` Arjan van de Ven
2004-05-15 19:48                       ` Bill Davidsen
2004-05-06 10:09       ` Helge Hafting
2004-05-06 12:54         ` Bill Davidsen
2004-05-05 18:22   ` Valdis.Kletnieks
2004-05-05 21:51     ` Jörn Engel
2004-05-06 15:18       ` Valdis.Kletnieks
2004-05-06 15:40         ` Arjan van de Ven
2004-05-06 16:29           ` Valdis.Kletnieks
2004-05-07  9:50             ` Helge Hafting
2004-05-07  0:37           ` Paul Jakma
2004-05-07  2:50             ` Andrew Morton
2004-05-07  3:44               ` Paul Jakma
2004-05-07  3:58                 ` Andrew Morton
2004-05-07  7:05                   ` Arjan van de Ven
2004-05-07 15:26                   ` Martin J. Bligh
2004-05-07 19:41                     ` Andrew Morton
2004-05-07  6:51             ` Arjan van de Ven
2004-05-07 15:13               ` Dave Jones
2004-05-07 15:47                 ` Steve Lord
2004-05-07 15:59                   ` Arjan van de Ven
2004-05-07 16:09                     ` J. Bruce Fields
2004-05-07 16:11                     ` Steve Lord
2004-05-07 16:28                       ` Jörn Engel
2004-05-07 19:45               ` Paul Jakma
2004-05-07 19:48                 ` Paul Jakma
2004-05-10 19:49           ` Bill Davidsen
2004-05-10 20:31             ` Horst von Brand
2004-05-11  2:39               ` Andrew Morton
2004-05-11  8:45             ` Helge Hafting
2004-05-11 17:59               ` several messages Bill Davidsen
2004-05-06 16:03         ` 2.6.6-rc3-mm2 (4KSTACK) Malte Schröder
2004-05-06 16:13           ` Valdis.Kletnieks
2004-05-06 17:05         ` Matt Mackall
2004-05-05 13:31 ` 2.6.6-rc3-mm2 [delete-posix-...-unifix-message] Paul Jackson
2004-05-05 15:33 ` 2.6.6-rc3-mm2 Christoph Hellwig
2004-05-05 17:59   ` 2.6.6-rc3-mm2 Arnd Bergmann
2004-05-05 16:06 ` 2.6.6-rc3-mm2 Paul Jackson
2004-05-05 16:40   ` 2.6.6-rc3-mm2 Christoph Hellwig
2004-05-05 16:49     ` 2.6.6-rc3-mm2 Paul Jackson
2004-05-05 20:16   ` 2.6.6-rc3-mm2 R. J. Wysocki
2004-05-06  1:51     ` 2.6.6-rc3-mm2 Paul Jackson
2004-05-06 19:38       ` 2.6.6-rc3-mm2 R. J. Wysocki
2004-05-05 17:10 ` 2.6.6-rc3-mm2 (compile stats) John Cherry
2004-05-05 17:33 ` Paul Jackson [this message]
2004-05-05 23:29 ` 2.6.6-rc3-mm2: vermagic compile error if CONFIG_MODULES=n Adrian Bunk
2004-05-06 14:53 ` 2.6.6-rc3-mm2 Antonio Dolcetta
2004-05-06 15:12   ` 2.6.6-rc3-mm2 Andrew Morton
2004-05-06 15:56     ` 2.6.6-rc3-mm2 Antonio Dolcetta
2004-05-06 17:26       ` 2.6.6-rc3-mm2 Adrian Bunk
2004-05-06 21:46 ` 2.6.6-rc3-mm2 Bruce Guenter
2004-05-07  2:52   ` 2.6.6-rc3-mm2 Andrew Morton
2004-05-07  4:16     ` 2.6.6-rc3-mm2 Rusty Russell
2004-05-07 16:05       ` 2.6.6-rc3-mm2 Bruce Guenter
2004-05-07 20:13       ` 2.6.6-rc3-mm2 R. J. Wysocki
2004-05-08  6:09         ` 2.6.6-rc3-mm2 Andrew Morton
     [not found]           ` <200405081329.43017.rjwysocki@sisk.pl>
2004-05-08 11:31             ` 2.6.6-rc3-mm2 Andrew Morton
2004-05-08 16:25               ` 2.6.6-rc3-mm2 R. J. Wysocki
2004-05-08 11:43             ` 2.6.6-rc3-mm2 Andrew Morton
2004-05-08 12:16               ` 2.6.6-rc3-mm2 R. J. Wysocki
2004-05-08 16:59           ` 2.6.6-rc3-mm2 Bruce Guenter
2004-05-08 18:46             ` 2.6.6-rc3-mm2 Andrew Morton
2004-05-08 18:31 ` 2.6.6-rc3-mm2 Joseph Fannin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040505103358.5717d7ee.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.