OSDN Git Service

Fix bug 370.
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>
Tue, 20 Sep 2005 21:16:25 +0000 (21:16 -0000)
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>
Tue, 20 Sep 2005 21:16:25 +0000 (21:16 -0000)
include/errno.h
libc/sysdeps/linux/powerpc/bits/syscalls.h

index 390e515..203a62e 100644 (file)
@@ -43,8 +43,10 @@ __BEGIN_DECLS
    variable.  This redeclaration using the macro still works, but it
    will be a function declaration without a prototype and may trigger
    a -Wstrict-prototypes warning.  */
-#ifndef        errno
+#ifndef __ASSEMBLER__
+# ifndef       errno
 extern int errno;
+# endif
 #endif
 
 #if 0 /*def __USE_GNU      uClibc note: not supported */
index 75001f2..e28c380 100644 (file)
@@ -5,6 +5,8 @@
 # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
 #endif
 
+#include <errno.h>
+
 /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
  * header files.  It also defines the traditional `SYS_<name>' macros for older
  * programs.  */
@@ -19,7 +21,7 @@
    an error return status).  */
 
 # undef INLINE_SYSCALL
-#if 0
+#if 1
 # define INLINE_SYSCALL(name, nr, args...)                             \
   ({                                                                   \
     INTERNAL_SYSCALL_DECL (sc_err);                                    \
@@ -31,8 +33,7 @@
       }                                                                        \
     sc_ret;                                                            \
   })
-#endif
-
+#else
 # define INLINE_SYSCALL(name, nr, args...)                             \
   ({                                                                   \
     INTERNAL_SYSCALL_DECL (sc_err);                                    \
@@ -43,6 +44,8 @@
       }                                                                        \
     sc_ret;                                                            \
   })
+#endif
+
 /* Define a macro which expands inline into the wrapper code for a system
    call. This use is for internal calls that do not need to handle errors
    normally. It will never touch errno.
 #undef _syscall0
 #define _syscall0(type,name) \
 type name(void){ \
-  return INLINE_SYSCALL(name, 0); \
+  return (type) INLINE_SYSCALL(name, 0); \
 }
 
 #undef _syscall1
 #define _syscall1(type,name,type1,arg1) \
 type name(type1 arg1){  \
-  return INLINE_SYSCALL(name, 1, arg1); \
+  return (type) INLINE_SYSCALL(name, 1, arg1); \
 }
 
 #undef _syscall2
 #define _syscall2(type,name,type1,arg1,type2,arg2) \
 type name(type1 arg1, type2 arg2){      \
-  return INLINE_SYSCALL(name, 2, arg1, arg2); \
+  return (type) INLINE_SYSCALL(name, 2, arg1, arg2); \
 }
 
 #undef _syscall3
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
 type name(type1 arg1, type2 arg2, type3 arg3){  \
-  return INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \
+  return (type) INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \
 }
 
 #undef _syscall4
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4){      \
-  return INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \
+  return (type) INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \
 }
 
 #undef _syscall5
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5){  \
-  return INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \
+  return (type) INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \
 }
 
 #undef _syscall6
 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6){      \
-  return INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \
+  return (type) INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \
 }
 
 #endif /* _BITS_SYSCALLS_H */