[Box Backup-commit] COMMIT r1229 - in box/chris/merge: lib/common lib/intercept test/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Fri, 29 Dec 2006 17:18:17 +0000


Author: chris
Date: 2006-12-29 17:18:17 +0000 (Fri, 29 Dec 2006)
New Revision: 1229

Modified:
   box/chris/merge/lib/common/BoxPlatform.h
   box/chris/merge/lib/intercept/intercept.h
   box/chris/merge/test/bbackupd/testbbackupd.cpp
Log:
Compile fix for platforms without intercept capability (refs #3)


Modified: box/chris/merge/lib/common/BoxPlatform.h
===================================================================
--- box/chris/merge/lib/common/BoxPlatform.h	2006-12-29 15:31:00 UTC (rev 1228)
+++ box/chris/merge/lib/common/BoxPlatform.h	2006-12-29 17:18:17 UTC (rev 1229)
@@ -51,6 +51,8 @@
 	#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 #endif
 
+	#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
+
 // Disable memory testing under Darwin, it just doesn't like it very much.
 #ifdef __APPLE__
 	// TODO: We really should get some decent leak detection code.

Modified: box/chris/merge/lib/intercept/intercept.h
===================================================================
--- box/chris/merge/lib/intercept/intercept.h	2006-12-29 15:31:00 UTC (rev 1228)
+++ box/chris/merge/lib/intercept/intercept.h	2006-12-29 17:18:17 UTC (rev 1229)
@@ -9,6 +9,7 @@
 
 #ifndef INTERCEPT_H
 #define INTERCEPT_H
+#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 
 #include <dirent.h>
 
@@ -35,8 +36,12 @@
 
 void intercept_setup_error(const char *filename, unsigned int errorafter, 
 	int errortoreturn, int syscalltoerror);
+void intercept_setup_delay(const char *filename, unsigned int delay_after,
+	int delay_ms, int syscall_to_delay, int num_delays);
+bool intercept_triggered();
 
 void intercept_setup_readdir_hook(const char *dirname,  readdir_t hookfn);
 void intercept_setup_lstat_hook  (const char *filename, lstat_t   hookfn);
 
+#endif // !PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 #endif // !INTERCEPT_H

Modified: box/chris/merge/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/merge/test/bbackupd/testbbackupd.cpp	2006-12-29 15:31:00 UTC (rev 1228)
+++ box/chris/merge/test/bbackupd/testbbackupd.cpp	2006-12-29 17:18:17 UTC (rev 1229)
@@ -9,6 +9,7 @@
 
 #include "Box.h"
 
+#include <dirent.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -509,11 +510,6 @@
 	}
 }
 
-void intercept_setup_delay(const char *filename, unsigned int delay_after,
-        int delay_ms, int syscall_to_delay, int num_delays);
-
-bool intercept_triggered();
-
 int start_internal_daemon()
 {
 	// ensure that no child processes end up running tests!
@@ -598,7 +594,9 @@
 
 struct dirent *readdir_test_hook_1(DIR *dir)
 {
+#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 	intercept_setup_readdir_hook(NULL, readdir_test_hook_2);
+#endif
 	return NULL;
 }
 
@@ -609,8 +607,10 @@
 {
 	if (time(NULL) >= readdir_stop_time)
 	{
+#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 		intercept_setup_readdir_hook(NULL, NULL);
 		intercept_setup_lstat_hook  (NULL, NULL);
+#endif
 		// we will not be called again.
 	}
 
@@ -626,7 +626,9 @@
 	snprintf(stat_hook_filename, sizeof(stat_hook_filename),
 		"testfiles/TestDir1/spacetest/d1/test.%d", 
 		readdir_test_counter);
+#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 	intercept_setup_lstat_hook(stat_hook_filename, lstat_test_hook);
+#endif
 
 	return &readdir_test_dirent;
 }