This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Add LOAD_ARG[1-6]_TYPE and x32 posix_fallocate.c


Hi,

Since posix_fallocate passes an additional parameter to fallocate system
call:

int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset, len);

it isi n C.  Here is a patch to add LOAD_ARG[1-6]_TYPE and use it
in x32 posix_fallocate.c.  Tested on Linux/x86-64 and Linux/x32. OK
to install?

Thanks.


H.J.
---
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (LOAD_ARG1_TYPE): New
	macro.
	(LOAD_ARG2_TYPE): Likewise.
	(LOAD_ARG3_TYPE): Likewise.
	(LOAD_ARG4_TYPE): Likewise.
	(LOAD_ARG5_TYPE): Likewise.
	(LOAD_ARG6_TYPE): Likewise.
	(LOAD_ARGS_1): Use LOAD_ARG1_TYPE.
	(LOAD_REGS_1): Likewise.
	(LOAD_ARGS_2): Use LOAD_ARG2_TYPE.
	(LOAD_REGS_2): Likewise.
	(LOAD_ARGS_3): Use LOAD_ARG3_TYPE.
	(LOAD_REGS_3): Likewise.
	(LOAD_ARGS_4): Use LOAD_ARG4_TYPE.
	(LOAD_REGS_4): Likewise.
	(LOAD_ARGS_5): Use LOAD_ARG5_TYPE.
	(LOAD_REGS_5): Likewise.
	(LOAD_ARGS_6): Use LOAD_ARG6_TYPE.
	(LOAD_REGS_6): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c: New file.

diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index aae4cb0..5cecc57 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -285,52 +287,58 @@
 # define LOAD_ARGS_0()
 # define LOAD_REGS_0
 # define ASM_ARGS_0
+# define LOAD_ARG1_TYPE	long int
+# define LOAD_ARG2_TYPE	long int
+# define LOAD_ARG3_TYPE	long int
+# define LOAD_ARG4_TYPE	long int
+# define LOAD_ARG5_TYPE	long int
+# define LOAD_ARG6_TYPE	long int
 
 # define LOAD_ARGS_1(a1)				\
-  long int __arg1 = (long int) (a1);			\
+  LOAD_ARG1_TYPE __arg1 = (LOAD_ARG1_TYPE) (a1);	\
   LOAD_ARGS_0 ()
 # define LOAD_REGS_1					\
-  register long int _a1 asm ("rdi") = __arg1;		\
+  register LOAD_ARG1_TYPE _a1 asm ("rdi") = __arg1;	\
   LOAD_REGS_0
 # define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
 
 # define LOAD_ARGS_2(a1, a2)				\
-  long int __arg2 = (long int) (a2);			\
+  LOAD_ARG2_TYPE __arg2 = (LOAD_ARG2_TYPE) (a2);	\
   LOAD_ARGS_1 (a1)
 # define LOAD_REGS_2					\
-  register long int _a2 asm ("rsi") = __arg2;		\
+  register LOAD_ARG2_TYPE _a2 asm ("rsi") = __arg2;	\
   LOAD_REGS_1
 # define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
 
 # define LOAD_ARGS_3(a1, a2, a3)			\
-  long int __arg3 = (long int) (a3);			\
+  LOAD_ARG3_TYPE __arg3 = (LOAD_ARG3_TYPE) (a3);	\
   LOAD_ARGS_2 (a1, a2)
 # define LOAD_REGS_3					\
-  register long int _a3 asm ("rdx") = __arg3;		\
+  register LOAD_ARG3_TYPE _a3 asm ("rdx") = __arg3;	\
   LOAD_REGS_2
 # define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
 
 # define LOAD_ARGS_4(a1, a2, a3, a4)			\
-  long int __arg4 = (long int) (a4);			\
+  LOAD_ARG4_TYPE __arg4 = (LOAD_ARG4_TYPE) (a4);	\
   LOAD_ARGS_3 (a1, a2, a3)
 # define LOAD_REGS_4					\
-  register long int _a4 asm ("r10") = __arg4;		\
+  register LOAD_ARG4_TYPE _a4 asm ("r10") = __arg4;	\
   LOAD_REGS_3
 # define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
 
 # define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  long int __arg5 = (long int) (a5);			\
+  LOAD_ARG5_TYPE __arg5 = (LOAD_ARG5_TYPE) (a5);	\
   LOAD_ARGS_4 (a1, a2, a3, a4)
 # define LOAD_REGS_5					\
-  register long int _a5 asm ("r8") = __arg5;		\
+  register LOAD_ARG5_TYPE _a5 asm ("r8") = __arg5;	\
   LOAD_REGS_4
 # define ASM_ARGS_5	ASM_ARGS_4, "r" (_a5)
 
 # define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
-  long int __arg6 = (long int) (a6);			\
+  LOAD_ARG6_TYPE __arg6 = (LOAD_ARG6_TYPE) (a6);	\
   LOAD_ARGS_5 (a1, a2, a3, a4, a5)
 # define LOAD_REGS_6					\
-  register long int _a6 asm ("r9") = __arg6;		\
+  register LOAD_ARG6_TYPE _a6 asm ("r9") = __arg6;	\
   LOAD_REGS_5
 # define ASM_ARGS_6	ASM_ARGS_5, "r" (_a6)
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c
new file mode 100644
index 0000000..c4783c7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c
@@ -0,0 +1,15 @@
+#include <sysdep.h>
+
+/* Since posix_fallocate is implemented by calling the fallocate
+   system call with: fallocate (fd, 0, offset, len), we redefine
+   arguments 3 (offset) and 4 (len) to be long long int to match:
+
+   int fallocate(int fd, int mode, off_t offset, off_t len);
+ */
+
+#undef LOAD_ARG3_TYPE
+#define LOAD_ARG3_TYPE long long int
+#undef LOAD_ARG4_TYPE
+#define LOAD_ARG4_TYPE long long int
+
+#include <sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]