Index: native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..419b634ad1e2d798fc3e80b462dfc74354cd00a4 |
--- /dev/null |
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc |
@@ -0,0 +1,76 @@ |
+#if defined WIN32 || defined __linux__ |
binji
2013/11/15 17:26:23
copyright
binji
2013/11/15 17:26:23
in the other files we use defined(...)
Sam Clegg
2013/11/15 18:13:34
Done.
Sam Clegg
2013/11/15 18:13:34
Done.
|
+ |
+#include <errno.h> |
+ |
+#include "nacl_io/kernel_wrap.h" |
+#include "nacl_io/kernel_wrap_real.h" |
+ |
+// "real" functions, i.e. the unwrapped original functions. On Windows we don't |
binji
2013/11/15 17:26:23
change comment?
Sam Clegg
2013/11/15 18:13:34
Done.
|
+// wrap, so the real functions aren't accessible. In most cases, we just fail. |
+ |
binji
2013/11/15 17:26:23
The linux host implementation is a bit different t
|
+int _real_close(int fd) { |
+ return ENOSYS; |
+} |
+ |
+int _real_fstat(int fd, struct stat *buf) { |
+ return 0; |
+} |
+ |
+int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t *nread) { |
+ return ENOSYS; |
+} |
+ |
+int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { |
+ return ENOSYS; |
+} |
+ |
+int _real_mkdir(const char* pathname, mode_t mode) { |
+ return ENOSYS; |
+} |
+ |
+int _real_mmap(void** addr, size_t length, int prot, int flags, int fd, |
+ off_t offset) { |
+ return ENOSYS; |
+} |
+ |
+int _real_munmap(void* addr, size_t length) { |
+ return ENOSYS; |
+} |
+ |
+int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) { |
+ return ENOSYS; |
+} |
+ |
+int _real_open_resource(const char* file, int* fd) { |
+ return ENOSYS; |
+} |
+ |
+int _real_read(int fd, void *buf, size_t count, size_t *nread) { |
+ *nread = count; |
+ return 0; |
+} |
+ |
+int _real_rmdir(const char* pathname) { |
+ return ENOSYS; |
+} |
+ |
+int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) { |
+ int rtn = write(fd, buf, count); |
+ if (rtn < 0) |
+ return -1; |
+ |
+ *nwrote = rtn; |
+ return 0; |
+} |
+ |
+#endif |
+ |
+#ifdef __linux__ |
+ |
+void kernel_wrap_init() { |
+} |
+ |
+void kernel_wrap_uninit() { |
+} |
+ |
+#endif |