From b532e47e6efcfc8c19d65577892a61cc202f5142 Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 12 Oct 2014 03:53:08 +0000 Subject: [PATCH] On i386-darwin, some POSIX conformant versions of functions have a "$UNIX2003" suffix. We now add this suffix where necessary, as otherwise we link to legacy function versions that may cause bugs. For example, rewinddir(), seekdir() and telldir() did not work when called from emul-handler (at least under OS X 10.6), leading to the root AROS directory not being listable more than once! git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49703 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- .../all-unix/filesys/emul_handler/emul_host_unix.c | 26 +++++++++++----------- arch/all-unix/filesys/emul_handler/unix_hints.h | 25 ++++++++++++++++++++- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/arch/all-unix/filesys/emul_handler/emul_host_unix.c b/arch/all-unix/filesys/emul_handler/emul_host_unix.c index e8200c2170..c36055f2ef 100644 --- a/arch/all-unix/filesys/emul_handler/emul_host_unix.c +++ b/arch/all-unix/filesys/emul_handler/emul_host_unix.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ */ @@ -50,14 +50,14 @@ static const char *libcSymbols[] = { - "open", - "close", - "closedir", - "opendir", + "open" UNIX2003_SUFFIX, + "close" UNIX2003_SUFFIX, + "closedir" UNIX2003_SUFFIX, + "opendir" UNIX2003_SUFFIX, "readdir" INODE64_SUFFIX, - "rewinddir", - "read", - "write", + "rewinddir" UNIX2003_SUFFIX, + "read" UNIX2003_SUFFIX, + "write" UNIX2003_SUFFIX, "lseek", "ftruncate", "mkdir", @@ -67,15 +67,15 @@ static const char *libcSymbols[] = "symlink", "readlink", "rename", - "chmod", + "chmod" UNIX2003_SUFFIX, "isatty", "statfs", "utime", "localtime", - "mktime", + "mktime" UNIX2003_SUFFIX, "getcwd", "getenv", - "poll", + "poll" UNIX2003_SUFFIX, #ifdef HOST_OS_linux "__xstat", "__lxstat", @@ -84,8 +84,8 @@ static const char *libcSymbols[] = "lstat" INODE64_SUFFIX, #endif #ifndef HOST_OS_android - "seekdir", - "telldir", + "seekdir" UNIX2003_SUFFIX, + "telldir" UNIX2003_SUFFIX, "getpwent", "endpwent", #endif diff --git a/arch/all-unix/filesys/emul_handler/unix_hints.h b/arch/all-unix/filesys/emul_handler/unix_hints.h index eaaae3233c..16f7a21d24 100644 --- a/arch/all-unix/filesys/emul_handler/unix_hints.h +++ b/arch/all-unix/filesys/emul_handler/unix_hints.h @@ -1,4 +1,9 @@ /* + Copyright © 1995-2014, The AROS Development Team. All rights reserved. + $Id$ +*/ + +/* * Some really black magic. Adjusts compilation for various UNIX weirdness. * This stuff is placed in a separate file because it needs to be included * before any UNIX headers. @@ -24,13 +29,31 @@ #else -/* +/* * Use 32-bit inode_t on Darwin. Otherwise we are expected to use "stat$INODE64" * instead of "stat" function which is available only on MacOS 10.6. */ #define _DARWIN_NO_64_BIT_INODE #endif +#ifdef HOST_OS_darwin + +#ifdef __i386__ +/* + * Under i386 there are both POSIX-conformant and non-POSIX-conformant + * variants of certain functions, the former suffixed by $UNIX2003. Bugs + * occur if we use non-conformant versions of some functions (e.g. rewinddir() + * doesn't rewind), so we always use the conformant functions where there is a + * choice + */ +#define UNIX2003_SUFFIX "$UNIX2003" +#endif +#endif + #ifndef INODE64_SUFFIX #define INODE64_SUFFIX #endif + +#ifndef UNIX2003_SUFFIX +#define UNIX2003_SUFFIX +#endif -- 2.11.4.GIT