bits/syscalls.h cleanup

Peter S. Mazinger ps.m at gmx.net
Tue Aug 22 12:42:48 UTC 2006


Hello!

Remove duplicated defines that are already available through errno.h from 
arch/bits/syscalls.h and include errno.h only for !__ASSEMBLER__
This change allows to get proper errno (depending on chosen 
threads/non-threads) and allows bits/syscalls.h (and sys/syscall.h) be 
included in .S files as well.  I have a followup patch correcting errno.h 
and */errno.h if this is applied.

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
-------------- next part --------------
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/alpha/bits/syscalls.h uClibc/libc/sysdeps/linux/alpha/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/alpha/bits/syscalls.h	2006-06-12 17:37:15 +0200
+++ uClibc/libc/sysdeps/linux/alpha/bits/syscalls.h	2006-05-05 00:55:40 +0200
@@ -9,12 +9,10 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #define _syscall_return(type)						\
 	return (_sc_err ? __set_errno(_sc_ret), _sc_ret = -1L : 0), (type) _sc_ret
 
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/arm/bits/syscalls.h uClibc/libc/sysdeps/linux/arm/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/arm/bits/syscalls.h	2006-06-12 17:36:22 +0200
+++ uClibc/libc/sysdeps/linux/arm/bits/syscalls.h	2006-05-15 17:40:42 +0200
@@ -9,9 +9,6 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)	(__NR_##syscall_name)
 #endif
@@ -38,6 +35,8 @@
 #endif
 #else
 
+#include <errno.h>
+
 #undef _syscall0
 #define _syscall0(type,name) \
 type name(void) \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/bfin/bits/syscalls.h uClibc/libc/sysdeps/linux/bfin/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/bfin/bits/syscalls.h	2006-06-15 16:55:54 +0200
+++ uClibc/libc/sysdeps/linux/bfin/bits/syscalls.h	2006-06-15 16:54:30 +0200
@@ -9,16 +9,10 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) ((*__errno_location ()) = (val))
-#endif
-
-#ifndef SYS_ify
-# define SYS_ify(syscall_name)  (__NR_##syscall_name)
-#endif
-
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */
 #if defined _LIBC && !defined __set_errno
 # define __syscall_return(type, res) \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/common/bits/syscalls.h uClibc/libc/sysdeps/linux/common/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/common/bits/syscalls.h	2006-06-12 17:39:28 +0200
+++ uClibc/libc/sysdeps/linux/common/bits/syscalls.h	2006-05-05 00:55:41 +0200
@@ -6,5 +6,5 @@
  */ 
 
 
-#error You have not provided architecture specific _syscall[0-5] macros
+#error You have not provided architecture specific _syscall[0-6] macros
 
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/cris/bits/syscalls.h uClibc/libc/sysdeps/linux/cris/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/cris/bits/syscalls.h	2006-06-12 17:40:26 +0200
+++ uClibc/libc/sysdeps/linux/cris/bits/syscalls.h	2006-05-05 00:55:41 +0200
@@ -8,17 +8,13 @@
 /* Include the __NR_<name> definitions. */
 #include <bits/sysnum.h>
 
-#if 0
-#ifndef __set_errno
-#define __set_errno(val) (*__errno_location()) = (val)
-#endif
-#endif
-
 #undef SYS_ify
 #define SYS_ify(syscall_name)   (__NR_##syscall_name)
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #undef _syscall0
 #define _syscall0(type,name) \
 type name(void) \
@@ -163,5 +159,5 @@
 	ASM_ARGS_5 (r10, r11, r12, r13, mof), "g" (srp)
 #define CHECK_ARGS_asm_6 CHECK_ARGS_asm_5
 
-#endif /* not __ASSEMBLER__ */
+#endif /* !__ASSEMBLER__ */
 #endif /* _BITS_SYSCALLS_H */
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/frv/bits/syscalls.h uClibc/libc/sysdeps/linux/frv/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/frv/bits/syscalls.h	2006-06-12 17:40:09 +0200
+++ uClibc/libc/sysdeps/linux/frv/bits/syscalls.h	2006-05-05 00:55:41 +0200
@@ -15,6 +15,8 @@
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */
 #if defined _LIBC && !defined __set_errno
 # define __syscall_return(type, res) \
@@ -40,10 +42,6 @@
 } while (0)
 #endif
 
-#ifndef __set_errno
-# define __set_errno(val) ((*__errno_location ()) = (val))
-#endif
-
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 
 #define _syscall0(type,name) \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/hppa/bits/syscalls.h uClibc/libc/sysdeps/linux/hppa/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/hppa/bits/syscalls.h	2006-07-03 13:36:10 +0200
+++ uClibc/libc/sysdeps/linux/hppa/bits/syscalls.h	2006-07-03 13:47:16 +0200
@@ -9,12 +9,10 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #define SYS_ify(syscall_name)   __NR_##syscall_name
 
 /* Assume all syscalls are done from PIC code just to be
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/i386/bits/syscalls.h uClibc/libc/sysdeps/linux/i386/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/i386/bits/syscalls.h	2006-06-12 17:39:56 +0200
+++ uClibc/libc/sysdeps/linux/i386/bits/syscalls.h	2006-06-06 22:07:44 +0200
@@ -4,8 +4,6 @@
 # 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.  */
@@ -18,6 +16,8 @@
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* We need some help from the assembler to generate optimal code.  We
    define some macros here which later will be used.  */
 
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/ia64/bits/syscalls.h uClibc/libc/sysdeps/linux/ia64/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/ia64/bits/syscalls.h	2006-06-12 17:40:39 +0200
+++ uClibc/libc/sysdeps/linux/ia64/bits/syscalls.h	2006-05-05 00:55:42 +0200
@@ -31,13 +31,10 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-
-
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #undef IA64_USE_NEW_STUB
 
 #define SYS_ify(syscall_name)   __NR_##syscall_name
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/m68k/bits/syscalls.h uClibc/libc/sysdeps/linux/m68k/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/m68k/bits/syscalls.h	2006-06-12 17:37:37 +0200
+++ uClibc/libc/sysdeps/linux/m68k/bits/syscalls.h	2006-05-05 00:55:42 +0200
@@ -4,8 +4,6 @@
 # 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.  */
@@ -20,6 +18,8 @@
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* Linux takes system call arguments in registers:
 
 	syscall number	%d0	     call-clobbered
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/mips/bits/syscalls.h uClibc/libc/sysdeps/linux/mips/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/mips/bits/syscalls.h	2006-06-12 17:40:50 +0200
+++ uClibc/libc/sysdeps/linux/mips/bits/syscalls.h	2006-05-05 00:55:42 +0200
@@ -9,15 +9,14 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)  (__NR_##syscall_name)
 #endif
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
 	"$14", "$15", "$24", "$25", "memory"
 
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/powerpc/bits/syscalls.h uClibc/libc/sysdeps/linux/powerpc/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/powerpc/bits/syscalls.h	2006-06-12 17:36:42 +0200
+++ uClibc/libc/sysdeps/linux/powerpc/bits/syscalls.h	2006-05-05 00:55:43 +0200
@@ -5,13 +5,15 @@
 # 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.  */
 #include <bits/sysnum.h>
 
+#ifndef __ASSEMBLER__
+
+#include <errno.h>
+
 /* 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.
@@ -164,5 +166,5 @@
   return (type) INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \
 }
 
+#endif /* !__ASSEMBLER__ */
 #endif /* _BITS_SYSCALLS_H */
-
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/sh/bits/syscalls.h uClibc/libc/sysdeps/linux/sh/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/sh/bits/syscalls.h	2006-06-12 17:41:12 +0200
+++ uClibc/libc/sysdeps/linux/sh/bits/syscalls.h	2006-05-05 00:55:43 +0200
@@ -9,15 +9,14 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)  (__NR_##syscall_name)
 #endif
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
 #define __syscall_return(type, res) \
 do { \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/sh64/bits/syscalls.h uClibc/libc/sysdeps/linux/sh64/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/sh64/bits/syscalls.h	2006-06-12 17:36:56 +0200
+++ uClibc/libc/sysdeps/linux/sh64/bits/syscalls.h	2006-05-05 00:55:43 +0200
@@ -9,15 +9,14 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)  (__NR_##syscall_name)
 #endif
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 /* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */
 #define __syscall_return(type, res) \
 do { \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/sparc/bits/syscalls.h uClibc/libc/sysdeps/linux/sparc/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/sparc/bits/syscalls.h	2006-06-12 17:41:06 +0200
+++ uClibc/libc/sysdeps/linux/sparc/bits/syscalls.h	2006-05-05 00:55:43 +0200
@@ -11,12 +11,10 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #undef __SYSCALL_STRING
 #if __WORDSIZE == 32
 # define __SYSCALL_STRING \
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/vax/bits/syscalls.h uClibc/libc/sysdeps/linux/vax/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/vax/bits/syscalls.h	2006-06-12 17:40:14 +0200
+++ uClibc/libc/sysdeps/linux/vax/bits/syscalls.h	2006-05-05 00:55:43 +0200
@@ -9,14 +9,14 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location())=(val)
-#endif
-
 #ifndef SYS_ify
 # define SYS_ify(syscall_name) (__NR_##syscall_name)
 #endif
 
+#ifndef __ASSEMBLER__
+
+#include <errno.h>
+
 #undef _syscall_return
 #define _syscall_return(type)							\
 	do {									\
@@ -261,4 +261,5 @@
 	_syscall_return (type);						\
 }
 
+#endif /* !__ASSEMBLER__ */
 #endif /* _BITS_SYSCALLS_H */
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/vax/clone.S uClibc/libc/sysdeps/linux/vax/clone.S
--- uClibc.orig/libc/sysdeps/linux/vax/clone.S	2006-06-12 17:40:17 +0200
+++ uClibc/libc/sysdeps/linux/vax/clone.S	2006-05-05 00:55:43 +0200
@@ -18,8 +18,6 @@
 /* clone() is even more special than fork() as it mucks with stacks
    and invokes a function in the right context after its all over.  */
 
-#include <features.h>
-#include <bits/errno.h>
 #include <sys/syscall.h>
 
 #warning "This file contains a hardcoded constant for SYS_clone"
diff -urN --exclude .svn --exclude CVS --exclude .cvsignore --exclude nptl --exclude linuxthreads --exclude linuxthreads.old --exclude linuxthreads.old_db uClibc.orig/libc/sysdeps/linux/x86_64/bits/syscalls.h uClibc/libc/sysdeps/linux/x86_64/bits/syscalls.h
--- uClibc.orig/libc/sysdeps/linux/x86_64/bits/syscalls.h	2006-06-12 17:40:19 +0200
+++ uClibc/libc/sysdeps/linux/x86_64/bits/syscalls.h	2006-05-05 00:55:44 +0200
@@ -9,10 +9,6 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-
 /*
    Some of the sneaky macros in the code were taken from 
    glibc-2.2.5/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -20,6 +16,8 @@
 
 #ifndef __ASSEMBLER__
 
+#include <errno.h>
+
 #undef _syscall0
 #define _syscall0(type,name) \
 type name(void) \


More information about the uClibc mailing list