Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[pandora-kernel.git] / include / asm-sh / unistd.h
index 05520ce..da127d7 100644 (file)
 
 #define NR_syscalls 293
 
-/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */
+#ifdef __KERNEL__
+
+#include <linux/err.h>
+
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
+ * see <asm-sh/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-124)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* Avoid using "res" which is declared to be in register r0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
@@ -420,7 +425,6 @@ __asm__ __volatile__ ("trapa        #0x16" \
 __syscall_return(type,__sc0); \
 }
 
-#ifdef __KERNEL__
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
@@ -443,7 +447,6 @@ __syscall_return(type,__sc0); \
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
-#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
@@ -513,7 +516,7 @@ asmlinkage long sys_rt_sigaction(int sig,
                                struct sigaction __user *oact,
                                size_t sigsetsize);
 
-#endif
+#endif /* __KERNEL_SYSCALLS__ */
 
 /*
  * "Conditional" syscalls
@@ -525,4 +528,5 @@ asmlinkage long sys_rt_sigaction(int sig,
 #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
 #endif
 
+#endif /* __KERNEL__ */
 #endif /* __ASM_SH_UNISTD_H */