Revision: 74369 http://trac.macports.org/changeset/74369 Author: jmr@macports.org Date: 2010-12-14 03:05:07 -0800 (Tue, 14 Dec 2010) Log Message: ----------- only use stat64 and friends when available, as per jeremyhu's suggestion on the list Modified Paths: -------------- trunk/base/src/darwintracelib1.0/Makefile trunk/base/src/darwintracelib1.0/darwintrace.c Modified: trunk/base/src/darwintracelib1.0/Makefile =================================================================== --- trunk/base/src/darwintracelib1.0/Makefile 2010-12-14 10:54:46 UTC (rev 74368) +++ trunk/base/src/darwintracelib1.0/Makefile 2010-12-14 11:05:07 UTC (rev 74369) @@ -7,8 +7,6 @@ include ../../Mk/macports.autoconf.mk CFLAGS+= -fPIC -# will need to update this to cope with 64-bit inodes someday -CPPFLAGS+= -D_DARWIN_NO_64_BIT_INODE all:: ${SHLIB_NAME} Modified: trunk/base/src/darwintracelib1.0/darwintrace.c =================================================================== --- trunk/base/src/darwintracelib1.0/darwintrace.c 2010-12-14 10:54:46 UTC (rev 74368) +++ trunk/base/src/darwintracelib1.0/darwintrace.c 2010-12-14 11:05:07 UTC (rev 74369) @@ -38,6 +38,19 @@ #include <config.h> #endif +#if HAVE_SYS_CDEFS_H +#include <sys/cdefs.h> +#endif +#if defined(_DARWIN_FEATURE_64_BIT_INODE) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) +/* The architecture we're building for has multiple versions of stat. + We need to undo sys/cdefs.h changes for _DARWIN_FEATURE_64_BIT_INODE */ +#undef __DARWIN_64_BIT_INO_T +#define __DARWIN_64_BIT_INO_T 0 +#undef __DARWIN_SUF_64_BIT_INO_T +#define __DARWIN_SUF_64_BIT_INO_T "" +#undef _DARWIN_FEATURE_64_BIT_INODE +#endif + #ifdef HAVE_CRT_EXTERNS_H #include <crt_externs.h> #endif @@ -465,8 +478,6 @@ */ static int is_directory(const char * path) { -/* will need to update this to cope with 64-bit inodes someday - for now, we - build with -D_DARWIN_NO_64_BIT_INODE */ #define stat(path, sb) syscall(SYS_stat, path, sb) struct stat s; if(stat(path, &s)==-1) @@ -922,6 +933,8 @@ #undef stat } +#if defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) + int stat64(const char * path, struct stat64 * sb) { #define stat64(path, sb) syscall(SYS_stat64, path, sb) @@ -950,6 +963,9 @@ return stat64(path, sb); } +#endif /* defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */ + + int lstat(const char * path, struct stat * sb) { #define lstat(path, sb) syscall(SYS_lstat, path, sb) @@ -973,6 +989,8 @@ #undef lstat } +#if defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) + int lstat64(const char * path, struct stat64 * sb) { #define lstat64(path, sb) syscall(SYS_lstat64, path, sb) @@ -1000,3 +1018,5 @@ { return lstat64(path, sb); } + +#endif /* defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */
participants (1)
-
jmr@macports.org