From 1e63f37178748da804aae3a4735fca73dee5d53a Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Mon, 2 Sep 2013 17:15:11 +0200 Subject: Fixed multiple definitions of POSIX file functions Function like stat() were defined for 32bit and 64bit version. Added compile time based selection of appropriate version using GNUC macros __x86_64__ and __ppc64__. --- runtime/POSIX/fd_32.c | 13 +++++++++++++ runtime/POSIX/fd_64.c | 11 +++++++++++ 2 files changed, 24 insertions(+) (limited to 'runtime') diff --git a/runtime/POSIX/fd_32.c b/runtime/POSIX/fd_32.c index 338d9ba2..20587b42 100644 --- a/runtime/POSIX/fd_32.c +++ b/runtime/POSIX/fd_32.c @@ -6,7 +6,18 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// Contains 32bit definitions of posix file functions +//===--- +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENV64 +#else +#define ENV32 +#endif +#endif + +#ifdef ENV32 #define _LARGEFILE64_SOURCE #include "fd.h" @@ -194,3 +205,5 @@ int fstat64(int fd, struct stat64 *buf) __attribute__((weak)); int fstat64(int fd, struct stat64 *buf) { return __fd_fstat(fd, buf); } + +#endif diff --git a/runtime/POSIX/fd_64.c b/runtime/POSIX/fd_64.c index d0710caf..c84599ff 100644 --- a/runtime/POSIX/fd_64.c +++ b/runtime/POSIX/fd_64.c @@ -7,6 +7,15 @@ // //===----------------------------------------------------------------------===// +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENV64 +#else +#define ENV32 +#endif +#endif + +#ifdef ENV64 #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include "fd.h" @@ -88,3 +97,5 @@ int getdents64(unsigned int fd, struct dirent *dirp, unsigned int count) { } int __getdents64(unsigned int fd, struct dirent *dirp, unsigned int count) __attribute__((alias("getdents64"))); + +#endif -- cgit 1.4.1