Disable sockets and a few other things when using NACL.
authorElijah Taylor <elijahtaylor@google.com>
Tue, 17 Aug 2010 05:30:16 +0000 (07:30 +0200)
committerZoltan Varga <vargaz@gmail.com>
Tue, 17 Aug 2010 05:30:38 +0000 (07:30 +0200)
mono/metadata/Makefile.am
mono/metadata/console-unix.c
mono/metadata/nacl-stub.c [new file with mode: 0644]
mono/metadata/rand.c
mono/metadata/socket-io.c

index 1d5321f0378bca0e11dafa1c85cf096d7bc5809a..99922b20b9c617449d71ba34d3fa505c480ce950 100644 (file)
@@ -142,6 +142,7 @@ libmonoruntime_la_SOURCES = \
        mono-wsq.h              \
        monitor.c               \
        monitor.h               \
+       nacl-stub.c             \
        normalization-tables.h  \
        null-gc.c               \
        number-formatter.h      \
index 0808baabc2d15bfcc425cb593a5eff22e1397b87..773833deabcd73f42783b41ca20c0ea5e4fffdfc 100644 (file)
@@ -6,6 +6,9 @@
  *
  * Copyright (C) 2005-2009 Novell, Inc. (http://www.novell.com)
  */
+#if defined(__native_client__)
+#include "console-null.c"
+#else
 
 #include <config.h>
 #include <glib.h>
@@ -485,3 +488,5 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow
 
        return TRUE;
 }
+#endif /* #if defined(__native_client__) */
+
diff --git a/mono/metadata/nacl-stub.c b/mono/metadata/nacl-stub.c
new file mode 100644 (file)
index 0000000..83494de
--- /dev/null
@@ -0,0 +1,16 @@
+
+#if defined(__native_client__)
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <eglib/src/glib.h>
+#include <errno.h>
+#include <sys/types.h>
+
+struct group *getgrnam(const char *name) { return NULL; }
+struct group *getgrgid(gid_t gid) { errno=EIO; return NULL; }
+int fsync(int fd) { errno=EINVAL; return -1; }
+dev_t makedev(guint32 maj, guint32 min) { return (maj)*256+(min); }
+
+#endif
index 9b657343ca4eb028dfb144777d745d7486479227..935325ed198af50cf485a5e6d1ad57cdc56fac4c 100644 (file)
 #include <mono/metadata/rand.h>
 #include <mono/metadata/exception.h>
 
+#if defined(__native_client__)
+#include <errno.h>
+
+static void
+get_entropy_from_server (const char *path, guchar *buf, int len)
+{
+    return;
+}
+
+#else /* defined(__native_client__) */
+
 #if !defined(HOST_WIN32)
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -96,6 +107,7 @@ get_entropy_from_server (const char *path, guchar *buf, int len)
     close (file);
 }
 #endif
+#endif /* __native_client__ */
 
 #if defined (HOST_WIN32)
 
index 53dd0d8b13cb13f2c2bf9707771ac059a13b0102..e4c639f7677befe1afb7b9f022fcc30c6747a5f5 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <config.h>
 
+#ifndef DISABLE_SOCKETS
+
 #include <glib.h>
 #include <string.h>
 #include <stdlib.h>
@@ -3075,3 +3077,5 @@ void mono_network_cleanup(void)
        WSACleanup();
 }
 
+
+#endif /* #ifndef DISABLE_SOCKETS */