2009-02-02 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 3 Feb 2009 00:17:44 +0000 (00:17 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 3 Feb 2009 00:17:44 +0000 (00:17 -0000)
From Paolo's work, refactored, cleared up:

* threadpool.c, icall.c: ifdef code that requires a working socket
stack.

* metadata.c (mono_metadata_field_info): Do not attempt to return
a value from a function declared as void.

* console-io.c: Use MONO_NULL_TTYDRIVER to remove the tty driver
from the console stack.

* assembly.c: use strrchr instead of rindex.

* class.c, object.c, marshal.c, icall.c, reflection.c: include
alloca.h on systems that have it.

* environment.c: Avoid code that uses stuff from
HAVE_SYS_UTSNAME_H

* appdomain.c: Include sys/time.h.

* console-io.c: include sys/ioctl.h if it is available.

svn path=/trunk/mono/; revision=125449

12 files changed:
mono/metadata/ChangeLog
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/class.c
mono/metadata/console-io.c
mono/metadata/environment.c
mono/metadata/icall.c
mono/metadata/marshal.c
mono/metadata/metadata.c
mono/metadata/object.c
mono/metadata/reflection.c
mono/metadata/threadpool.c

index 7ffc947b7e8b1e86034e89cdf4a4de8fe00b3323..6d130a660b6f8f50dd45d5c05c34c8d16809fc24 100644 (file)
@@ -1,3 +1,28 @@
+2009-02-02  Miguel de Icaza  <miguel@novell.com>
+
+       From Paolo's work, refactored, cleared up:
+       
+       * threadpool.c, icall.c: ifdef code that requires a working socket
+       stack.
+
+       * metadata.c (mono_metadata_field_info): Do not attempt to return
+       a value from a function declared as void.
+
+       * console-io.c: Use MONO_NULL_TTYDRIVER to remove the tty driver
+       from the console stack.
+
+       * assembly.c: use strrchr instead of rindex.
+
+       * class.c, object.c, marshal.c, icall.c, reflection.c: include
+       alloca.h on systems that have it.
+
+       * environment.c: Avoid code that uses stuff from
+       HAVE_SYS_UTSNAME_H
+       
+       * appdomain.c: Include sys/time.h.
+
+       * console-io.c: include sys/ioctl.h if it is available.
+
 2009-02-03  Zoltan Varga  <vargaz@gmail.com>
 
        * method-builder.h (_MonoMethodBuilder): Add a 'skip_visibility' flag.
index 22c9c3a0e982842153342d4b00f93fba9f57b66d..a6939edf3b9ce972ccc568982346fc533a3162bd 100644 (file)
@@ -18,6 +18,9 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 #ifdef HAVE_UTIME_H
 #include <utime.h>
 #else
index 99f2ebafb5074b7821dbc9c089369a242e4581fd..a41d6c935e0cdb259dbde6cc877e5b16271c6df3 100644 (file)
@@ -482,7 +482,7 @@ mono_set_dirs (const char *assembly_dir, const char *config_dir)
 static char *
 compute_base (char *path)
 {
-       char *p = rindex (path, '/');
+       char *p = strrchr (path, '/');
        if (p == NULL)
                return NULL;
 
@@ -491,7 +491,7 @@ compute_base (char *path)
                return NULL;
            
        *p = 0;
-       p = rindex (path, '/');
+       p = strrchr (path, '/');
        if (p == NULL)
                return NULL;
        
index 1f99492c3d5d9eab5c0e003681b2a4bbe10ed703..eb040758227b0617cdf95b1404b7fd55192c9fa4 100644 (file)
@@ -8,6 +8,9 @@
  *
  */
 #include <config.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #include <glib.h>
 #include <stdio.h>
 #include <string.h>
index 41f1e107dfc6bd05ac4d22821c5084bc3f3efd24..519022e56c19dbc7b329b54af4867d04bac4ee79 100644 (file)
@@ -41,8 +41,8 @@
 #ifdef HAVE_SYS_FILIO_H
 #include <sys/filio.h>
 #endif
-#ifndef PLATFORM_WIN32
 #ifndef TIOCGWINSZ
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
 #endif
@@ -64,7 +64,7 @@ static gchar *keypad_xmit_str;
 static struct termios mono_attr;
 #endif
 
-#ifdef PLATFORM_WIN32
+#if defined (PLATFORM_WIN32) || defined (MONO_NULL_TTYDRIVER)
 MonoBoolean
 ves_icall_System_ConsoleDriver_Isatty (HANDLE handle)
 {
index 081cc9f8e79e4da0208c620e206ab5fff757e6b2..44df1266af3f593e67690e075bbed5a429c60048 100644 (file)
@@ -53,7 +53,7 @@ ves_icall_System_Environment_GetOSVersionString (void)
                        verinfo.dwBuildNumber);
                return mono_string_new (mono_domain_get (), version);
        }
-#else
+#elif defined(HAVE_SYS_UTSNAME_H)
        struct utsname name;
 
        MONO_ARCH_SAVE_REGS;
index e2c8331b8b34b3b8773738a5a13ca642a1e69d17..8d479585c358ad4042d2036088c699c1281187fd 100644 (file)
@@ -14,6 +14,9 @@
 #include <stdarg.h>
 #include <string.h>
 #include <ctype.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -6345,7 +6348,7 @@ ves_icall_System_Environment_get_MachineName (void)
 
        g_free (buf);
        return result;
-#else
+#elif !defined(DISABLE_SOCKETS)
        gchar buf [256];
        MonoString *result;
 
@@ -6355,6 +6358,8 @@ ves_icall_System_Environment_get_MachineName (void)
                result = NULL;
        
        return result;
+#else
+       return mono_string_new (mono_domain_get (), "mono");
 #endif
 }
 
index 3aaead29cd3a4b90de91674ce342db995536b718..01fe1a6f02af5349e4ed1987b2fcc3291ae14106 100644 (file)
@@ -9,6 +9,10 @@
  */
 
 #include "config.h"
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
 #include "object.h"
 #include "loader.h"
 #include "cil-coff.h"
index 2023c11916af00ce8f20bb1c702c130744ce5d48..acfe5aeabc5610d6e4d08fe5aac4ccb76b9e4065 100644 (file)
@@ -9,6 +9,9 @@
  */
 
 #include <config.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -4301,12 +4304,12 @@ void
 mono_metadata_field_info (MonoImage *meta, guint32 index, guint32 *offset, guint32 *rva, 
                          MonoMarshalSpec **marshal_spec)
 {
-       return mono_metadata_field_info_with_mempool (NULL, meta, index, offset, rva, marshal_spec);
+       mono_metadata_field_info_with_mempool (NULL, meta, index, offset, rva, marshal_spec);
 }
 
 void
 mono_metadata_field_info_with_mempool (MonoMemPool *mempool, MonoImage *meta, guint32 index, guint32 *offset, guint32 *rva, 
-                         MonoMarshalSpec **marshal_spec)
+                                      MonoMarshalSpec **marshal_spec)
 {
        MonoTableInfo *tdef;
        locator_t loc;
index 8e464e74ed7c2d30bdfac122e3c33e4f4e8bfd13..d2ae0525359f3e31ba601274b6209571cc8fd4ea 100644 (file)
@@ -8,6 +8,9 @@
  * (C) 2001-2004 Ximian, Inc.
  */
 #include <config.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <signal.h>
index cb51ca3a62be7465d103d3fc8bc803a62c5fe872..23a1f8bafc8d7a65412a06118e1c7ca292195210 100644 (file)
@@ -8,6 +8,9 @@
  *
  */
 #include <config.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #include "mono/utils/mono-digest.h"
 #include "mono/utils/mono-membar.h"
 #include "mono/metadata/reflection.h"
index 33506f5bbb86f9e531a0ca122275349a9d6aa505..14e1dac54f4747d2dbc6128a1f20d44d1f3701c2 100644 (file)
@@ -48,7 +48,9 @@
 #include <sys/epoll.h>
 #endif
 
+#ifndef DISABLE_SOCKETS
 #include "mono/io-layer/socket-wrappers.h"
+#endif
 
 #include "threadpool.h"
 
@@ -153,6 +155,9 @@ enum {
        AIO_OP_LAST
 };
 
+#ifdef DISABLE_SOCKETS
+#define socket_io_cleanup(x)
+#else
 static void
 socket_io_cleanup (SocketIOData *data)
 {
@@ -233,6 +238,7 @@ get_events_from_list (MonoMList *list)
                                (SOCKET)(gssize)x->handle, x->buffer, x->offset, x->size,\
                                 x->socket_flags, &x->error);
 
+#endif /* !DISABLE_SOCKETS */
 
 static void
 unregister_job (MonoAsyncResult *obj)
@@ -261,6 +267,7 @@ threadpool_jobs_dec (MonoObject *obj)
        return FALSE;
 }
 
+#ifndef DISABLE_SOCKETS
 static void
 async_invoke_io_thread (gpointer data)
 {
@@ -967,6 +974,7 @@ socket_io_filter (MonoObject *target, MonoObject *state)
 
        return TRUE;
 }
+#endif /* !DISABLE_SOCKETS */
 
 static void
 mono_async_invoke (MonoAsyncResult *ares)
@@ -1112,11 +1120,13 @@ mono_thread_pool_add (MonoObject *target, MonoMethodMessage *msg, MonoDelegate *
        mono_g_hash_table_insert (ares_htable, ares, ares);
        LeaveCriticalSection (&ares_lock);
 
+#ifndef DISABLE_SOCKETS
        if (socket_io_filter (target, state)) {
                socket_io_add (ares, (MonoSocketAsyncResult *) state);
                return ares;
        }
-
+#endif
+       
        start_thread_or_queue (ares);
        return ares;
 }