summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 01:59:19 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 01:59:19 +0000
commit23f0687386959d7b7fcf4c14e8281fcdfd144c1c (patch)
tree6e4fbcac9cd683053ce363f3a8fb4dcb05417cce
parent77804cf567a704cb9db388c8ddb8a47cc935f7ae (diff)
downloadchromium_src-23f0687386959d7b7fcf4c14e8281fcdfd144c1c.zip
chromium_src-23f0687386959d7b7fcf4c14e8281fcdfd144c1c.tar.gz
chromium_src-23f0687386959d7b7fcf4c14e8281fcdfd144c1c.tar.bz2
[NaCl SDK] Change the kernel_wrap OS #ifdefs in nacl_mounts.
This change allows you to compile all .cc files for nacl-mounts. Previously you need to include compile kernel_wrap.cc, but only copy (not compile) the other kernel_wrap_*.cc files. This is convenient for someone making a visual studio project -- they can just drop all the .cc files into a project and everything "just works". BUG=none R=noelallen@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11744010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175665 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.cc13
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_glibc.cc9
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_newlib.cc8
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_win.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/library.dsc8
5 files changed, 26 insertions, 18 deletions
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.cc b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.cc
index c3d0581..c3a7775 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.cc
@@ -3,19 +3,6 @@
* found in the LICENSE file.
*/
-#include <sys/types.h> // Include something that will define __GLIBC__.
#include "utils/macros.h"
FORCE_LINK_THIS(kernel_wrap)
-
-#if defined(__native_client__)
-# if defined(__GLIBC__)
-# include "kernel_wrap_glibc.cc"
-# else // !__GLIBC__
-# include "kernel_wrap_newlib.cc"
-# endif
-#elif defined(WIN32)
-# include "kernel_wrap_win.cc"
-#else
-# error Kernel wrapping not supported on your platform!
-#endif
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_glibc.cc b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_glibc.cc
index db11423..42e58cc 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_glibc.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_glibc.cc
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <sys/types.h> // Include something that will define __GLIBC__.
+
+// The entire file is wrapped in this #if. We do this so this .cc file can be
+// compiled, even on a non-glibc build.
+#if defined(__native_client__) && defined(__GLIBC__)
+
#include "nacl_mounts/kernel_wrap.h"
#include <alloca.h>
#include <dirent.h>
@@ -14,6 +20,7 @@
#include <sys/stat.h>
#include "nacl_mounts/kernel_intercept.h"
+
namespace {
void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) {
@@ -275,3 +282,5 @@ static struct NaClMountsStaticInitializer {
DO_WRAP(write);
}
} nacl_mounts_static_initializer;
+
+#endif // defined(__native_client__) && defined(__GLIBC__)
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_newlib.cc b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_newlib.cc
index d4cb618..57cbdb3 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_newlib.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_newlib.cc
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <sys/types.h> // Include something that will define __GLIBC__.
+
+// The entire file is wrapped in this #if. We do this so this .cc file can be
+// compiled, even on a non-newlib build.
+#if defined(__native_client__) && !defined(__GLIBC__)
+
#include "nacl_mounts/kernel_wrap.h"
#include <dirent.h>
#include <errno.h>
@@ -161,3 +167,5 @@ static struct NaClMountsStaticInitializer {
DO_WRAP(filename, stat);
}
} nacl_mounts_static_initializer;
+
+#endif // defined(__native_client__) && !defined(__GLIBC__)
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_win.cc b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_win.cc
index 39e3112..12c8010 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_win.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap_win.cc
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+// The entire file is wrapped in this #if. We do this so this .cc file can be
+// compiled, even on a non-Windows build.
+#if defined(WIN32)
+
#include "nacl_mounts/kernel_wrap.h"
#include <errno.h>
#include <fcntl.h>
@@ -216,3 +220,5 @@ int _write(int fd, const void* buf, size_t nbyte) {
}
EXTERN_C_END
+
+#endif // defined(WIN32)
diff --git a/native_client_sdk/src/libraries/nacl_mounts/library.dsc b/native_client_sdk/src/libraries/nacl_mounts/library.dsc
index 3568dde..87c7366 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/library.dsc
+++ b/native_client_sdk/src/libraries/nacl_mounts/library.dsc
@@ -18,6 +18,9 @@
"kernel_object.cc",
"kernel_proxy.cc",
"kernel_wrap.cc",
+ "kernel_wrap_glibc.cc",
+ "kernel_wrap_newlib.cc",
+ "kernel_wrap_win.cc",
"mount.cc",
"mount_dev.cc",
"mount_html5fs.cc",
@@ -76,11 +79,6 @@
'DEST': 'include/utils',
}
],
- 'DATA': [
- "kernel_wrap_glibc.cc",
- "kernel_wrap_newlib.cc",
- "kernel_wrap_win.cc",
- ],
'DEST': 'src',
'NAME': 'nacl_mounts',
}