This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
A patch for _syscall[0-6]
- To: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- Subject: A patch for _syscall[0-6]
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Fri, 9 Mar 2001 14:50:39 -0800
I was told _syscall[0-6] in <asm/unistd.h> were not for user space
applications. But many user space Linux systam packages use them. Here
is a patch to provide them in <sys/syscall.h>.
H.J.
---
2001-03-09 H.J. Lu <hjl@gnu.org>
* sysdeps/unix/sysv/linux/sys/syscall.h: Define _syscall0,
_syscall1, _syscall2, _syscall3, _syscall4, _syscall5 and
_syscall6.
Index: sysdeps/unix/sysv/linux/sys/syscall.h
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/sys/syscall.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 syscall.h
--- sysdeps/unix/sysv/linux/sys/syscall.h 2000/05/21 21:12:01 1.1.1.1
+++ sysdeps/unix/sysv/linux/sys/syscall.h 2001/03/09 22:43:11
@@ -32,4 +32,59 @@
# include <bits/syscall.h>
#endif
+/* We need to define _syscall[0-5] macros for user space applications.
+ The ones in <asm/unstid.h> may not be usable in user space
+ applications. */
+
+#undef _syscall0
+#define _syscall0(type,name) \
+type name(void) \
+{ \
+ return syscall (SYS_##name); \
+}
+
+#undef _syscall1
+#define _syscall1(type,name,type1,arg1) \
+type name(type1 arg1) \
+{ \
+ return syscall (SYS_##name, arg1); \
+}
+
+#undef _syscall2
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
+type name(type1 arg1,type2 arg2) \
+{ \
+ return syscall (SYS_##name, arg1, arg2); \
+}
+
+#undef _syscall3
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
+type name(type1 arg1,type2 arg2,type3 arg3) \
+{ \
+ return syscall (SYS_##name, 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 syscall (SYS_##name, 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 syscall (SYS_##name, 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 syscall (SYS_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
+}
+
#endif