Skip to content

Commit

Permalink
Enable and fix raidfile intercepts on Mac OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Jun 25, 2017
1 parent 1df1e5f commit c71f02d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/common/BoxPlatform.h
Expand Up @@ -57,7 +57,7 @@
#endif

// Slight hack; disable interception in raidfile test on Darwin and Windows
#if defined __APPLE__ || defined WIN32
#if defined WIN32
// TODO: Replace with autoconf test
#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
#endif
Expand Down
12 changes: 8 additions & 4 deletions lib/intercept/intercept.h
Expand Up @@ -18,11 +18,15 @@
#endif

#if defined __NetBSD_Version__ && __NetBSD_Version__ >= 399000800 //3.99.8 vers.
#define FUNC_OPENDIR "__opendir30"
#define FUNC_READDIR "__readdir30"
# define FUNC_OPENDIR "__opendir30"
# define FUNC_READDIR "__readdir30"
#elif defined __APPLE__
// https://github.com/rust-lang/libc/issues/414#issuecomment-251246205
# define FUNC_OPENDIR "opendir$INODE64"
# define FUNC_READDIR "readdir$INODE64"
#else
#define FUNC_OPENDIR "opendir"
#define FUNC_READDIR "readdir"
# define FUNC_OPENDIR "opendir"
# define FUNC_READDIR "readdir"
#endif

#include <sys/types.h>
Expand Down
6 changes: 3 additions & 3 deletions test/raidfile/testraidfile.cpp
Expand Up @@ -37,7 +37,6 @@
#define TRF_CAN_INTERCEPT
#endif


#ifdef TRF_CAN_INTERCEPT
// function in intercept.cpp for setting up errors
void intercept_setup_error(const char *filename, unsigned int errorafter, int errortoreturn, int syscalltoerror);
Expand Down Expand Up @@ -505,7 +504,8 @@ bool list_matches(const std::vector<std::string> &rList, const char *compareto[]
int count = 0;
while(compareto[count] != 0)
count++;


TEST_EQUAL(rList.size(), count);
if((int)rList.size() != count)
{
return false;
Expand Down Expand Up @@ -538,12 +538,12 @@ bool list_matches(const std::vector<std::string> &rList, const char *compareto[]
{
if(found[c] == false)
{
TEST_FAIL_WITH_MESSAGE("Expected to find " << compareto[c] << " in list");
ret = false;
}
}

delete [] found;

return ret;
}

Expand Down

0 comments on commit c71f02d

Please sign in to comment.