git » libfiu » commit 6611c79

preload: Explicitly define mmap64 instead of using the variant

author Alberto Bertogli
2024-06-28 19:53:55 UTC
committer Alberto Bertogli
2024-06-29 09:05:26 UTC
parent 1410a50e526d6c2ce8b891bf03db9a80b5fbf630

preload: Explicitly define mmap64 instead of using the variant

preload/posix/modules/posix.mm.mod +0 -1
preload/posix/modules/posix64.mm.mod +19 -0
tests/generated/tests/mmap.conf +1 -1
tests/generated/tests/mmap64.conf +1 -1

diff --git a/preload/posix/modules/posix.mm.mod b/preload/posix/modules/posix.mm.mod
index 128b34a..6d96a93 100644
--- a/preload/posix/modules/posix.mm.mod
+++ b/preload/posix/modules/posix.mm.mod
@@ -13,7 +13,6 @@ void *mmap(void *addr, size_t length, int prot, int flags, int fd, \
 	on error: MAP_FAILED
 	valid errnos: EACCES EAGAIN EBADF EINVAL ENFILE ENODEV ENOMEM EPERM \
 		ETXTBSY
-	variants: off64_t
 
 int munmap(void *addr, size_t length);
 	on error: 0
diff --git a/preload/posix/modules/posix64.mm.mod b/preload/posix/modules/posix64.mm.mod
new file mode 100644
index 0000000..2864881
--- /dev/null
+++ b/preload/posix/modules/posix64.mm.mod
@@ -0,0 +1,19 @@
+
+include: <unistd.h>
+include: <errno.h>
+include: <sys/mman.h>
+
+fiu name base: posix/mm/
+
+v: #if LIBFIU_CAN_DEFINE_64BIT_FUNCTIONS && defined _POSIX_MAPPED_FILES
+
+void *mmap64(void *addr, size_t length, int prot, int flags, int fd, \
+		off64_t offset);
+	fiu name: posix/mm/mmap
+	on error: MAP_FAILED
+	valid errnos: EACCES EAGAIN EBADF EINVAL ENFILE ENODEV ENOMEM EPERM \
+		ETXTBSY
+
+v: #endif
+
+
diff --git a/tests/generated/tests/mmap.conf b/tests/generated/tests/mmap.conf
index 6f58885..38ab984 100644
--- a/tests/generated/tests/mmap.conf
+++ b/tests/generated/tests/mmap.conf
@@ -4,7 +4,7 @@ fp: posix/mm/mmap
 include: sys/mman.h unistd.h
 if: defined _POSIX_MAPPED_FILES
 prep: void *p;
-call: p = mmap(NULL, 4092, PROT_READ | PROT_WRITE,
+call: p = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
 		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 success_cond: p != MAP_FAILED
 failure_cond: p == MAP_FAILED
diff --git a/tests/generated/tests/mmap64.conf b/tests/generated/tests/mmap64.conf
index 469a16c..cfe5458 100644
--- a/tests/generated/tests/mmap64.conf
+++ b/tests/generated/tests/mmap64.conf
@@ -5,7 +5,7 @@ defines: #define _FILE_OFFSET_BITS 64
 include: sys/mman.h unistd.h
 if: defined _POSIX_MAPPED_FILES
 prep: void *p;
-call: p = mmap(NULL, 4092, PROT_READ | PROT_WRITE,
+call: p = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
 		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 success_cond: p != MAP_FAILED
 failure_cond: p == MAP_FAILED