Merge pull request #2988 from radical/xbuild-fix-processwrapper
authorMarek Habersack <grendel@twistedcode.net>
Tue, 17 May 2016 15:54:11 +0000 (17:54 +0200)
committerMarek Habersack <grendel@twistedcode.net>
Tue, 17 May 2016 15:54:11 +0000 (17:54 +0200)
[xbuild] Fix ProcessWrapper to WaitForExit(..) before accessing ExitCode

122 files changed:
configure.ac
external/nunit-lite
man/mkbundle.1
mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
mcs/class/System/ReferenceSources/Logging.cs
mcs/class/System/System.Net.NetworkInformation/Ping.cs
mcs/class/System/System.Net/AuthenticationManager.cs
mcs/class/System/System.Net/AuthenticationSchemeSelector.cs [deleted file]
mcs/class/System/System.Net/AuthenticationSchemes.cs [deleted file]
mcs/class/System/System.Net/Authorization.cs [deleted file]
mcs/class/System/System.Net/ConnectionModes.cs [deleted file]
mcs/class/System/System.Net/DnsEndPoint.cs [deleted file]
mcs/class/System/System.Net/DownloadProgressChangedEventHandler.cs [deleted file]
mcs/class/System/System.Net/EndPoint.cs [deleted file]
mcs/class/System/System.Net/FileWebRequest.cs [deleted file]
mcs/class/System/System.Net/FileWebRequestCreator.cs [deleted file]
mcs/class/System/System.Net/FileWebResponse.cs [deleted file]
mcs/class/System/System.Net/FtpStatusCode.cs [deleted file]
mcs/class/System/System.Net/HttpListenerException.cs [deleted file]
mcs/class/System/System.Net/HttpRequestHeader.cs [deleted file]
mcs/class/System/System.Net/HttpResponseHeader.cs [deleted file]
mcs/class/System/System.Net/HttpStatusCode.cs [deleted file]
mcs/class/System/System.Net/HttpVersion.cs [deleted file]
mcs/class/System/System.Net/HttpWebRequest.cs
mcs/class/System/System.Net/IAuthenticationModule.cs [deleted file]
mcs/class/System/System.Net/ICertificatePolicy.cs [deleted file]
mcs/class/System/System.Net/ICredentialLookup.cs [deleted file]
mcs/class/System/System.Net/ICredentialsByHost.cs [deleted file]
mcs/class/System/System.Net/IPAddress.cs [deleted file]
mcs/class/System/System.Net/IPEndPoint.cs [deleted file]
mcs/class/System/System.Net/IPHostEntry.cs [deleted file]
mcs/class/System/System.Net/IPv6Address.cs
mcs/class/System/System.Net/IWebProxy.cs [deleted file]
mcs/class/System/System.Net/IWebRequestCreate.cs [deleted file]
mcs/class/System/System.Net/NetworkAccess.cs [deleted file]
mcs/class/System/System.Net/ProtocolViolationException.cs [deleted file]
mcs/class/System/System.Net/SecurityProtocolType.cs [deleted file]
mcs/class/System/System.Net/SocketAddress.cs [deleted file]
mcs/class/System/System.Net/TransportContext.cs [deleted file]
mcs/class/System/System.Net/TransportType.cs [deleted file]
mcs/class/System/System.Net/UploadProgressChangedEventHandler.cs [deleted file]
mcs/class/System/System.Net/WebConnection.cs
mcs/class/System/System.Net/WebConnectionStream.cs
mcs/class/System/System.Net/WebException.cs [deleted file]
mcs/class/System/System.Net/WebExceptionStatus.cs [deleted file]
mcs/class/System/System.Net/WebHeaderCollection.cs
mcs/class/System/System.Net/WebRequest.cs
mcs/class/System/System.Net/WebRequestMethods.cs [deleted file]
mcs/class/System/System.Net/WebResponse.cs [deleted file]
mcs/class/System/System.dll.sources
mcs/class/System/Test/System.Net.NetworkInformation/PingTest.cs
mcs/class/System/Test/System.Net/DnsTest.cs
mcs/class/System/Test/System.Net/FileWebRequestTest.cs
mcs/class/System/Test/System.Net/IPAddressTest.cs
mcs/class/System/mobile_System.dll.sources
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/Test/System.Threading/ThreadTest.cs
mcs/class/reference-assemblies/Makefile
mcs/class/referencesource/System/net/System/Net/AuthenticationManager.cs
mcs/class/referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs
mcs/class/referencesource/System/net/System/Net/Authorization.cs
mcs/class/referencesource/System/net/System/Net/IPAddress.cs
mcs/class/referencesource/System/net/System/Net/Internal.cs
mcs/class/referencesource/System/net/System/Net/ServicePointManager.cs
mcs/class/referencesource/System/net/System/Net/WebHeaderCollection.cs
mcs/class/referencesource/System/net/System/Net/_SpnDictionary.cs
mcs/class/referencesource/System/net/System/Net/filewebrequest.cs
mcs/tools/mkbundle/mkbundle.cs
mono/metadata/appdomain.c
mono/metadata/attach.c
mono/metadata/cominterop.c
mono/metadata/cominterop.h
mono/metadata/domain-internals.h
mono/metadata/file-io.c
mono/metadata/filewatcher.c
mono/metadata/gc.c
mono/metadata/icall.c
mono/metadata/marshal.c
mono/metadata/monitor.c
mono/metadata/mono-mlist.c
mono/metadata/mono-mlist.h
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/object.h
mono/metadata/reflection.c
mono/metadata/sgen-mono.c
mono/metadata/socket-io.c
mono/metadata/string-icalls.c
mono/metadata/threadpool-ms-io.c
mono/metadata/threadpool-ms.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/debugger-agent.c
mono/mini/decompose.c
mono/mini/driver.c
mono/mini/exceptions-arm.c
mono/mini/jit-icalls.h
mono/mini/method-to-ir.c
mono/mini/mini-arm.c
mono/mini/mini-exceptions.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-llvm.c
mono/mini/mini-posix.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini.c
mono/mini/mini.h
mono/profiler/proflog.c
mono/tests/Makefile.am
mono/utils/mono-context.h
mono/utils/mono-coop-mutex.h
mono/utils/mono-coop-semaphore.h
mono/utils/mono-threads-api.h
mono/utils/mono-threads-coop.c
mono/utils/mono-threads-coop.h
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/networking-posix.c

index d46125cf4d87a4450e1e343a16fa00a831df86c2..aabed4a554458669c875d9f4d14354765774e30f 100644 (file)
@@ -3595,6 +3595,8 @@ AC_ARG_WITH(cooperative_gc, [  --with-cooperative-gc=yes|no      Enable cooperat
        fi
 ], [with_cooperative_gc=no])
 
+AM_CONDITIONAL([ENABLE_COOP], [test x$with_cooperative_gc != xno])
+
 AC_ARG_ENABLE(checked_build, [  --enable-checked-build=LIST      To enable checked build (expensive asserts), configure with a comma-separated LIST of checked build modules and then include that same list in the environment variable MONO_CHECK_MODE at runtime. Recognized checked build modules: all, gc, metadata, thread],[
 
        if test x$enable_checked_build != x ; then
index 5a80e74622e66e16ed0e4f0e9598d5ebc024d789..7065bc89e8661cad447140752c0fce118644e06e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5a80e74622e66e16ed0e4f0e9598d5ebc024d789
+Subproject commit 7065bc89e8661cad447140752c0fce118644e06e
index ed704b89d6aea515bdfa80ec664c4709a2b2e705..d61fc1757b1d70f822325fb6a661428c3e48aadc 100644 (file)
@@ -21,9 +21,34 @@ default only the assemblies specified in the command line will be
 included in the bundle.  To automatically include all of the
 dependencies referenced, use the "--deps" command line option.
 .PP
-Use \fImkbundle\FP when you want the startup runtime to load the 1.0
-profile, and use \fImkbundle2\fP when you want the startup runtime to load
-the 2.0 profile.
+There are two modes of operation, the default one uses the
+C compiler to create a bundle and requires a complete C and Mono SDK
+to produced executables.   The simple mode (enabled when using the
+"--simple") command line option does not require this, and also allows
+for cross compilation.
+.PP
+For example, to create a bundle for hello world, use the following
+command:
+.nf
+       $ mkbundle -o hello --simple hello.exe
+.fi
+.PP
+The simple version allows for cross-compiling, this requires a Mono
+runtime to be installed in the ~/.mono/targets/TARGET/mono to be
+available.   You can use the "--local-targets" to list all available
+targets, and the "--cross" argument to specify the target, like this:
+.nf
+       $ mkbundle --local-targets      
+       Available targets:
+               default - Current System Mono
+               4.4.0-macosx-x86
+               4.4.0-debian-8-arm64
+       $ mkbundle --cross 4.4.0-debian-8-powerpc hello.exe -o hello-debian
+.fi
+.PP
+The above will bundle your native library into hello-debian for
+a Debian 8 system running on a PowerPC machine.
+.SH OLD EMBEDDING
 .PP
 For example, to create a bundle for hello world, use the following
 command:
@@ -57,6 +82,12 @@ are available to the embedded runtime.
 .I "-c"
 Produce the stub file, do not compile the resulting stub.
 .TP
+.I "--cross target"
+Creates a bundle for the specified target platform.   The target
+must be a directory in ~/.mono/targets/ that contains a "mono"
+binary.   You can fetch various targets using the --fetch-target
+command line option.
+.TP
 .I "-o filename"
 Places the output on `out'.  If the flag -c is specified, this is the
 C host program.  If not, this contains the resulting executable.
@@ -74,20 +105,31 @@ Typically this is $prefix/etc/mono/1.0/machine.config or
 $prefix/etc/mono/2.0/machine.config depending on the profile that you
 are using (1.0 or 2.0)
 .TP
-.I  "--nodeps"
-This is the default: \fImkbundle\fP will only include the assemblies that
-were specified on the command line to reduce the size of the resulting
-image created.
-.TP
 .I "--deps"
 This option will bundle all of the referenced assemblies for the
 assemblies listed on the command line option.  This is useful to
 distribute a self-contained image.
 .TP
+.I "--fetch-target target"
+Downloads a precompiled runtime for the specified target from the Mono
+distribution site.
+.TP
+.I  "--nodeps"
+This is the default: \fImkbundle\fP will only include the assemblies that
+were specified on the command line to reduce the size of the resulting
+image created.
+.TP
 .I "--keeptemp"
 By default \fImkbundle\fP will delete the temporary files that it uses to
 produce the bundle.  This option keeps the file around.
 .TP
+.I "--lists-targets"
+Lists all of the available local cross compilation targets available
+as precompiled binaries on the Mono distribution server.
+.TP
+.I "--local-targets"
+Lists all of the available local cross compilation targets.
+.TP
 .I "--machine-config FILE"
 Uses the given FILE as the machine.config file for the generated
 application.   
@@ -102,13 +144,10 @@ When passed, DIR will be set for the MONO_CFG_DIR environment variable
 By default \fImkbundle\fP dynamically links to mono and glib.  This option
 causes it to statically link instead.
 .TP
-.B Important:
-Since the Mono runtime is licensed under the LGPL, even if you use
-static you should transfer the component pieces of the mkbundle to
-your users so they are able to upgrade the Mono runtime on their own.
-.TP
-If you want to use this for commercial licenses, you must obtain a
-proprietary license for Mono from mono@novell.com
+.I "--target-server SERVER"
+By default the mkbundle tool will download from a Mono server the
+target runtimes, you can specify a different server to provide
+cross-compiled runtimes.
 .TP
 .I "-z"
 Compresses the assemblies before embedding. This results in smaller
@@ -133,6 +172,8 @@ Mono runtime, separated by spaces. See the mono(1) manual page or run mono --hel
 .SH FILES
 This program will load referenced assemblies from the Mono assembly
 cache. 
+.PP
+Targets are loaded from ~/.mono/targets/TARGETNAME/mono
 .SH BUGS
 The option "--static" is not supported under Windows.
 Moreover, a full cygwin environment containing at least "gcc" and "as"
index 0a9d60fb98ec8bfc9c445982b5622ce200126493..37833bc67086e6b96cbf74f99025feb188174496 100644 (file)
@@ -294,7 +294,7 @@ namespace System.Net.Http
                                if (values_formated == null)
                                        continue;
 
-                               headers.AddValue (header.Key, values_formated);
+                               headers.AddInternal (header.Key, values_formated);
                        }
                        
                        return wr;
@@ -343,7 +343,7 @@ namespace System.Net.Http
 
                                                foreach (var header in content.Headers) {
                                                        foreach (var value in header.Value) {
-                                                               headers.AddValue (header.Key, value);
+                                                               headers.AddInternal (header.Key, value);
                                                        }
                                                }
 
index fe8da2b35823b9b8680f57a91ba898afb2ef4634..35474720e7a493f8a4e14965a2d609913f2051ed 100644 (file)
@@ -22,18 +22,28 @@ namespace System.Net {
                }
 
                [Conditional ("TRACE")]
-               internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject) {
-               }
+               internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject) {
+               }
+
+               [Conditional ("TRACE")]
+               internal static void Exception(TraceSource traceSource, object obj, string method, Exception e) {
+               }
 
                [Conditional ("TRACE")]
                internal static void Exit(TraceSource traceSource, object obj, string method, object retObject) {
                }
 
+               [Conditional ("TRACE")]
                internal static void PrintInfo(TraceSource traceSource, object obj, string method, string msg) {
                }
 
+               [Conditional ("TRACE")]
                internal static void PrintWarning(TraceSource traceSource, object obj, string method, string msg) {
                }
+
+               [Conditional ("TRACE")]
+               internal static void PrintWarning(TraceSource traceSource, string msg) {
+               }
        }
 
 #if MOBILE
index f18b70c0f9ad0babef214d3c27daf9627aebc156..72645bcd3a712796e6c935af1280e12d887907b9 100644 (file)
@@ -159,7 +159,11 @@ namespace System.Net.NetworkInformation {
                {
                        user_async_state = null;
                        worker = null;
-                       cts = null;
+
+                       if (cts != null) {
+                               cts.Dispose();
+                               cts = null;
+                       }
 
                        if (PingCompleted != null)
                                PingCompleted (this, e);
@@ -596,6 +600,8 @@ namespace System.Net.NetworkInformation {
                        if ((worker != null) || (cts != null))
                                throw new InvalidOperationException ("Another SendAsync operation is in progress");
 
+                       cts = new CancellationTokenSource();
+
                        var task = Task<PingReply>.Factory.StartNew (
                                () => Send (address, timeout, buffer, options), cts.Token);
 
index 679bd5ae1ea518800b299f70dfb567da7ff6a391..e987c5bd55f0c67461c3e0c6570d0b21efff6599 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Net
                                        if (auth == null)
                                                continue;
 
-                                       auth.Module = mod;
+                                       auth.ModuleAuthenticationType = mod.AuthenticationType;
                                        return auth;
                                }
                        }
@@ -159,7 +159,7 @@ namespace System.Net
                                        if (auth == null)
                                                continue;
 
-                                       auth.Module = mod;
+                                       auth.ModuleAuthenticationType = mod.AuthenticationType;
                                        return auth;
                                }
                        }
diff --git a/mcs/class/System/System.Net/AuthenticationSchemeSelector.cs b/mcs/class/System/System.Net/AuthenticationSchemeSelector.cs
deleted file mode 100644 (file)
index e20ccb4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// System.Net.AuthenticationSchemeSelector.cs
-//
-// Author:
-//     Gonzalo Paniagua Javier  <gonzalo@novell.com>
-//
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if SECURITY_DEP
-
-namespace System.Net {
-       public delegate AuthenticationSchemes AuthenticationSchemeSelector (HttpListenerRequest httpRequest);
-}
-#endif
-
diff --git a/mcs/class/System/System.Net/AuthenticationSchemes.cs b/mcs/class/System/System.Net/AuthenticationSchemes.cs
deleted file mode 100644 (file)
index 0a59985..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// System.Net.AuthenticationSchemes.cs
-//
-// Author:
-//     Atsushi Enomoto  <atsushi@ximian.com>
-//
-// (C) 2005 Novell, Inc. (http://www.novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System.Collections;
-using System.Configuration;
-
-namespace System.Net
-{
-       [Flags]
-       public enum AuthenticationSchemes {
-               None,
-               Digest = 1,
-               Negotiate = 2,
-               Ntlm = 4,
-               IntegratedWindowsAuthentication = 6,
-               Basic = 8,
-               Anonymous = 0x8000,
-       }
-}
-
diff --git a/mcs/class/System/System.Net/Authorization.cs b/mcs/class/System/System.Net/Authorization.cs
deleted file mode 100644 (file)
index a808454..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// System.Net.Authorization.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//   Lawrence Pit (loz@cable.a2000.nl)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net {
-
-       public class Authorization {
-               string token;
-               bool complete;
-               string connectionGroupId;
-               string [] protectionRealm;
-               IAuthenticationModule module;
-               
-               public Authorization (string token) : this (token, true)
-               {
-               }
-
-               public Authorization (string token, bool finished) 
-                       : this (token, finished, null)
-               {
-               }
-               
-               public Authorization (string token, bool finished, string connectionGroupId)
-               {
-                       this.token = token;
-                       this.complete = finished;
-                       this.connectionGroupId = connectionGroupId;
-               }
-
-               public string Message {
-                       get { return token; }
-               }
-
-               public bool Complete {
-                       get { return complete; }
-               }
-
-               public string ConnectionGroupId {
-                       get { return connectionGroupId; }
-               }       
-               
-               public string[] ProtectionRealm {
-                       get { return protectionRealm; }
-                       set { protectionRealm = value; }
-               }
-
-               internal IAuthenticationModule Module {
-                       get { return module; }
-                       set { module = value; }
-               }
-
-               static Exception GetMustImplement ()
-               {
-                       return new NotImplementedException ();
-               }
-               
-               [MonoTODO]
-               public bool MutuallyAuthenticated
-               {
-                       get {
-                               throw GetMustImplement ();
-                       }
-                       set {
-                               throw GetMustImplement ();
-                       }
-               }
-       }
-}
diff --git a/mcs/class/System/System.Net/ConnectionModes.cs b/mcs/class/System/System.Net/ConnectionModes.cs
deleted file mode 100644 (file)
index 0be4e4d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// ConnectionModes.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:35:39 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Net {
-
-
-       /// <summary>
-       /// </summary>
-       enum ConnectionModes {
-
-               /// <summary>
-               /// </summary>
-               Single = 0,
-
-               /// <summary>
-               /// </summary>
-               Persistent = 1,
-
-               /// <summary>
-               /// </summary>
-               Pipeline = 2,
-
-               /// <summary>
-               /// </summary>
-               Mux = 3,
-       } // ConnectionModes
-
-} // System.Net
diff --git a/mcs/class/System/System.Net/DnsEndPoint.cs b/mcs/class/System/System.Net/DnsEndPoint.cs
deleted file mode 100644 (file)
index a7f119e..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// System.Net.DnsEndPoint
-//
-// Authors:
-//     Stephane Delcroix  <stephane@delcroix.org>
-//
-// (c) 2007, 2009 Novell, Inc. (http://www.novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using System.Net.Sockets;
-
-namespace System.Net { 
-
-#if NET_2_1
-       sealed
-#endif
-       public class DnsEndPoint : EndPoint {
-               string host;
-               int port;
-               AddressFamily addressFamily = AddressFamily.Unspecified;
-
-               public DnsEndPoint (string host, int port)
-               {
-                       if (host == null)
-                               throw new ArgumentNullException ("host");
-                       if (host == String.Empty)
-                               throw new ArgumentException ("host parameter contains an empty string");
-                       if (port < 0 || port > 0xffff)
-                               throw new ArgumentOutOfRangeException ("port is less than 0 or greater than 0xffff");
-
-                       this.host = host;
-                       this.port = port;
-               }
-
-               public DnsEndPoint (string host, int port, AddressFamily addressFamily) : this (host, port)
-               {
-                       switch (addressFamily) {
-                       case AddressFamily.InterNetwork:
-                       case AddressFamily.InterNetworkV6:
-                       case AddressFamily.Unspecified:
-                               this.addressFamily = addressFamily;
-                               break;
-                       default:
-                               // throw for Unknown or any invalid value
-                               throw new ArgumentException ("addressFamily");
-                       }
-               }
-
-               public override bool Equals (object comparand)
-               {
-                       DnsEndPoint dep = (comparand as DnsEndPoint);
-                       return (comparand != null) && Equals (dep);
-               }
-
-               private bool Equals (DnsEndPoint other)
-               {
-                       if (port != other.port || addressFamily != other.addressFamily|| host != other.host)
-                               return false;
-                       return true;
-               }
-
-               public override int GetHashCode ()
-               {
-                       return port ^ (int)addressFamily ^ host.GetHashCode ();
-               }
-
-               public override string ToString ()
-               {
-                       return String.Format ("{0}/{1}:{2}", addressFamily, host, port);
-               }
-
-               public override AddressFamily AddressFamily {
-                       get { return addressFamily; }
-               }
-
-               public string Host {
-                       get { return host; }
-               }
-
-               public int Port {
-                       get { return port; }
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net/DownloadProgressChangedEventHandler.cs b/mcs/class/System/System.Net/DownloadProgressChangedEventHandler.cs
deleted file mode 100644 (file)
index 1f28234..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// DownloadProgressChangedEventHandler.cs
-//
-// Author:
-//     Atsushi Enomoto  <atsushi@ximian.com>
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-namespace System.Net
-{
-       public delegate void DownloadProgressChangedEventHandler (object sender, DownloadProgressChangedEventArgs e);
-}
-
diff --git a/mcs/class/System/System.Net/EndPoint.cs b/mcs/class/System/System.Net/EndPoint.cs
deleted file mode 100644 (file)
index 6e1f448..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// System.Net.EndPoint.cs
-//
-// Author:
-//   Dick Porter (dick@ximian.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Net.Sockets;
-
-namespace System.Net {
-       [Serializable]
-       public abstract class EndPoint {
-
-               // NB: These methods really do nothing but throw
-               // NotImplementedException
-               
-               public virtual AddressFamily AddressFamily {
-                       get { throw NotImplemented (); }
-               }
-               
-               public virtual EndPoint Create (SocketAddress socketAddress)
-               {
-                       throw NotImplemented ();
-               }
-
-               public virtual SocketAddress Serialize ()
-               {
-                       throw NotImplemented ();
-               }
-
-               protected EndPoint ()
-               {
-               }
-
-               static Exception NotImplemented ()
-               {
-                       // hide the "normal" NotImplementedException from corcompare-like tools
-                       return new NotImplementedException ();
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net/FileWebRequest.cs b/mcs/class/System/System.Net/FileWebRequest.cs
deleted file mode 100644 (file)
index 618c09e..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-//\r
-// System.Net.FileWebRequest\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-using System.Runtime.Remoting.Messaging;\r
-using System.Threading;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class FileWebRequest : WebRequest, ISerializable\r
-       {\r
-               private Uri uri;\r
-               private WebHeaderCollection webHeaders;\r
-               \r
-               private ICredentials credentials;\r
-               private string connectionGroup;\r
-               private long contentLength;\r
-               private FileAccess fileAccess = FileAccess.Read;\r
-               private string method = "GET";\r
-               private IWebProxy proxy;\r
-               private bool preAuthenticate;\r
-               private int timeout = 100000;\r
-               \r
-               private Stream requestStream;\r
-               private FileWebResponse webResponse;\r
-               private AutoResetEvent requestEndEvent;\r
-               private bool requesting;\r
-               private bool asyncResponding;\r
-               \r
-               // Constructors\r
-               \r
-               internal FileWebRequest (Uri uri) \r
-               { \r
-                       this.uri = uri;\r
-                       this.webHeaders = new WebHeaderCollection ();\r
-               }\r
-               \r
-               [Obsolete ("Serialization is obsoleted for this type", false)]\r
-               protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) \r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-                       webHeaders = (WebHeaderCollection) info.GetValue ("headers", typeof (WebHeaderCollection));\r
-                       proxy = (IWebProxy) info.GetValue ("proxy", typeof (IWebProxy));\r
-                       uri = (Uri) info.GetValue ("uri", typeof (Uri));\r
-                       connectionGroup = info.GetString ("connectionGroupName");\r
-                       method = info.GetString ("method");\r
-                       contentLength = info.GetInt64 ("contentLength");\r
-                       timeout = info.GetInt32 ("timeout");\r
-                       fileAccess = (FileAccess) info.GetValue ("fileAccess", typeof (FileAccess));\r
-                       preAuthenticate = info.GetBoolean ("preauthenticate");\r
-               }\r
-               \r
-               // Properties\r
-               \r
-               // currently not used according to spec\r
-               public override string ConnectionGroupName {\r
-                       get { return connectionGroup; }\r
-                       set { connectionGroup = value; }\r
-               }\r
-               \r
-               public override long ContentLength {\r
-                       get { return contentLength; }\r
-                       set {\r
-                               if (value < 0)\r
-                                       throw new ArgumentException ("The Content-Length value must be greater than or equal to zero.", "value");\r
-                               contentLength =  value;\r
-                       }\r
-               }\r
-               \r
-               public override string ContentType { \r
-                       get { return webHeaders ["Content-Type"]; }\r
-                       set { webHeaders ["Content-Type"] = value; }\r
-               }\r
-               \r
-               public override ICredentials Credentials { \r
-                       get { return credentials; }\r
-                       set { credentials = value; }\r
-               }\r
-               \r
-               public override WebHeaderCollection Headers { \r
-                       get { return webHeaders; }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override string Method { \r
-                       get { return this.method; }\r
-                       set {\r
-                               if (value == null || value.Length == 0)\r
-                                       throw new ArgumentException ("Cannot set null or blank "\r
-                                               + "methods on request.", "value");\r
-                               this.method = value;\r
-                       }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override bool PreAuthenticate { \r
-                       get { return preAuthenticate; }\r
-                       set { preAuthenticate = value; }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override IWebProxy Proxy {\r
-                       get { return proxy; }\r
-                       set { proxy = value; }\r
-               }\r
-               \r
-               public override Uri RequestUri { \r
-                       get { return this.uri; }\r
-               }\r
-               \r
-               public override int Timeout { \r
-                       get { return timeout; }\r
-                       set { \r
-                               if (value < -1)\r
-                                       throw new ArgumentOutOfRangeException ("Timeout can be "\r
-                                               + "only set to 'System.Threading.Timeout.Infinite' "\r
-                                               + "or a value >= 0.");\r
-                               timeout = value;\r
-                       }\r
-               }\r
-\r
-               public override bool UseDefaultCredentials\r
-               {\r
-                       get {\r
-                               throw new NotSupportedException ();\r
-                       }\r
-                       set {\r
-                               throw new NotSupportedException ();\r
-                       }\r
-               }\r
-               // Methods\r
-               \r
-               private delegate Stream GetRequestStreamCallback ();\r
-               private delegate WebResponse GetResponseCallback ();\r
-\r
-               static Exception GetMustImplement ()\r
-               {\r
-                       return new NotImplementedException ();\r
-               }\r
-               \r
-               /* LAMESPEC: Docs suggest this was present in 1.1 and\r
-                * 1.0 profiles, but the masterinfos say otherwise\r
-                */\r
-               [MonoTODO]\r
-               public override void Abort ()\r
-               {\r
-                       throw GetMustImplement ();\r
-               }\r
-\r
-               public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) \r
-               {\r
-                       if (string.Compare ("GET", method, true) == 0 ||\r
-                               string.Compare ("HEAD", method, true) == 0 ||\r
-                               string.Compare ("CONNECT", method, true) == 0)\r
-                               throw new ProtocolViolationException ("Cannot send a content-body with this verb-type.");\r
-                       lock (this) {\r
-                               if (asyncResponding || webResponse != null)\r
-                                       throw new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");\r
-                               if (requesting)\r
-                                       throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");\r
-                               requesting = true;\r
-                       }\r
-                       GetRequestStreamCallback c = new GetRequestStreamCallback (this.GetRequestStreamInternal);\r
-                       return c.BeginInvoke (callback, state);\r
-               }\r
-               \r
-               public override Stream EndGetRequestStream (IAsyncResult asyncResult)\r
-               {\r
-                       if (asyncResult == null)\r
-                               throw new ArgumentNullException ("asyncResult");\r
-                       if (!asyncResult.IsCompleted)\r
-                               asyncResult.AsyncWaitHandle.WaitOne ();\r
-                       AsyncResult async = (AsyncResult) asyncResult;\r
-                       GetRequestStreamCallback cb = (GetRequestStreamCallback) async.AsyncDelegate;\r
-                       return cb.EndInvoke (asyncResult);\r
-               }\r
-\r
-               public override Stream GetRequestStream()\r
-               {\r
-                       IAsyncResult asyncResult = BeginGetRequestStream (null, null);\r
-                       if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {\r
-                               throw new WebException("The request timed out", WebExceptionStatus.Timeout);\r
-                       }\r
-                       return EndGetRequestStream (asyncResult);\r
-               }\r
-               \r
-               internal Stream GetRequestStreamInternal ()\r
-               {\r
-                       this.requestStream = new FileWebStream (\r
-                                               this,\r
-                                               FileMode.Create,\r
-                                               FileAccess.Write, \r
-                                               FileShare.Read);\r
-                       return this.requestStream;\r
-               }\r
-               \r
-               public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)\r
-               {\r
-                       lock (this) {\r
-                               if (asyncResponding)\r
-                                       throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");\r
-                               asyncResponding = true;\r
-                       }\r
-                       GetResponseCallback c = new GetResponseCallback (this.GetResponseInternal);\r
-                       return c.BeginInvoke (callback, state);\r
-               }\r
-               \r
-               public override WebResponse EndGetResponse (IAsyncResult asyncResult)\r
-               {\r
-                       if (asyncResult == null)\r
-                               throw new ArgumentNullException ("asyncResult");\r
-                       if (!asyncResult.IsCompleted)\r
-                               asyncResult.AsyncWaitHandle.WaitOne ();\r
-                       AsyncResult async = (AsyncResult) asyncResult;\r
-                       GetResponseCallback cb = (GetResponseCallback) async.AsyncDelegate;\r
-                       FileWebResponse webResponse = (FileWebResponse) cb.EndInvoke(asyncResult);\r
-                       asyncResponding = false;\r
-                       if (webResponse.HasError)\r
-                               throw webResponse.Error;\r
-                       return webResponse;\r
-               }\r
-               \r
-               public override WebResponse GetResponse ()\r
-               {\r
-                       IAsyncResult asyncResult = BeginGetResponse (null, null);\r
-                       if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {\r
-                               throw new WebException("The request timed out", WebExceptionStatus.Timeout);\r
-                       }\r
-                       return EndGetResponse (asyncResult);\r
-               }\r
-               \r
-               WebResponse GetResponseInternal ()\r
-               {\r
-                       if (webResponse != null)\r
-                               return webResponse;\r
-                       lock (this) {\r
-                               if (requesting) {\r
-                                       requestEndEvent = new AutoResetEvent (false);\r
-                               }\r
-                       }\r
-                       if (requestEndEvent != null) {\r
-                               requestEndEvent.WaitOne ();\r
-                       }\r
-                       FileStream fileStream = null;\r
-                       try {\r
-                               fileStream = new FileWebStream (this, FileMode.Open, FileAccess.Read, FileShare.Read);\r
-                               this.webResponse = new FileWebResponse (this.uri, fileStream);\r
-                       } catch (Exception ex) {\r
-                               this.webResponse = new FileWebResponse (this.uri, new WebException (ex.Message, ex));\r
-                       }\r
-                       return this.webResponse;\r
-               }\r
-               \r
-               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       GetObjectData (serializationInfo, streamingContext);\r
-               }\r
-\r
-               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-                       info.AddValue ("headers", webHeaders, typeof (WebHeaderCollection));\r
-                       info.AddValue ("proxy", proxy, typeof (IWebProxy));\r
-                       info.AddValue ("uri", uri, typeof (Uri));\r
-                       info.AddValue ("connectionGroupName", connectionGroup);\r
-                       info.AddValue ("method", method);\r
-                       info.AddValue ("contentLength", contentLength);\r
-                       info.AddValue ("timeout", timeout);\r
-                       info.AddValue ("fileAccess", fileAccess);\r
-                       info.AddValue ("preauthenticate", false);\r
-               }\r
-               \r
-               internal void Close ()\r
-               {\r
-                       // already done in class below\r
-                       // if (requestStream != null) {\r
-                       //      requestStream.Close ();\r
-                       // }\r
-\r
-                       lock (this) {\r
-                               requesting = false;\r
-                               if (requestEndEvent != null) \r
-                                       requestEndEvent.Set ();\r
-                               // requestEndEvent = null;\r
-                       }\r
-               }\r
-               \r
-               // to catch the Close called on the FileStream\r
-               internal class FileWebStream : FileStream\r
-               {\r
-                       FileWebRequest webRequest;\r
-                       \r
-                       internal FileWebStream (FileWebRequest webRequest,    \r
-                                               FileMode mode,\r
-                                               FileAccess access,\r
-                                               FileShare share)\r
-                               : base (webRequest.RequestUri.LocalPath, \r
-                                       mode, access, share)\r
-                       {\r
-                               this.webRequest = webRequest;\r
-                       }\r
-                       \r
-                       public override void Close() \r
-                       {\r
-                               base.Close ();\r
-                               FileWebRequest req = webRequest;\r
-                               webRequest = null;\r
-                               if (req != null)\r
-                                       req.Close ();\r
-                       }\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/class/System/System.Net/FileWebRequestCreator.cs b/mcs/class/System/System.Net/FileWebRequestCreator.cs
deleted file mode 100644 (file)
index 06601bb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// System.Net.FileWebRequestCreator
-//
-// Authors:
-//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//
-// (C) 2003 Ximian, Inc (http://www.ximian.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net
-{
-       class FileWebRequestCreator : IWebRequestCreate
-       {
-               internal FileWebRequestCreator ()
-               {
-               }
-
-               public WebRequest Create (Uri uri)
-               {
-                       return new FileWebRequest (uri);
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net/FileWebResponse.cs b/mcs/class/System/System.Net/FileWebResponse.cs
deleted file mode 100644 (file)
index 3d8ca21..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-//\r
-// System.Net.FileWebResponse\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class FileWebResponse : WebResponse, ISerializable, IDisposable\r
-       {\r
-               private Uri responseUri;\r
-               private FileStream fileStream;\r
-               private long contentLength;\r
-               private WebHeaderCollection webHeaders;\r
-               private bool disposed;\r
-               Exception exception;\r
-               \r
-               // Constructors\r
-               \r
-               internal FileWebResponse (Uri responseUri, FileStream fileStream)\r
-               {\r
-                       try {\r
-                               this.responseUri = responseUri;\r
-                               this.fileStream = fileStream;\r
-                               this.contentLength = fileStream.Length;\r
-                               this.webHeaders = new WebHeaderCollection ();\r
-                               this.webHeaders.Add ("Content-Length", Convert.ToString (contentLength));\r
-                               this.webHeaders.Add ("Content-Type", "application/octet-stream");\r
-                       } catch (Exception e) {\r
-                               throw new WebException (e.Message, e);\r
-                       }\r
-               }\r
-\r
-               internal FileWebResponse (Uri responseUri, WebException exception)\r
-               {\r
-                       this.responseUri = responseUri;\r
-                       this.exception = exception;\r
-               }\r
-               \r
-               [Obsolete ("Serialization is obsoleted for this type", false)]\r
-               protected FileWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-\r
-                       responseUri = (Uri) info.GetValue ("responseUri", typeof (Uri));\r
-                       contentLength = info.GetInt64 ("contentLength");\r
-                       webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));\r
-               }\r
-               \r
-               // Properties\r
-               internal bool HasError {\r
-                       get { return exception != null; }\r
-               }\r
-\r
-               internal Exception Error {\r
-                       get { return exception; }\r
-               }\r
-               \r
-               public override long ContentLength {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.contentLength;\r
-                       }\r
-               }\r
-               \r
-               public override string ContentType {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return "application/octet-stream";\r
-                       }\r
-               }\r
-               \r
-               public override WebHeaderCollection Headers {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.webHeaders;\r
-                       }\r
-               }\r
-               \r
-               public override Uri ResponseUri {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.responseUri;\r
-                       }\r
-               }\r
-\r
-               // Methods\r
-\r
-               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       GetObjectData (serializationInfo, streamingContext);\r
-               }\r
-\r
-               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-\r
-                       info.AddValue ("responseUri", responseUri, typeof (Uri));\r
-                       info.AddValue ("contentLength", contentLength);\r
-                       info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));\r
-               }\r
-\r
-               public override Stream GetResponseStream()\r
-               {\r
-                       CheckDisposed ();\r
-                       return this.fileStream;\r
-               }\r
-                               \r
-               // Cleaning up stuff\r
-               \r
-               ~FileWebResponse ()\r
-               {\r
-                       Dispose (false);\r
-               }               \r
-               \r
-               public override void Close()\r
-               {\r
-                       ((IDisposable) this).Dispose ();\r
-               }\r
-\r
-               void IDisposable.Dispose()\r
-               {\r
-                       Dispose (true);\r
-                       \r
-                       // see spec, suppress finalization of this object.\r
-                       GC.SuppressFinalize (this);  \r
-               }\r
-               \r
-               protected override\r
-               void Dispose (bool disposing)\r
-               {\r
-                       if (this.disposed)\r
-                               return;\r
-                       this.disposed = true;\r
-                       \r
-                       if (disposing) {\r
-                               // release managed resources\r
-                               this.responseUri = null;\r
-                               this.webHeaders = null;\r
-                       }\r
-                       \r
-                       // release unmanaged resources\r
-                       FileStream stream = fileStream;\r
-                       fileStream = null;\r
-                       if (stream != null)\r
-                               stream.Close (); // also closes webRequest\r
-                       base.Dispose (disposing);\r
-               }\r
-               \r
-               private void CheckDisposed ()\r
-               {\r
-                       if (disposed)\r
-                               throw new ObjectDisposedException (GetType ().FullName);\r
-               }               \r
-       }\r
-}\r
diff --git a/mcs/class/System/System.Net/FtpStatusCode.cs b/mcs/class/System/System.Net/FtpStatusCode.cs
deleted file mode 100644 (file)
index 516124f..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// System.Net.FtpStatusCode.cs
-//
-// Author:
-//     Carlos Alberto Cortez (calberto.oortez@gmail.com)
-//
-// (c) Copyright 2005 Novell, Inc. (http://www.ximian.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net
-{
-       public enum FtpStatusCode
-       {
-               Undefined = 0,
-               RestartMarker = 110,
-               ServiceTemporarilyNotAvailable = 120,
-               DataAlreadyOpen = 125,
-               OpeningData = 150,
-               CommandOK = 200,
-               CommandExtraneous = 202,
-               DirectoryStatus = 212,
-               FileStatus = 213,
-               SystemType = 215,
-               SendUserCommand = 220,
-               ClosingControl = 221,
-               ClosingData = 226,
-               EnteringPassive = 227,
-               LoggedInProceed = 230,
-               ServerWantsSecureSession = 234,
-               FileActionOK = 250,
-               PathnameCreated = 257,
-               SendPasswordCommand = 331,
-               NeedLoginAccount = 332,
-               FileCommandPending = 350,
-               ServiceNotAvailable = 421,
-               CantOpenData = 425,
-               ConnectionClosed = 426,
-               ActionNotTakenFileUnavailableOrBusy = 450,
-               ActionAbortedLocalProcessingError = 451,
-               ActionNotTakenInsufficientSpace = 452,
-               CommandSyntaxError = 500,
-               ArgumentSyntaxError = 501,
-               CommandNotImplemented = 502,
-               BadCommandSequence = 503,
-               NotLoggedIn = 530,
-               AccountNeeded = 532,
-               ActionNotTakenFileUnavailable = 550,
-               ActionAbortedUnknownPageType = 551,
-               FileActionAborted = 552,
-               ActionNotTakenFilenameNotAllowed = 553
-       }
-}
-
-
diff --git a/mcs/class/System/System.Net/HttpListenerException.cs b/mcs/class/System/System.Net/HttpListenerException.cs
deleted file mode 100644 (file)
index 684344e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// System.Net.HttpListenerException
-//
-// Author:
-//     Gonzalo Paniagua Javier (gonzalo@novell.com)
-//
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System.ComponentModel;
-using System.Runtime.Serialization;
-namespace System.Net {
-       [Serializable]
-       public class HttpListenerException : Win32Exception
-       {
-               public HttpListenerException ()
-               {
-               }
-
-               public HttpListenerException (int errorCode) : base (errorCode)
-               {
-               }
-
-               public HttpListenerException (int errorCode, string message) : base (errorCode, message)
-               {
-               }
-
-               protected HttpListenerException (SerializationInfo serializationInfo, StreamingContext streamingContext) : base (serializationInfo, streamingContext)
-               {
-               }
-
-               public override int ErrorCode {
-                       get { return base.ErrorCode; }
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net/HttpRequestHeader.cs b/mcs/class/System/System.Net/HttpRequestHeader.cs
deleted file mode 100644 (file)
index 46bd92b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// System.Net.HttpRequestHeader
-//
-// Author:
-//     Gonzalo Paniagua Javier (gonzalo@novell.com)
-//
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-namespace System.Net {
-       public enum HttpRequestHeader {
-               CacheControl,
-               Connection,
-               Date,
-               KeepAlive,
-               Pragma,
-               Trailer,
-               TransferEncoding,
-               Upgrade,
-               Via,
-               Warning,
-               Allow,
-               ContentLength,
-               ContentType,
-               ContentEncoding,
-               ContentLanguage,
-               ContentLocation,
-               ContentMd5,
-               ContentRange,
-               Expires,
-               LastModified,
-               Accept,
-               AcceptCharset,
-               AcceptEncoding,
-               AcceptLanguage,
-               Authorization,
-               Cookie,
-               Expect,
-               From,
-               Host,
-               IfMatch,
-               IfModifiedSince,
-               IfNoneMatch,
-               IfRange,
-               IfUnmodifiedSince,
-               MaxForwards,
-               ProxyAuthorization,
-               Referer,
-               Range,
-               Te,
-               Translate,
-               UserAgent
-       }
-}
-
diff --git a/mcs/class/System/System.Net/HttpResponseHeader.cs b/mcs/class/System/System.Net/HttpResponseHeader.cs
deleted file mode 100644 (file)
index 2bf820a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// System.Net.HttpResponseHeader
-//
-// Author:
-//     Gonzalo Paniagua Javier (gonzalo@novell.com)
-//
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-namespace System.Net {
-       public enum HttpResponseHeader {
-               CacheControl,
-               Connection,
-               Date,
-               KeepAlive,
-               Pragma,
-               Trailer,
-               TransferEncoding,
-               Upgrade,
-               Via,
-               Warning,
-               Allow,
-               ContentLength,
-               ContentType,
-               ContentEncoding,
-               ContentLanguage,
-               ContentLocation,
-               ContentMd5,
-               ContentRange,
-               Expires,
-               LastModified,
-               AcceptRanges,
-               Age,
-               ETag,
-               Location,
-               ProxyAuthenticate,
-               RetryAfter,
-               Server,
-               SetCookie,
-               Vary,
-               WwwAuthenticate
-       }
-}
-
diff --git a/mcs/class/System/System.Net/HttpStatusCode.cs b/mcs/class/System/System.Net/HttpStatusCode.cs
deleted file mode 100644 (file)
index 4cc32e7..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// HttpStatusCode.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:32:05 UTC
-// Source file: AllTypes.xml
-// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Net {
-       public enum HttpStatusCode {
-               Continue = 100,
-               SwitchingProtocols = 101,
-               OK = 200,
-               Created = 201,
-               Accepted = 202,
-               NonAuthoritativeInformation = 203,
-               NoContent = 204,
-               ResetContent = 205,
-               PartialContent = 206,
-               MultipleChoices = 300,
-               Ambiguous = 300,
-               MovedPermanently = 301,
-               Moved = 301,
-               Found = 302,
-               Redirect = 302,
-               SeeOther = 303,
-               RedirectMethod = 303,
-               NotModified = 304,
-               UseProxy = 305,
-               Unused = 306,
-               TemporaryRedirect = 307,
-               RedirectKeepVerb = 307,
-               BadRequest = 400,
-               Unauthorized = 401,
-               PaymentRequired = 402,
-               Forbidden = 403,
-               NotFound = 404,
-               MethodNotAllowed = 405,
-               NotAcceptable = 406,
-               ProxyAuthenticationRequired = 407,
-               RequestTimeout = 408,
-               Conflict = 409,
-               Gone = 410,
-               LengthRequired = 411,
-               PreconditionFailed = 412,
-               RequestEntityTooLarge = 413,
-               RequestUriTooLong = 414,
-               UnsupportedMediaType = 415,
-               RequestedRangeNotSatisfiable = 416,
-               ExpectationFailed = 417,
-               UpgradeRequired = 426,
-               InternalServerError = 500,
-               NotImplemented = 501,
-               BadGateway = 502,
-               ServiceUnavailable = 503,
-               GatewayTimeout = 504,
-               HttpVersionNotSupported = 505,
-       } // HttpStatusCode
-
-} // System.Net
-
-
diff --git a/mcs/class/System/System.Net/HttpVersion.cs b/mcs/class/System/System.Net/HttpVersion.cs
deleted file mode 100644 (file)
index f44bf70..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//\r
-// System.Net.HttpVersion.cs\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-\r
-namespace System.Net {\r
-\r
-       // <remarks>\r
-       // </remarks>\r
-       public class HttpVersion {\r
-               \r
-               public static readonly Version Version10 = new Version (1, 0);\r
-               public static readonly Version Version11 = new Version (1, 1);\r
-               \r
-               // pretty useless..\r
-               public HttpVersion () {}\r
-       }\r
-}\r
index 02688b1a8b670a2e8bc666aab13d0925d2f3b689..6ca3e0710a217a5929b244963c8c41153d5b475d 100644 (file)
@@ -1297,7 +1297,7 @@ namespace System.Net
                                        wex = new WebException (msg, status);
                                } else {
                                        msg = String.Format ("Error: {0} ({1})", status, exc.Message);
-                                       wex = new WebException (msg, exc, status);
+                                       wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc);
                                }
                                r.SetCompleted (false, wex);
                                r.DoCallback ();
@@ -1631,7 +1631,7 @@ namespace System.Net
                                        return false;
                                request.webHeaders [isProxy ? "Proxy-Authorization" : "Authorization"] = auth.Message;
                                isCompleted = auth.Complete;
-                               bool is_ntlm = (auth.Module.AuthenticationType == "NTLM");
+                               bool is_ntlm = (auth.ModuleAuthenticationType == "NTLM");
                                if (is_ntlm)
                                        ntlm_auth_state = (NtlmAuthState)((int) ntlm_auth_state + 1);
                                return true;
diff --git a/mcs/class/System/System.Net/IAuthenticationModule.cs b/mcs/class/System/System.Net/IAuthenticationModule.cs
deleted file mode 100644 (file)
index c357cf8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// System.Net.IAuthenticationModule.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net {
-
-       // <remarks>
-       //   Authentication interface for Web client authentication modules.
-       // </remarks>
-       public interface IAuthenticationModule {
-               Authorization Authenticate (string challenge, WebRequest request, ICredentials credentials);
-               Authorization PreAuthenticate (WebRequest request, ICredentials credentials);
-               string AuthenticationType { get; }
-               bool CanPreAuthenticate { get; }
-       }
-}
diff --git a/mcs/class/System/System.Net/ICertificatePolicy.cs b/mcs/class/System/System.Net/ICertificatePolicy.cs
deleted file mode 100644 (file)
index 739c57a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// System.Net.ICertificatePolicy.cs
-//
-// Author:
-//   Lawrence Pit (loz@cable.a2000.nl)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net {
-
-       public interface ICertificatePolicy {
-               bool CheckValidationResult (
-                               ServicePoint srvPoint,
-                               X509Certificate certificate,
-                               WebRequest request,
-                               int certificateProblem
-               );              
-       }
-}
diff --git a/mcs/class/System/System.Net/ICredentialLookup.cs b/mcs/class/System/System.Net/ICredentialLookup.cs
deleted file mode 100644 (file)
index c92b151..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// System.Net.ICredential.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//   Duncan Mak (duncan@ximian.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net {
-
-       // <remarks>
-       //   Base authentication interface for Web clients.
-       // </remarks>
-       public interface ICredentials 
-       {
-               NetworkCredential GetCredential (Uri uri, string authType);
-       }
-}
diff --git a/mcs/class/System/System.Net/ICredentialsByHost.cs b/mcs/class/System/System.Net/ICredentialsByHost.cs
deleted file mode 100644 (file)
index 281d87b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// System.Net.ICredentialsByHost.cs
-//
-// Author:
-//     Tim Coleman (tim@imtcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2004
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Net {
-       public interface ICredentialsByHost
-       {
-               NetworkCredential GetCredential (string host, int port, string authenticationType);
-       }
-}
diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs
deleted file mode 100644 (file)
index 0211ad3..0000000
+++ /dev/null
@@ -1,529 +0,0 @@
-//
-// System.Net.IPAddress.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//   Lawrence Pit (loz@cable.a2000.nl)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Net.Sockets;
-using System.Runtime.InteropServices;
-
-namespace System.Net {
-
-       /// <remarks>
-       ///   Encapsulates an IP Address.
-       /// </remarks>
-       [Serializable]
-       public class IPAddress {
-               // Don't change the name of this field without also
-               // changing socket-io.c in the runtime
-               // The IP address is stored in little-endian order inside the int, 
-               // meaning the lower order bytes contain the netid
-               private long m_Address;
-               private AddressFamily m_Family;
-               private ushort[] m_Numbers;     /// ip6 Stored in network order (as ip4)
-               private long m_ScopeId;
-
-               public static readonly IPAddress Any = new IPAddress(0);
-               public static readonly IPAddress Broadcast = IPAddress.Parse ("255.255.255.255");
-               public static readonly IPAddress Loopback = IPAddress.Parse ("127.0.0.1");
-               public static readonly IPAddress None = IPAddress.Parse ("255.255.255.255");
-               public static readonly IPAddress IPv6Any = IPAddress.ParseIPV6 ("::");
-               public static readonly IPAddress IPv6Loopback = IPAddress.ParseIPV6 ("::1");
-               public static readonly IPAddress IPv6None = IPAddress.ParseIPV6 ("::");
-
-               private static short SwapShort (short number)
-               {
-                       return (short) ( ((number >> 8) & 0xFF) | ((number << 8) & 0xFF00) );
-               }
-
-               private static int SwapInt (int number)
-               {
-                       return (((number >> 24) & 0xFF)
-                                 | ((number >> 08) & 0xFF00)
-                                 | ((number << 08) & 0xFF0000)
-                                 | ((number << 24)));
-               }
-
-               private static long SwapLong(long number)
-               {
-                       return (((number >> 56) & 0xFF)
-                                 | ((number >> 40) & 0xFF00)
-                                 | ((number >> 24) & 0xFF0000)
-                                 | ((number >> 08) & 0xFF000000)
-                                 | ((number << 08) & 0xFF00000000)
-                                 | ((number << 24) & 0xFF0000000000)
-                                 | ((number << 40) & 0xFF000000000000)
-                                 | ((number << 56)));
-               }
-
-               public static short HostToNetworkOrder(short host) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(host);
-
-                       return SwapShort (host);
-               }
-
-               public static int HostToNetworkOrder(int host) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(host);
-
-                       return SwapInt (host);
-               }
-               
-               public static long HostToNetworkOrder(long host) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(host);
-
-                       return SwapLong (host);
-               }
-
-               public static short NetworkToHostOrder(short network) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(network);
-
-                       return SwapShort (network);
-               }
-
-               public static int NetworkToHostOrder(int network) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(network);
-
-                       return SwapInt (network);
-               }
-
-               public static long NetworkToHostOrder(long network) {
-                       if (!BitConverter.IsLittleEndian)
-                               return(network);
-
-                       return SwapLong (network);
-               }
-               
-               /// <summary>
-               ///   Constructor from a 32-bit constant with the address bytes in
-               ///   little-endian order (the lower order bytes contain the netid)
-               /// </summary>
-               public IPAddress (long newAddress)
-               {
-                       m_Address = newAddress;
-                       m_Family = AddressFamily.InterNetwork;
-               }
-
-               public IPAddress (byte[] address)
-               {
-                       if (address == null)
-                               throw new ArgumentNullException ("address");
-
-                       int len = address.Length;
-
-                       if (len != 16 && len != 4)
-                               throw new ArgumentException ("An invalid IP address was specified.",
-                                       "address");
-
-                       if (len == 16) {
-                               m_Numbers = new ushort [8];
-                               Buffer.BlockCopy(address, 0, m_Numbers, 0, 16);
-                               m_Family = AddressFamily.InterNetworkV6;
-                               m_ScopeId = 0;
-                       } else {
-                               m_Address = ((uint) address [3] << 24) + (address [2] << 16) +
-                                       (address [1] << 8) + address [0];
-                               m_Family = AddressFamily.InterNetwork;
-                       }
-               }
-
-               public IPAddress(byte[] address, long scopeid)
-               {
-                       if (address == null)
-                               throw new ArgumentNullException ("address");
-
-                       if (address.Length != 16)
-                               throw new ArgumentException ("An invalid IP address was specified.",
-                                       "address");
-
-                       m_Numbers = new ushort [8];
-                       Buffer.BlockCopy(address, 0, m_Numbers, 0, 16);
-                       m_Family = AddressFamily.InterNetworkV6;
-                       m_ScopeId = scopeid;
-               }
-
-               internal IPAddress(ushort[] address, long scopeId)
-               {
-                       m_Numbers = address;
-
-                       for(int i=0; i<8; i++)
-                               m_Numbers[i] = (ushort)HostToNetworkOrder((short)m_Numbers[i]);
-
-                       m_Family = AddressFamily.InterNetworkV6;
-                       m_ScopeId = scopeId;
-               }
-
-               public static IPAddress Parse (string ipString)
-               {
-            if (ipString == null)
-                throw new ArgumentNullException("ipString");
-
-                       IPAddress ret;
-                       if (TryParse (ipString, out ret))
-                               return ret;
-                       throw new FormatException ("An invalid IP address was specified.");
-               }
-
-               public static bool TryParse (string ipString, out IPAddress address)
-               {
-                       if (ipString == null)
-                       {
-                               address = null;
-                               return false;
-                       }
-
-                       if ((address = ParseIPV4 (ipString)) == null)
-                               if ((address = ParseIPV6 (ipString)) == null)
-                                       return false;
-                       return true;
-               }
-
-               private static IPAddress ParseIPV4 (string ip)
-               {
-
-                       int pos = ip.IndexOf (' ');
-                       if (pos != -1) {
-                               string [] nets = ip.Substring (pos + 1).Split (new char [] {'.'});
-                               if (nets.Length > 0) {
-                                       string lastNet = nets [nets.Length - 1];
-                                       if (lastNet.Length == 0)
-                                               return null;
-                                       foreach (char c in lastNet)
-                                               if (!Uri.IsHexDigit (c))
-                                                       return null;
-                               }
-                               ip = ip.Substring (0, pos);
-                       }
-
-                       if (ip.Length == 0 || ip [ip.Length - 1] == '.')
-                               return null;
-
-                       string [] ips = ip.Split (new char [] {'.'});
-                       if (ips.Length > 4)
-                               return null;
-                       
-                       // Make the number in network order
-                       try {
-                               long a = 0;
-                               long val = 0;
-                               for (int i = 0; i < ips.Length; i++) {
-                                       string subnet = ips [i];
-                                       if ((3 <= subnet.Length && subnet.Length <= 4) &&
-                                           (subnet [0] == '0') && (subnet [1] == 'x' || subnet [1] == 'X')) {
-                                               if (subnet.Length == 3)
-                                                       val = (byte) Uri.FromHex (subnet [2]);
-                                               else 
-                                                       val = (byte) ((Uri.FromHex (subnet [2]) << 4) | Uri.FromHex (subnet [3]));
-                                       } else if (subnet.Length == 0)
-                                               return null;
-                                       else if (subnet [0] == '0') {
-                                               // octal
-                                               val = 0;
-                                               for (int j = 1; j < subnet.Length; j++) {
-                                                       if ('0' <= subnet [j] && subnet [j] <= '7')
-                                                               val = (val << 3) + subnet [j] - '0';
-                                                       else
-                                                               return null;
-                                               }
-                                       }
-                                       else {
-                                               if (!Int64.TryParse (subnet, NumberStyles.None, null, out val))
-                                                       return null;
-                                       }
-
-                                       if (i == (ips.Length - 1)) {
-                                               if (i != 0  && val >= (256 << ((3 - i) * 8)))
-                                                       return null;
-                                               else if (val > 0xffffffff)
-                                                       return null;
-                                               i = 3;
-                                       } else if (val >= 0x100)
-                                               return null;
-                                       for (int j = 0; val > 0; j++, val /= 0x100)
-                                               a |= (val & 0xFF) << ((i - j) << 3);
-                               }
-
-                               return (new IPAddress (a));
-                       } catch (Exception) {
-                               return null;
-                       }
-               }
-               
-               private static IPAddress ParseIPV6 (string ip)
-               {
-                       IPv6Address newIPv6Address;
-
-                       if (IPv6Address.TryParse(ip, out newIPv6Address))
-                               return  new IPAddress (newIPv6Address.Address, newIPv6Address.ScopeId);
-                       return null;
-               }
-
-               [Obsolete("This property is obsolete. Use GetAddressBytes.")]
-               public long Address 
-               {
-                       get {
-                               if(m_Family != AddressFamily.InterNetwork)
-                                       throw new Exception("The attempted operation is not supported for the type of object referenced");
-
-                               return m_Address;
-                       }
-                       set {
-                               /* no need to do this test, ms.net accepts any value.
-                               if (value < 0 || value > 0x00000000FFFFFFFF)
-                                       throw new ArgumentOutOfRangeException (
-                                               "the address must be between 0 and 0xFFFFFFFF");
-                               */
-
-                               if(m_Family != AddressFamily.InterNetwork)
-                                       throw new Exception("The attempted operation is not supported for the type of object referenced");
-
-                               m_Address = value;
-                       }
-               }
-
-               internal long InternalIPv4Address {
-                       get { return m_Address; }
-               }
-
-               public bool IsIPv6LinkLocal {
-                       get {
-                               if (m_Family == AddressFamily.InterNetwork)
-                                       return false;
-                               int v = NetworkToHostOrder ((short) m_Numbers [0]) & 0xFFF0;
-                               return 0xFE80 <= v && v < 0xFEC0;
-                       }
-               }
-
-               public bool IsIPv6SiteLocal {
-                       get {
-                               if (m_Family == AddressFamily.InterNetwork)
-                                       return false;
-                               int v = NetworkToHostOrder ((short) m_Numbers [0]) & 0xFFF0;
-                               return 0xFEC0 <= v && v < 0xFF00;
-                       }
-               }
-
-               public bool IsIPv6Multicast {
-                       get {
-                               return m_Family != AddressFamily.InterNetwork &&
-                                       ((ushort) NetworkToHostOrder ((short) m_Numbers [0]) & 0xFF00) == 0xFF00;
-                       }
-               }
-
-               public bool IsIPv6Teredo {
-                       get {
-                               return m_Family != AddressFamily.InterNetwork &&
-                                       NetworkToHostOrder ((short) m_Numbers [0]) == 0x2001 &&
-                                       m_Numbers[1] == 0;
-                       }
-               }
-
-               public long ScopeId {
-                       get {
-                               if (m_Family != AddressFamily.InterNetworkV6)
-                                       throw new SocketException ((int) SocketError.OperationNotSupported);
-
-                               return m_ScopeId;
-                       }
-                       set {
-                               if (m_Family != AddressFamily.InterNetworkV6)
-                                       throw new SocketException ((int) SocketError.OperationNotSupported);
-                               if ((value < 0) || (value > UInt32.MaxValue))
-                                       throw new ArgumentOutOfRangeException ();
-
-                               m_ScopeId = value;
-                       }
-               }
-
-               public byte [] GetAddressBytes () 
-               {
-                       if(m_Family == AddressFamily.InterNetworkV6) {
-                               byte [] addressBytes = new byte [16];
-                               Buffer.BlockCopy (m_Numbers, 0, addressBytes, 0, 16);
-                               return addressBytes;
-                       } else {
-                               return new byte [4] { (byte)(m_Address & 0xFF),
-                                                    (byte)((m_Address >> 8) & 0xFF),
-                                                    (byte)((m_Address >> 16) & 0xFF),
-                                                    (byte)(m_Address >> 24) }; 
-                       }
-               }
-
-               public AddressFamily AddressFamily 
-               {
-                       get {
-                               return m_Family;
-                       }
-               }
-
-#if NET_4_5
-
-               public IPAddress MapToIPv4 ()
-               {
-                       if (AddressFamily == AddressFamily.InterNetwork)
-                               return this;
-                       if (AddressFamily != AddressFamily.InterNetworkV6)
-                               throw new Exception ("Only AddressFamily.InterNetworkV6 can be converted to IPv4");
-
-                       //Test for 0000 0000 0000 0000 0000 FFFF xxxx xxxx
-                       for (int i = 0; i < 5; i++) {
-                               if (m_Numbers [i] != 0x0000)
-                                       throw new Exception ("Address does not have the ::FFFF prefix");
-                       }
-                       if (m_Numbers [5] != 0xFFFF)
-                               throw new Exception ("Address does not have the ::FFFF prefix");
-
-                       //We've got an IPv4 address
-                       byte [] ipv4Bytes = new byte [4];
-                       Buffer.BlockCopy (m_Numbers, 12, ipv4Bytes, 0, 4);
-                       return new IPAddress (ipv4Bytes);
-               }
-
-               public IPAddress MapToIPv6 ()
-               {
-                       if (AddressFamily == AddressFamily.InterNetworkV6)
-                               return this;
-                       if (AddressFamily != AddressFamily.InterNetwork)
-                               throw new Exception ("Only AddressFamily.InterNetworkV4 can be converted to IPv6");
-
-                       byte [] ipv4Bytes = GetAddressBytes ();
-                       byte [] ipv6Bytes = new byte [16] {
-                               0,0, 0,0, 0,0, 0,0, 0,0, 0xFF,0xFF,
-                               ipv4Bytes [0], ipv4Bytes [1], ipv4Bytes [2], ipv4Bytes [3]
-                       };
-                       return new IPAddress (ipv6Bytes);
-               }
-
-#endif
-
-               /// <summary>
-               ///   Used to tell whether an address is a loopback.
-               ///   All IP addresses of the form 127.X.Y.Z, where X, Y, and Z are in 
-               ///   the range 0-255, are loopback addresses.
-               /// </summary>
-               /// <param name="addr">Address to compare</param>
-               /// <returns></returns>
-               public static bool IsLoopback (IPAddress address)
-               {
-                       if(address.m_Family == AddressFamily.InterNetwork)
-                               return (address.m_Address & 0xFF) == 127;
-                       else {
-                               for(int i=0; i<6; i++) {
-                                       if(address.m_Numbers[i] != 0)
-                                               return false;
-                               }
-
-                               return NetworkToHostOrder((short)address.m_Numbers[7]) == 1;
-                       }
-               }
-
-               /// <summary>
-               ///   Overrides System.Object.ToString to return
-               ///   this object rendered in a quad-dotted notation
-               /// </summary>
-               public override string ToString ()
-               {
-                       if(m_Family == AddressFamily.InterNetwork)
-                               return ToString (m_Address);
-                       else
-                       {
-                               ushort[] numbers = m_Numbers.Clone() as ushort[];
-
-                               for(int i=0; i<numbers.Length; i++)
-                                       numbers[i] = (ushort)NetworkToHostOrder((short)numbers[i]);
-
-                               IPv6Address v6 = new IPv6Address(numbers);
-                               v6.ScopeId = ScopeId;
-                               return v6.ToString();
-                       }
-               }
-
-               /// <summary>
-               ///   Returns this object rendered in a quad-dotted notation
-               /// </summary>
-               static string ToString (long addr)
-               {
-                       // addr is in network order
-                       return  (addr & 0xff).ToString () + "." +
-                               ((addr >> 8) & 0xff).ToString () + "." +
-                               ((addr >> 16) & 0xff).ToString () + "." +
-                               ((addr >> 24) & 0xff).ToString ();
-               }
-
-               /// <returns>
-               ///   Whether both objects are equal.
-               /// </returns>
-               public override bool Equals (object comparand)
-               {
-                       IPAddress otherAddr = comparand as IPAddress;
-                       if (otherAddr != null){
-                               if(AddressFamily != otherAddr.AddressFamily)
-                                       return false;
-
-                               if(AddressFamily == AddressFamily.InterNetwork) {
-                                       return m_Address == otherAddr.m_Address;
-                               } else {
-                                       ushort[] vals = otherAddr.m_Numbers;
-
-                                       for(int i=0; i<8; i++)
-                                               if(m_Numbers[i] != vals[i])
-                                                       return false;
-
-                                       return true;
-                               }
-                       }
-                       return false;
-               }
-
-               public override int GetHashCode ()
-               {
-                       if(m_Family == AddressFamily.InterNetwork)
-                               return (int)m_Address;
-                       else
-                               return Hash (((((int) m_Numbers[0]) << 16) + m_Numbers [1]), 
-                                       ((((int) m_Numbers [2]) << 16) + m_Numbers [3]),
-                                       ((((int) m_Numbers [4]) << 16) + m_Numbers [5]),
-                                       ((((int) m_Numbers [6]) << 16) + m_Numbers [7]));
-               }
-
-               private static int Hash (int i, int j, int k, int l) 
-               {
-                       return i ^ (j << 13 | j >> 19) ^ (k << 26 | k >> 6) ^ (l << 7 | l >> 25);
-               }
-
-#pragma warning disable 169
-               // Added for serialization compatibility with MS.NET
-               private int m_HashCode;
-#pragma warning restore
-               
-       }
-}
diff --git a/mcs/class/System/System.Net/IPEndPoint.cs b/mcs/class/System/System.Net/IPEndPoint.cs
deleted file mode 100644 (file)
index a6982a1..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-//
-// System.Net.IPEndPoint.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Net.Sockets;
-
-namespace System.Net {
-       [Serializable]
-       public class IPEndPoint : EndPoint {
-
-               private IPAddress address;
-               private int port;
-
-               public const int MaxPort = 65535;
-               public const int MinPort = 0;
-               
-               public IPEndPoint (IPAddress address, int port)
-               {
-                       if (address == null)
-                               throw new ArgumentNullException ("address");
-
-                       Address = address;
-                       Port = port;
-               }
-               
-               public IPEndPoint (long address, int port)
-               {
-                       Address = new IPAddress (address);
-                       Port = port;
-               }
-
-               public IPAddress Address {
-                       get {
-                               return (address);
-                       }
-                       set {
-                               address=value;
-                       }
-               }
-
-               public override AddressFamily AddressFamily {
-                       get {
-                               return address.AddressFamily;
-                       }
-               }
-
-               public int Port {
-                       get {
-                               return port;
-                       }
-                       set {
-                               // LAMESPEC: no mention of sanity checking
-                               // PS: MS controls the range when setting the value
-                               if (value < MinPort || value > MaxPort)
-                                       throw new ArgumentOutOfRangeException ("Invalid port");
-                       
-                               port = value;
-                       }
-               }
-
-               // bytes 2 and 3 store the port, the rest
-               // stores the address
-               public override EndPoint Create (SocketAddress socketAddress)
-               {
-                       if (socketAddress == null)
-                               throw new ArgumentNullException ("socketAddress");
-
-                       if (socketAddress.Family != AddressFamily)
-                               throw new ArgumentException ("The IPEndPoint was created using " + AddressFamily + 
-                                               " AddressFamily but SocketAddress contains " + socketAddress.Family + 
-                                               " instead, please use the same type.");
-
-                       SocketAddress sockaddr = socketAddress;
-                       int size =sockaddr.Size;
-                       AddressFamily family = sockaddr.Family;
-                       int port;
-
-                       IPEndPoint ipe = null;
-                       switch(family)
-                       {
-                               case AddressFamily.InterNetwork:
-                                       if (size < 8) {
-                                               return(null);
-                                       }
-                                       
-                                       port = (((int)sockaddr[2])<<8) + (int)sockaddr[3];
-                                       long address=(((long)sockaddr[7])<<24) +
-                                               (((long)sockaddr[6])<<16) +
-                                               (((long)sockaddr[5])<<8) +
-                                               (long)sockaddr[4];
-
-                                       ipe = new IPEndPoint(address, port);
-                                       break;
-                               case AddressFamily.InterNetworkV6:
-                                       if (size < 28) {
-                                               return(null);
-                                       }
-                                       
-                                       port    = (((int)sockaddr[2])<<8) + (int)sockaddr[3];
-
-                                       /// maybe flowid ?
-                                       /*
-                                       int unknown     = (int)sockaddr[4] +
-                                               (((int)sockaddr[5])<<8) +
-                                               (((int)sockaddr[6])<<16) +
-                                               (((int)sockaddr[7])<<24);
-                                       */
-
-                                       int scopeId     = (int)sockaddr[24] +
-                                               (((int)sockaddr[25])<<8) +
-                                               (((int)sockaddr[26])<<16) +
-                                               (((int)sockaddr[27])<<24);
-
-                                       ushort[] addressData = new ushort[8];
-                                       for(int i=0; i<8; i++)
-                                               addressData[i] = (ushort)((sockaddr[8+i*2] << 8) + sockaddr[8+i*2+1]);
-
-                                       ipe = new IPEndPoint (new IPAddress(addressData, scopeId), port);
-                                       break;
-                               default:
-                                       return null;
-                       }
-
-                       return(ipe);
-               }
-
-               public override SocketAddress Serialize() {
-                       SocketAddress sockaddr = null;
-
-                       switch (address.AddressFamily)
-                       {
-                               case AddressFamily.InterNetwork:
-                                       // .net produces a 16 byte buffer, even though
-                                       // only 8 bytes are used. I guess its just a
-                                       // holdover from struct sockaddr padding.
-                                       sockaddr = new SocketAddress(AddressFamily.InterNetwork, 16);
-
-                                       // bytes 2 and 3 store the port, the rest
-                                       // stores the address
-                                       sockaddr [2] = (byte) ((port>>8) & 0xff);
-                                       sockaddr [3] = (byte) (port & 0xff);
-                                       long addr = address.InternalIPv4Address;
-                                       sockaddr [4] = (byte) (addr & 0xff);
-                                       sockaddr [5] = (byte) ((addr >> 8) & 0xff);
-                                       sockaddr [6] = (byte) ((addr >> 16) & 0xff);
-                                       sockaddr [7] = (byte) ((addr >> 24) & 0xff);
-                                       break;
-
-                               case AddressFamily.InterNetworkV6:
-                                       sockaddr = new SocketAddress(AddressFamily.InterNetworkV6, 28);
-
-                                       sockaddr [2] = (byte) ((port>>8) & 0xff);
-                                       sockaddr [3] = (byte) (port & 0xff);
-
-                                       byte[] addressBytes = address.GetAddressBytes();
-                                       for(int i=0; i<16; i++)
-                                               sockaddr[8+i] = addressBytes[i];
-                                       
-                                       sockaddr [24] = (byte) (address.ScopeId & 0xff);
-                                       sockaddr [25] = (byte) ((address.ScopeId >> 8) & 0xff);
-                                       sockaddr [26] = (byte) ((address.ScopeId >> 16) & 0xff);
-                                       sockaddr [27] = (byte) ((address.ScopeId >> 24) & 0xff);
-                                       break;
-                       }
-
-                       return(sockaddr);
-               }
-
-               public override string ToString() {
-                       return(address.ToString() + ":" + port);
-               }
-
-               public override bool Equals (object comparand)
-               {
-                       IPEndPoint p = comparand as IPEndPoint;
-                       return p != null && 
-                              p.port == port && 
-                              p.address.Equals (address);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return address.GetHashCode () + port;
-               }
-       }
-}
diff --git a/mcs/class/System/System.Net/IPHostEntry.cs b/mcs/class/System/System.Net/IPHostEntry.cs
deleted file mode 100644 (file)
index aedcbab..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// System.Net.IPHostEntry.cs
-//
-// Author: Mads Pultz (mpultz@diku.dk)
-//
-// (C) Mads Pultz, 2001
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Net {
-       
-       public class IPHostEntry {
-               private IPAddress[] addressList;
-               private String[] aliases;
-               private String hostName;
-               
-               public IPHostEntry() {
-               }
-               
-               public IPAddress[] AddressList {
-                       get { return addressList; }
-                       set { addressList = value; }
-               }
-               
-               public string[] Aliases {
-                       get { return aliases; }
-                       set { aliases = value; }
-               }
-               
-               public string HostName {
-                       get { return hostName; }
-                       set { hostName = value; }
-               }
-               
-/* According to the .NET Framework SDK Documentation (beta 2) the following
-   methods from Object are not overrided. I implemented them before realizing
-   this but I leave the implementation here if needed in the future.
-   
-               public override string ToString() {
-                       string res = hostName;
-                       if (addressList != null && addressList.Length > 0)
-                               res += " [" + addressList[0] + "]";
-                       return res;
-               }
-               
-               public override bool Equals(object obj) {
-                       if (obj is IPHostEntry) {
-                               IPHostEntry h = (IPHostEntry)obj;
-                               return hostName.Equals(h.HostName) && aliases.Equals(h.Aliases) &&
-                                       addressList.Equals(h.AddressList);
-                       }
-                       else
-                         return false;
-               }
-               
-               public override int GetHashCode() {
-                       return hostName.GetHashCode();
-               }
-               
-               protected new object MemberwiseClone() {
-                       IPHostEntry res = new IPHostEntry();
-                       res.AddressList = new IPAddress[addressList.Length];
-                       Array.Copy(addressList, res.AddressList, addressList.Length);
-                       res.Aliases = new String[aliases.Length];
-                       Array.Copy(aliases, res.Aliases, aliases.Length);
-                       res.HostName = hostName;
-                       return res;
-               }
-*/
-       }
-}
-
index d2103b24f79699e5e547a23fe75181cec7a8eb7a..3592427d41e04b17fea2d4af5700ea4a14a1bd1c 100644 (file)
@@ -1,16 +1,8 @@
 //\r
-// System.Net.IPv6Address.cs\r
+// System.Net.IPv6AddressFormatter.cs\r
 //\r
 // Author:\r
 //   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-// Note I: This class is not defined in the specs of .Net\r
-//\r
-// Note II : The name of this class is perhaps unfortunate as it turns\r
-//           out that in ms.net there's an internal class called\r
-//           IPv6Address in namespace System.\r
-//\r
-\r
 //\r
 // Permission is hereby granted, free of charge, to any person obtaining\r
 // a copy of this software and associated documentation files (the\r
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\r
 \r
-\r
-using System;\r
 using System.Globalization;\r
-using System.Net.Sockets;\r
-using System.Runtime.InteropServices;\r
 using System.Text;\r
 \r
 namespace System.Net {\r
 \r
-       /// <remarks>\r
-       ///   Encapsulates an IPv6 Address.\r
-       ///   See RFC 2373 for more info on IPv6 addresses.\r
-       /// </remarks>\r
-       [Serializable]\r
-       internal class IPv6Address {\r
-               private ushort [] address;\r
-               private int prefixLength;\r
-               private long scopeId = 0;\r
-\r
-               public static readonly IPv6Address Loopback = IPv6Address.Parse ("::1");\r
-               public static readonly IPv6Address Unspecified = IPv6Address.Parse ("::");\r
+       struct IPv6AddressFormatter\r
+       {\r
+               ushort [] address;\r
+               long scopeId;\r
 \r
-               public IPv6Address (ushort [] addr)\r
-               {\r
-                       if (addr == null)\r
-                               throw new ArgumentNullException ("addr");       \r
-                       if (addr.Length != 8)   \r
-                               throw new ArgumentException ("addr");\r
-                       address = addr;                 \r
-               }\r
-               \r
-               public IPv6Address (ushort [] addr, int prefixLength) : this (addr)\r
-               {\r
-                       if (prefixLength < 0 || prefixLength > 128)\r
-                               throw new ArgumentException ("prefixLength");\r
-                       this.prefixLength = prefixLength;\r
-               }\r
-       \r
-               public IPv6Address (ushort [] addr, int prefixLength, int scopeId) : this (addr, prefixLength)\r
+               public IPv6AddressFormatter (ushort[] addr, long scopeId)\r
                {\r
+                       this.address = addr;\r
                        this.scopeId = scopeId;\r
                }\r
 \r
-               public static IPv6Address Parse (string ipString)\r
-               {\r
-                       if (ipString == null)\r
-                               throw new ArgumentNullException ("ipString");\r
-\r
-                       IPv6Address result;\r
-                       if (TryParse (ipString, out result))\r
-                               return result;\r
-                       throw new FormatException ("Not a valid IPv6 address");\r
-               }\r
-\r
-               static int Fill (ushort [] addr, string ipString)\r
-               {\r
-                       int p = 0;\r
-                       int pdigits = 0;\r
-                       int slot = 0;\r
-\r
-                       if (ipString.Length == 0)\r
-                               return 0;\r
-                       \r
-                       // Catch double uses of ::\r
-                       if (ipString.IndexOf ("::", StringComparison.Ordinal) != -1)\r
-                               return -1;\r
-\r
-                       for (int i = 0; i < ipString.Length; i++){\r
-                               char c = ipString [i];\r
-                               int n;\r
-\r
-                               if (c == ':'){\r
-                                       // Leading : is not allowed.\r
-                                       if (i == 0)\r
-                                               return -1;\r
-                                      \r
-                                       // Trailing : is not allowed.\r
-                                       if (i == ipString.Length-1)\r
-                                               return -1;\r
-                                       \r
-                                       if (slot == 8)\r
-                                               return -1;\r
-                                       \r
-                                       addr [slot++] = (ushort) p;\r
-                                       p = 0;\r
-                                       pdigits = 0;\r
-                                       continue;\r
-                               }\r
-                               pdigits++;\r
-                               if (pdigits > 4)\r
-                                       return -1;\r
-                               if ('0' <= c && c <= '9')\r
-                                       n = (int) (c - '0');\r
-                               else if ('a' <= c && c <= 'f')\r
-                                       n = (int) (c - 'a' + 10);\r
-                               else if ('A' <= c && c <= 'F')\r
-                                       n = (int) (c - 'A' + 10);\r
-                               else \r
-                                       return -1;\r
-                               p = (p << 4) + n;\r
-                               if (p > UInt16.MaxValue)\r
-                                       return -1;\r
-                       }\r
-\r
-                       if (slot == 8)\r
-                               return -1;\r
-                       \r
-                       addr [slot++] = (ushort) p;\r
-\r
-                       return slot;\r
-               }\r
-\r
-               static bool TryParse (string prefix, out int res)\r
-               {\r
-                       return Int32.TryParse (prefix, NumberStyles.Integer, CultureInfo.InvariantCulture, out res);\r
-               }\r
-               \r
-               public static bool TryParse (string ipString, out IPv6Address result)\r
-               {\r
-                       result = null;\r
-                       if (ipString == null)\r
-                               return false;\r
-\r
-                       if (ipString.Length > 2 && \r
-                           ipString [0] == '[' && \r
-                           ipString [ipString.Length - 1] == ']')\r
-                               ipString = ipString.Substring (1, ipString.Length - 2);\r
-\r
-                       if (ipString.Length  < 2)\r
-                               return false;\r
-\r
-                       int prefixLen = 0;\r
-                       int scopeId = 0;\r
-                       int pos = ipString.LastIndexOf ('/');\r
-                       if (pos != -1) {\r
-                               string prefix = ipString.Substring (pos + 1);\r
-                               if (!TryParse (prefix , out prefixLen))\r
-                                       prefixLen = -1;\r
-                               if (prefixLen < 0 || prefixLen > 128)\r
-                                       return false;\r
-                               ipString = ipString.Substring (0, pos);\r
-                       } else {\r
-                               pos = ipString.LastIndexOf ('%');\r
-                               if (pos != -1) {\r
-                                       string prefix = ipString.Substring (pos + 1);\r
-                                       if (!TryParse (prefix, out scopeId))\r
-                                               scopeId = 0;\r
-                                       ipString = ipString.Substring (0, pos);\r
-                               }                       \r
-                       }\r
-\r
-                       //\r
-                       // At this point the prefix/suffixes have been removed\r
-                       // and we only have to deal with the ipv4 or ipv6 addressed\r
-                       //\r
-                       ushort [] addr = new ushort [8];\r
-\r
-                       //\r
-                       // Is there an ipv4 address at the end?\r
-                       //\r
-                       int pos2 = ipString.LastIndexOf (':');\r
-                       if (pos2 == -1)\r
-                               return false;\r
-\r
-                       int slots = 0;\r
-                       if (pos2 < (ipString.Length - 1)) {\r
-                               string ipv4Str = ipString.Substring (pos2 + 1);\r
-                               if (ipv4Str.IndexOf ('.') != -1) {\r
-                                       IPAddress ip;\r
-                                       \r
-                                       if (!IPAddress.TryParse (ipv4Str, out ip))\r
-                                               return false;\r
-                                       \r
-                                       long a = ip.InternalIPv4Address;\r
-                                       addr [6] = (ushort) (((int) (a & 0xff) << 8) + ((int) ((a >> 8) & 0xff)));\r
-                                       addr [7] = (ushort) (((int) ((a >> 16) & 0xff) << 8) + ((int) ((a >> 24) & 0xff)));\r
-                                       if (pos2 > 0 && ipString [pos2 - 1] == ':') \r
-                                               ipString = ipString.Substring (0, pos2 + 1);\r
-                                       else\r
-                                               ipString = ipString.Substring (0, pos2);\r
-                                       slots = 2;\r
-                               }\r
-                       }       \r
-\r
-                       //\r
-                       // Only an ipv6 block remains, either:\r
-                       // "hexnumbers::hexnumbers", "hexnumbers::" or "hexnumbers"\r
-                       //\r
-                       int c = ipString.IndexOf ("::", StringComparison.Ordinal);\r
-                       if (c != -1){\r
-                               int right_slots = Fill (addr, ipString.Substring (c+2));\r
-                               if (right_slots == -1){\r
-                                       return false;\r
-                               }\r
-\r
-                               if (right_slots + slots > 8){\r
-                                       return false;\r
-                               }\r
-\r
-                               int d = 8-slots-right_slots;\r
-                               for (int i = right_slots; i > 0; i--){\r
-                                       addr [i+d-1] = addr [i-1];\r
-                                       addr [i-1] = 0;\r
-                               }\r
-                               \r
-                               int left_slots = Fill (addr, ipString.Substring (0, c));\r
-                               if (left_slots == -1)\r
-                                       return false;\r
-\r
-                               if (left_slots + right_slots + slots > 7)\r
-                                       return false;\r
-                       } else {\r
-                               if (Fill (addr, ipString) != 8-slots)\r
-                                       return false;\r
-                       }\r
-\r
-                       result = new IPv6Address (addr, prefixLen, scopeId);\r
-                       return true;\r
-               }\r
-\r
-               public ushort [] Address {\r
-                       get { return address; }\r
-               }\r
-\r
-               public int PrefixLength {\r
-                       get { return this.prefixLength; }\r
-               }\r
-               \r
-               public long ScopeId {\r
-                       get {\r
-                               return scopeId;\r
-                       }\r
-                       set {\r
-                               scopeId = value;\r
-                       }\r
-               }\r
-\r
-               public ushort this [int index] {\r
-                       get { return address [index]; }\r
-               }               \r
-\r
-               public AddressFamily AddressFamily {\r
-                       get { return AddressFamily.InterNetworkV6; }\r
-               }\r
-\r
-               public static bool IsLoopback (IPv6Address addr)\r
-               {\r
-                       if (addr.address [7] != 1)\r
-                               return false;\r
-\r
-                       int x = addr.address [6] >> 8;\r
-                       if (x != 0x7f && x != 0)\r
-                               return false;\r
-\r
-                       for (int i = 0; i < 4; i++) {\r
-                               if (addr.address [i] != 0)\r
-                                       return false;\r
-                       }\r
-\r
-                       if (addr.address [5] != 0 && addr.address [5] != 0xffff)\r
-                               return false;\r
-\r
-                       return true;\r
-               }\r
-\r
-               private static ushort SwapUShort (ushort number)\r
+               static ushort SwapUShort (ushort number)\r
                {\r
                        return (ushort) ( ((number >> 8) & 0xFF) + ((number << 8) & 0xFF00) );\r
                }\r
 \r
                // Convert the address into a format expected by the IPAddress (long) ctor\r
                // This needs to be unsigned to satisfy the '> 1' test in IsIPv4Compatible()\r
-               private uint AsIPv4Int ()\r
+               uint AsIPv4Int ()\r
                {\r
                        return (uint)(SwapUShort (address [7]) << 16) + SwapUShort (address [6]);\r
                }                       \r
 \r
-               public bool IsIPv4Compatible ()\r
+               bool IsIPv4Compatible ()\r
                {\r
                        for (int i = 0; i < 6; i++) \r
                                if (address [i] != 0)\r
@@ -323,7 +66,7 @@ namespace System.Net {
                        return (AsIPv4Int () > 1);\r
                }\r
                \r
-               public bool IsIPv4Mapped ()\r
+               bool IsIPv4Mapped ()\r
                {\r
                        for (int i = 0; i < 5; i++) \r
                                if (address [i] != 0)\r
@@ -338,10 +81,6 @@ namespace System.Net {
                        return address [5] == 0xffff;\r
                }\r
                \r
-               /// <summary>\r
-               ///   Overrides System.Object.ToString to return\r
-               ///   this object rendered in a canonicalized notation\r
-               /// </summary>\r
                public override string ToString ()\r
                {\r
                        StringBuilder s = new StringBuilder ();\r
@@ -358,112 +97,52 @@ namespace System.Net {
 \r
                                return s.ToString ();\r
                        }\r
-                       else\r
-                       {\r
-                               int bestChStart = -1; // Best chain start\r
-                               int bestChLen = 0; // Best chain length\r
-                               int currChLen = 0; // Current chain length\r
+                       \r
+                       int bestChStart = -1; // Best chain start\r
+                       int bestChLen = 0; // Best chain length\r
+                       int currChLen = 0; // Current chain length\r
 \r
-                               // Looks for the longest zero chain\r
-                               for (int i=0; i<8; i++)\r
+                       // Looks for the longest zero chain\r
+                       for (int i=0; i<8; i++)\r
+                       {\r
+                               if (address[i] != 0)\r
                                {\r
-                                       if (address[i] != 0)\r
+                                       if ((currChLen > bestChLen) \r
+                                               && (currChLen > 1))\r
                                        {\r
-                                               if ((currChLen > bestChLen) \r
-                                                       && (currChLen > 1))\r
-                                               {\r
-                                                       bestChLen = currChLen;\r
-                                                       bestChStart = i - currChLen;\r
-                                               }\r
-                                               currChLen = 0;\r
+                                               bestChLen = currChLen;\r
+                                               bestChStart = i - currChLen;\r
                                        }\r
-                                       else\r
-                                               currChLen++;\r
-                               }\r
-                               if ((currChLen > bestChLen) \r
-                                       && (currChLen > 1))\r
-                               {\r
-                                       bestChLen = currChLen;\r
-                                       bestChStart = 8 - currChLen;\r
+                                       currChLen = 0;\r
                                }\r
+                               else\r
+                                       currChLen++;\r
+                       }\r
+                       if ((currChLen > bestChLen) \r
+                               && (currChLen > 1))\r
+                       {\r
+                               bestChLen = currChLen;\r
+                               bestChStart = 8 - currChLen;\r
+                       }\r
 \r
-                               // makes the string\r
-                               if (bestChStart == 0)\r
-                                       s.Append(":");\r
-                               for (int i=0; i<8; i++)\r
+                       // makes the string\r
+                       if (bestChStart == 0)\r
+                               s.Append(":");\r
+                       for (int i=0; i<8; i++)\r
+                       {\r
+                               if (i == bestChStart)\r
                                {\r
-                                       if (i == bestChStart)\r
-                                       {\r
-                                               s.Append (":");\r
-                                               i += (bestChLen - 1);\r
-                                               continue;\r
-                                       }\r
-                                       s.AppendFormat("{0:x}", address [i]);\r
-                                       if (i < 7) s.Append (':');\r
+                                       s.Append (":");\r
+                                       i += (bestChLen - 1);\r
+                                       continue;\r
                                }\r
+                               s.AppendFormat("{0:x}", address [i]);\r
+                               if (i < 7) s.Append (':');\r
                        }\r
+                       \r
                        if (scopeId != 0)\r
                                s.Append ('%').Append (scopeId);\r
                        return s.ToString ();\r
                }\r
-\r
-               public string ToString (bool fullLength)\r
-               {\r
-                       if (!fullLength)\r
-                               return ToString ();\r
-\r
-                       StringBuilder sb = new StringBuilder ();\r
-                       for (int i=0; i < address.Length - 1; i++) {\r
-                               sb.AppendFormat ("{0:X4}:", address [i]);\r
-                       }\r
-                       sb.AppendFormat ("{0:X4}", address [address.Length - 1]);\r
-                       return sb.ToString ();\r
-               }\r
-\r
-               /// <returns>\r
-               ///   Whether both objects are equal.\r
-               /// </returns>\r
-               public override bool Equals (object other)\r
-               {\r
-                       System.Net.IPv6Address ipv6 = other as System.Net.IPv6Address;\r
-                       if (ipv6 != null) {\r
-                               for (int i = 0; i < 8; i++) \r
-                                       if (this.address [i] != ipv6.address [i])\r
-                                               return false;\r
-                               return true;\r
-                       }\r
-                       \r
-                       System.Net.IPAddress ipv4 = other as System.Net.IPAddress;\r
-                       if (ipv4 != null) {\r
-                               for (int i = 0; i < 5; i++) \r
-                                       if (address [i] != 0)\r
-                                               return false;\r
-\r
-                               if (address [5] != 0 && address [5] != 0xffff)\r
-                                       return false;\r
-\r
-                               long a = ipv4.InternalIPv4Address;\r
-                               if (address [6] != (ushort) (((int) (a & 0xff) << 8) + ((int) ((a >> 8) & 0xff))) ||\r
-                                   address [7] != (ushort) (((int) ((a >> 16) & 0xff) << 8) + ((int) ((a >> 24) & 0xff))))\r
-                                       return false;\r
-\r
-                               return true;\r
-                       }\r
-                       \r
-                       return false;\r
-               }\r
-\r
-               public override int GetHashCode ()\r
-               {\r
-                       return Hash (((((int) address [0]) << 16) + address [1]), \r
-                                               ((((int) address [2]) << 16) + address [3]),\r
-                                               ((((int) address [4]) << 16) + address [5]),\r
-                                               ((((int) address [6]) << 16) + address [7]));\r
-               }\r
-               \r
-               private static int Hash (int i, int j, int k, int l) \r
-               {\r
-                       return i ^ (j << 13 | j >> 19) ^ (k << 26 | k >> 6) ^ (l << 7 | l >> 25);\r
-               }\r
        }\r
 }\r
diff --git a/mcs/class/System/System.Net/IWebProxy.cs b/mcs/class/System/System.Net/IWebProxy.cs
deleted file mode 100644 (file)
index 0b0eb65..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// System.Net.IWebProxy.cs
-//
-// Author:
-//   Lawrence Pit (loz@cable.a2000.nl)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Net {
-
-       // <remarks>
-       // </remarks>
-       public interface IWebProxy {
-               ICredentials Credentials {
-                       get; 
-                       set;
-               }
-
-               Uri GetProxy (Uri destination);
-               
-               bool IsBypassed (Uri host);
-       }
-}
diff --git a/mcs/class/System/System.Net/IWebRequestCreate.cs b/mcs/class/System/System.Net/IWebRequestCreate.cs
deleted file mode 100644 (file)
index b840dea..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// System.Net.IWebRequestCreate.cs
-//
-// Author:
-//   Lawrence Pit (loz@cable.a2000.nl)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net {
-
-       public interface IWebRequestCreate {
-               WebRequest Create (Uri uri);            
-       }
-}
diff --git a/mcs/class/System/System.Net/NetworkAccess.cs b/mcs/class/System/System.Net/NetworkAccess.cs
deleted file mode 100644 (file)
index cc56568..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// NetworkAccess.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:35:58 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Net {
-       [Flags]
-       public enum NetworkAccess {
-               Accept = 128,
-
-               Connect = 64,
-       }
-
-} 
diff --git a/mcs/class/System/System.Net/ProtocolViolationException.cs b/mcs/class/System/System.Net/ProtocolViolationException.cs
deleted file mode 100644 (file)
index 0587dfe..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//\r
-// System.Net.ProtocolViolationException.cs\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System.Globalization;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class ProtocolViolationException : InvalidOperationException, ISerializable\r
-       {\r
-\r
-               // Constructors\r
-               public ProtocolViolationException () : base ()\r
-               {\r
-               }\r
-               \r
-               public ProtocolViolationException (string message) : base (message)\r
-               {\r
-               }\r
-\r
-               protected ProtocolViolationException (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-                       : base (serializationInfo, streamingContext)\r
-               {\r
-               }\r
-\r
-               // Methods\r
-               void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)\r
-               {\r
-                       base.GetObjectData (info, context);\r
-               }\r
-\r
-               public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       base.GetObjectData (serializationInfo, streamingContext);\r
-               }\r
-       }\r
-}\r
-       \r
diff --git a/mcs/class/System/System.Net/SecurityProtocolType.cs b/mcs/class/System/System.Net/SecurityProtocolType.cs
deleted file mode 100644 (file)
index 69f2fca..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Net.SecurityProtocolType.cs
-//
-// Authors
-//     Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//     Sebastien Pouliot  <sebastien@ximian.com>
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net {
-
-       [Flags]
-       public
-       enum SecurityProtocolType {
-               Ssl3 = 48,
-               Tls = 192,
-               Tls11 = 768,
-               Tls12 = 3072
-       }
-}
diff --git a/mcs/class/System/System.Net/SocketAddress.cs b/mcs/class/System/System.Net/SocketAddress.cs
deleted file mode 100644 (file)
index 463f275..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// System.Net.SocketAddress.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//   Dick Porter (dick@ximian.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Net.Sockets;
-
-namespace System.Net {
-
-       public class SocketAddress {
-               private byte[] data;
-               
-               public SocketAddress (AddressFamily family, int size)
-               {
-                       if(size<2) {
-                               throw new ArgumentOutOfRangeException("size is too small");
-                       }
-                       
-                       data=new byte[size];
-                       data[0]=(byte)family;
-                       data[1]=(byte) ((int) family >> 8);
-               }
-
-               public SocketAddress (AddressFamily family)
-                       : this (family, 32)
-               {
-               }
-               
-               //LAMESPEC: the MS doc about this class is wrong. The size is not stored in byte 1. Instead
-               // byte [0] and byte [1] hold the family (little endian).
-               public AddressFamily Family {
-                       get {
-                               return (AddressFamily) (data [0] + (data [1] << 8));
-                       }
-               }
-
-               public int Size {
-                       get {
-                               return data.Length;
-                       }
-               }
-
-               public byte this [ int offset ] {
-                       get {
-                               return(data[offset]);
-                       }
-
-                       set {
-                               data[offset]=value;
-                       }
-               }
-
-               public override string ToString() {
-                       string af=((AddressFamily)data[0]).ToString();
-                       int size = data.Length;
-                       string ret=af+":"+size+":{";
-                       
-                       for(int i=2; i<size; i++) {
-                               int val=(int)data[i];
-                               ret=ret+val;
-                               if(i<size-1) {
-                                       ret=ret+",";
-                               }
-                       }
-                       
-                       ret=ret+"}";
-                       
-                       return(ret);
-               }
-
-               public override bool Equals (object comparand)
-               {
-                       SocketAddress sa = (comparand as SocketAddress);
-                       if ((sa != null) && (sa.data.Length == data.Length)) {
-                               byte [] otherData = sa.data;
-                               for (int i = 0; i < data.Length; i++)
-                                       if (otherData [i] != data [i])
-                                               return false;
-
-                               return true;
-                       }
-
-                       return false;
-               }
-
-               public override int GetHashCode ()
-               {
-                       int code = 0;
-
-                       for (int i = 0; i < data.Length; i++)
-                               code += data [i] + i;
-
-                       return code;
-               }
-       }
-}
diff --git a/mcs/class/System/System.Net/TransportContext.cs b/mcs/class/System/System.Net/TransportContext.cs
deleted file mode 100644 (file)
index 7685687..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// TransportContext.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using System.Security.Authentication.ExtendedProtection;
-
-namespace System.Net
-{
-       public abstract class TransportContext
-       {
-               public abstract ChannelBinding GetChannelBinding (ChannelBindingKind kind);
-       }
-}
-
diff --git a/mcs/class/System/System.Net/TransportType.cs b/mcs/class/System/System.Net/TransportType.cs
deleted file mode 100644 (file)
index d1f9c56..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// TransportType.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:32:18 UTC
-// Source file: AllTypes.xml
-// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Net {
-
-
-       /// <summary>
-       /// </summary>
-       public enum TransportType {
-
-               /// <summary>
-               /// </summary>
-               Udp = 1,
-
-               /// <summary>
-               /// </summary>
-               Connectionless = 1,
-
-               /// <summary>
-               /// </summary>
-               Tcp = 2,
-
-               /// <summary>
-               /// </summary>
-               ConnectionOriented = 2,
-
-               /// <summary>
-               /// </summary>
-               All = 3,
-       } // TransportType
-
-} // System.Net
diff --git a/mcs/class/System/System.Net/UploadProgressChangedEventHandler.cs b/mcs/class/System/System.Net/UploadProgressChangedEventHandler.cs
deleted file mode 100644 (file)
index af1853e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// UploadProgressChangedEventHandler.cs
-//
-// Author:
-//     Atsushi Enomoto  <atsushi@ximian.com>
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-namespace System.Net
-{
-       public delegate void UploadProgressChangedEventHandler (object sender, UploadProgressChangedEventArgs e);
-}
-
index f4f61725fb440e500fa5b40060cf7a489f6ec3d6..38ecf8efa340daaa4b6c94cc421ab72ac3e1840f 100644 (file)
@@ -261,7 +261,7 @@ namespace System.Net
                                        var auth = AuthenticationManager.Authenticate (challenge [i], connect_request, creds);
                                        if (auth == null)
                                                continue;
-                                       ntlm = (auth.Module.AuthenticationType == "NTLM");
+                                       ntlm = (auth.ModuleAuthenticationType == "NTLM");
                                        sb.Append ("\r\nProxy-Authorization: ");
                                        sb.Append (auth.Message);
                                        break;
index 295ee6757dc9c6df48202cbe65feb22dc4fdf17d..9f8ed04955b1036095f1b64d5c87482c010e7958 100644 (file)
@@ -480,7 +480,7 @@ namespace System.Net
                                                        AsyncCallback cb, object state)
                {
                        if (request.Aborted)
-                               throw new WebException ("The request was canceled.", null, WebExceptionStatus.RequestCanceled);
+                               throw new WebException ("The request was canceled.", WebExceptionStatus.RequestCanceled);
 
                        if (isRead)
                                throw new NotSupportedException ("this stream does not allow writing");
@@ -675,7 +675,7 @@ namespace System.Net
                                } catch (WebException e) {
                                        result.SetCompleted (false, e);
                                } catch (Exception e) {
-                                       result.SetCompleted (false, new WebException ("Error writing headers", e, WebExceptionStatus.SendFailure));
+                                       result.SetCompleted (false, new WebException ("Error writing headers", WebExceptionStatus.SendFailure, WebExceptionInternalStatus.RequestFatal, e));
                                }
                        }, null);
 
@@ -814,7 +814,7 @@ namespace System.Net
                                IOException io = new IOException ("Cannot close the stream until all bytes are written");
                                nextReadCalled = true;
                                cnc.Close (true);
-                               throw new WebException ("Request was cancelled.", io, WebExceptionStatus.RequestCanceled);
+                               throw new WebException ("Request was cancelled.", WebExceptionStatus.RequestCanceled, WebExceptionInternalStatus.RequestFatal, io);
                        }
 
                        // Commented out the next line to fix xamarin bug #1512
diff --git a/mcs/class/System/System.Net/WebException.cs b/mcs/class/System/System.Net/WebException.cs
deleted file mode 100644 (file)
index e6b3c16..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//\r
-// System.Net.WebException.cs\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class WebException : InvalidOperationException, ISerializable {\r
-               private WebResponse response;\r
-               private WebExceptionStatus status = WebExceptionStatus.UnknownError;\r
-\r
-               // Constructors\r
-               \r
-               public WebException () : base ()\r
-               {\r
-               }\r
-               \r
-               public WebException (string message) : base (message)\r
-               {\r
-               }\r
-\r
-               protected WebException (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-                       : base (serializationInfo, streamingContext)\r
-               {\r
-               }\r
-\r
-               public WebException (string message, Exception innerException)\r
-                       : base (message, innerException)\r
-               {\r
-               }\r
-\r
-               public WebException (string message, WebExceptionStatus status)\r
-                       : base (message)\r
-               {\r
-                       this.status = status;\r
-               }\r
-               \r
-               internal WebException (string message, Exception innerException, WebExceptionStatus status)\r
-                       : base (message, innerException)\r
-               {\r
-                       this.status = status;\r
-               }\r
-\r
-               public WebException(string message, \r
-                                   Exception innerException,\r
-                                   WebExceptionStatus status, \r
-                                   WebResponse response)\r
-                       : base (message, innerException)\r
-               {\r
-                       this.status = status;\r
-                       this.response = response;\r
-               }\r
-               \r
-               // Properties\r
-               \r
-               public WebResponse Response {\r
-                       get { return this.response; }\r
-               }\r
-               \r
-               public WebExceptionStatus Status {\r
-                       get { return this.status; }\r
-               }\r
-               \r
-               // Methods\r
-               void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)\r
-               {\r
-                       base.GetObjectData (info, context);\r
-               }\r
-\r
-               public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       base.GetObjectData (serializationInfo,\r
-                                           streamingContext);\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/class/System/System.Net/WebExceptionStatus.cs b/mcs/class/System/System.Net/WebExceptionStatus.cs
deleted file mode 100644 (file)
index 468a0d5..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// System.Net.WebExceptionStatus.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//   originally autogenerated by Sergey Chaban (serge@wildwestsoftware.com)
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net 
-{
-       public
-       enum WebExceptionStatus 
-       {
-               Success = 0,
-               NameResolutionFailure = 1,
-               ConnectFailure = 2,
-               ReceiveFailure = 3,
-               SendFailure = 4,
-               PipelineFailure = 5,
-               RequestCanceled = 6,
-               ProtocolError = 7,
-               ConnectionClosed = 8,
-               TrustFailure = 9,
-               SecureChannelFailure = 10,
-               ServerProtocolViolation = 11,
-               KeepAliveFailure = 12,
-               Pending = 13,
-               Timeout = 14,
-               ProxyNameResolutionFailure = 15,
-
-
-               UnknownError = 16,
-               MessageLengthLimitExceeded = 17,
-
-               CacheEntryNotFound = 18,
-               RequestProhibitedByCachePolicy = 19,
-               RequestProhibitedByProxy = 20,
-
-       }
-}
index 967a4eb0fafacd31913ede4d5ac739008cbf08a0..77b6e27aed7409a67e1c36c7e29d513005d7e131 100644 (file)
@@ -186,10 +186,10 @@ namespace System.Net
                        if (!IsHeaderValue (headerValue))
                                throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
                        
-                       AddValue (headerName, headerValue);
+                       AddInternal (headerName, headerValue);
                }
                        
-               internal void AddValue (string headerName, string headerValue)
+               internal void AddInternal (string headerName, string headerValue)
                {
                        base.Add (headerName, headerValue);                     
                }
index 889398ee6a42e98ae3341c4acb1df004b575da89..fd450c86653173ba5279441972e3d338e341400b 100644 (file)
@@ -60,6 +60,8 @@ namespace System.Net
                static IWebProxy defaultWebProxy;
                static RequestCachePolicy defaultCachePolicy;
 
+               internal const int DefaultTimeout = 100000;
+
                static WebRequest ()
                {
 #if MOBILE
@@ -454,12 +456,11 @@ namespace System.Net
 
                void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
                {
-                       throw new NotSupportedException ();
+                       GetObjectData(serializationInfo, streamingContext);
                }
 
                protected virtual void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
                {
-                       throw GetMustImplement ();
                }
 
                public static bool RegisterPrefix (string prefix, IWebRequestCreate creator)
@@ -543,6 +544,5 @@ namespace System.Net
                {
                        return Task<WebResponse>.Factory.FromAsync (BeginGetResponse, EndGetResponse, null);
                }
-
        }
 }
diff --git a/mcs/class/System/System.Net/WebRequestMethods.cs b/mcs/class/System/System.Net/WebRequestMethods.cs
deleted file mode 100644 (file)
index 1e7a7ac..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// System.Net.WebRequestMethods.cs
-//
-// Author:
-//     Carlos Alberto Cortez (calberto.oortez@gmail.com)
-//
-// (c) Copyright 2005 Novell, Inc. (http://www.ximian.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Net 
-{
-       public static class WebRequestMethods
-       {
-               public static class File
-               {
-                       public const string DownloadFile = "GET";
-                       public const string UploadFile = "PUT";
-               }
-
-               public static class Ftp
-               {
-                       public const string AppendFile = "APPE";
-                       public const string DeleteFile = "DELE";
-                       public const string DownloadFile = "RETR";
-                       public const string GetFileSize = "SIZE";
-                       public const string GetDateTimestamp = "MDTM";
-                       public const string ListDirectory = "NLST";
-                       public const string ListDirectoryDetails = "LIST";
-                       public const string MakeDirectory = "MKD";
-                       public const string PrintWorkingDirectory = "PWD";
-                       public const string RemoveDirectory = "RMD";
-                       public const string Rename = "RENAME";
-                       public const string UploadFile = "STOR";
-                       public const string UploadFileWithUniqueName = "STOU";
-               }
-
-               public static class Http
-               {
-                       public const string Connect = "CONNECT";
-                       public const string Get = "GET";
-                       public const string Head = "HEAD";
-                       public const string MkCol = "MKCOL";
-                       public const string Post = "POST";
-                       public const string Put = "PUT";
-               }
-       }
-}
-
-
diff --git a/mcs/class/System/System.Net/WebResponse.cs b/mcs/class/System/System.Net/WebResponse.cs
deleted file mode 100644 (file)
index f59b24f..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-//\r
-// System.Net.WebResponse\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public abstract class WebResponse : MarshalByRefObject, ISerializable, IDisposable {\r
-               // Constructors\r
-               \r
-               protected WebResponse () { }\r
-               \r
-               protected WebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       throw new NotSupportedException ();\r
-               }\r
-               \r
-               // Properties\r
-               \r
-               public virtual long ContentLength {             \r
-                       get { throw new NotSupportedException (); }\r
-                       set { throw new NotSupportedException (); }\r
-               }\r
-               \r
-               public virtual string ContentType {             \r
-                       get { throw new NotSupportedException (); }\r
-                       set { throw new NotSupportedException (); }\r
-               }\r
-               \r
-               public virtual WebHeaderCollection Headers {            \r
-                       get { throw new NotSupportedException (); }\r
-               }\r
-\r
-               static Exception GetMustImplement ()\r
-               {\r
-                       return new NotImplementedException ();\r
-               }\r
-               \r
-               [MonoTODO]\r
-               public virtual bool IsFromCache\r
-               {\r
-                       get {\r
-                               return false;\r
-                               // Better to return false than to kill the application\r
-                               // throw GetMustImplement ();\r
-                       }\r
-               }\r
-               \r
-               [MonoTODO]\r
-               public virtual bool IsMutuallyAuthenticated\r
-               {\r
-                       get {\r
-                               throw GetMustImplement ();\r
-                       }\r
-               }\r
-               \r
-               public virtual Uri ResponseUri {                \r
-                       get { throw new NotSupportedException (); }\r
-               }               \r
-\r
-               public virtual bool SupportsHeaders {\r
-                       get {\r
-                               // The managed stack always returns this as true, it is only\r
-                               // the Silverlight stack that does not support this.\r
-                               return true;\r
-                       }\r
-               }\r
-               // Methods\r
-               \r
-               public virtual void Close()\r
-               {\r
-                       throw new NotSupportedException ();\r
-               }\r
-               \r
-               public virtual Stream GetResponseStream()\r
-               {\r
-                       throw new NotSupportedException ();\r
-               }\r
-               public void Dispose ()\r
-               {\r
-                       Dispose (true);\r
-               }\r
-               \r
-               protected virtual void Dispose (bool disposing)\r
-               {\r
-                       if (disposing)\r
-                               Close ();\r
-               }\r
-\r
-               void ISerializable.GetObjectData\r
-                       (SerializationInfo serializationInfo,\r
-                                                 StreamingContext streamingContext)\r
-               {\r
-                       throw new NotSupportedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               protected virtual void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       throw GetMustImplement ();\r
-               }\r
-       }\r
-}\r
index 533718eb5458162f10d09a68c01a6a87c903e9e5..ba0986b2035ac00c61d527e4975edd6331287b77 100644 (file)
@@ -209,9 +209,6 @@ System.Media/SystemSound.cs
 System.Media/SystemSounds.cs
 System.Media/Win32SoundPlayer.cs
 System.Net/AuthenticationManager.cs
-System.Net/AuthenticationSchemes.cs
-System.Net/AuthenticationSchemeSelector.cs
-System.Net/Authorization.cs
 System.Net/BasicClient.cs
 System.Net/BindIPEndPoint.cs
 System.Net/ChunkedInputStream.cs
@@ -250,26 +247,19 @@ System.Net.Configuration/WebRequestModuleElementCollection.cs
 System.Net.Configuration/WebRequestModuleElement.cs
 System.Net.Configuration/WebRequestModuleHandler.cs
 System.Net.Configuration/WebRequestModulesSection.cs
-System.Net/ConnectionModes.cs
 System.Net/CredentialCache.cs
 System.Net/DecompressionMethods.cs
 System.Net/DefaultCertificatePolicy.cs
 System.Net/DigestClient.cs
 System.Net/Dns.cs
-System.Net/DnsEndPoint.cs
 System.Net/DnsPermissionAttribute.cs
 System.Net/DnsPermission.cs
-System.Net/EndPoint.cs
 System.Net/EndPointListener.cs
 System.Net/EndPointManager.cs
 System.Net/EndpointPermission.cs
-System.Net/FileWebRequestCreator.cs
-System.Net/FileWebRequest.cs
-System.Net/FileWebResponse.cs
 System.Net/FtpAsyncResult.cs
 System.Net/FtpDataStream.cs
 System.Net/FtpRequestCreator.cs
-System.Net/FtpStatusCode.cs
 System.Net/FtpWebRequest.cs
 System.Net/FtpStatus.cs
 System.Net/FtpWebResponse.cs
@@ -278,32 +268,18 @@ System.Net/HttpConnection.cs
 System.Net/HttpListenerBasicIdentity.cs
 System.Net/HttpListenerContext.cs
 System.Net/HttpListener.cs
-System.Net/HttpListenerException.cs
 System.Net/HttpListenerPrefixCollection.cs
 System.Net/HttpListenerRequest.cs
 System.Net/HttpListenerResponse.cs
 System.Net/HttpListenerTimeoutManager.cs
 System.Net/HttpRequestCreator.cs
-System.Net/HttpRequestHeader.cs
-System.Net/HttpResponseHeader.cs
-System.Net/HttpStatusCode.cs
 System.Net/HttpStreamAsyncResult.cs
-System.Net/HttpVersion.cs
 System.Net/HttpWebRequest.cs
 System.Net/HttpWebResponse.cs
-System.Net/IAuthenticationModule.cs
-System.Net/ICertificatePolicy.cs
-System.Net/ICredentialLookup.cs
 System.Net/ICredentialPolicy.cs
-System.Net/ICredentialsByHost.cs
-System.Net/IPAddress.cs
-System.Net/IPEndPoint.cs
-System.Net/IPHostEntry.cs
 System.Net/IPv6Address.cs
-System.Net/IWebProxy.cs
 System.Net/IWebProxyScript.cs
 System.Net/IWebConnectionState.cs
-System.Net/IWebRequestCreate.cs
 System.Net/ListenerAsyncResult.cs
 System.Net/ListenerPrefix.cs
 System.Net.Mail/AlternateViewCollection.cs
@@ -362,7 +338,6 @@ System.Net.Mail/SmtpStatusCode.cs
 System.Net/MacProxy.cs
 System.Net/MonoHttpDate.cs
 System.Net/NetConfig.cs
-System.Net/NetworkAccess.cs
 System.Net/NetworkCredential.cs
 System.Net.NetworkInformation/DuplicateAddressDetectionState.cs
 System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs
@@ -413,7 +388,6 @@ System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs
 System.Net.NetworkInformation/UnicastIPAddressInformation.cs
 System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs
 System.Net/NtlmClient.cs
-System.Net/ProtocolViolationException.cs
 System.Net/RequestStream.cs
 System.Net/ResponseStream.cs
 ../referencesource/System/net/System/Net/SecureProtocols/AuthenticatedStream.cs
@@ -421,7 +395,6 @@ System.Net/ResponseStream.cs
 System.Net.Security/EncryptionPolicy.cs
 System.Net.Security/LocalCertificateSelectionCallback.cs
 System.Net.Security/NegotiateStream.cs
-System.Net/SecurityProtocolType.cs
 System.Net.Security/RemoteCertificateValidationCallback.cs
 System.Net.Security/SslStream.cs
 System.Net.Security/SslPolicyErrors.cs
@@ -429,7 +402,6 @@ System.Net/ServicePoint.cs
 System.Net/ServicePointManager.cs
 System.Net/ServicePointManager.extra.cs
 System.Net/SimpleAsyncResult.cs
-System.Net/SocketAddress.cs
 System.Net/SocketPermissionAttribute.cs
 System.Net/SocketPermission.cs
 ../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
@@ -461,20 +433,14 @@ System.Net.Sockets/TcpListener.cs
 ../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs
 System.Net.Sockets/UdpClient.cs
 ../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
-System.Net/TransportContext.cs
-System.Net/TransportType.cs
 System.Net/WebAsyncResult.cs
 System.Net/WebConnection.cs
 System.Net/WebConnectionData.cs
 System.Net/WebConnectionGroup.cs
 System.Net/WebConnectionStream.cs
-System.Net/WebException.cs
-System.Net/WebExceptionStatus.cs
 System.Net/WebHeaderCollection.cs
 System.Net/WebProxy.cs
 System.Net/WebRequest.cs
-System.Net/WebRequestMethods.cs
-System.Net/WebResponse.cs
 System.Net.WebSockets/ClientWebSocket.cs
 System.Net.WebSockets/ClientWebSocketOptions.cs
 System.Net.WebSockets/HttpListenerWebSocketContext.cs
@@ -1029,20 +995,54 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/UriScheme.cs
 
 ../referencesource/System/net/System/Net/_BufferOffsetSize.cs
+../referencesource/System/net/System/Net/_IStreams.cs
+../referencesource/System/net/System/Net/_NetRes.cs
 ../referencesource/System/net/System/Net/_LazyAsyncResult.cs
 ../referencesource/System/net/System/Net/_LoggingObject.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
+../referencesource/System/net/System/Net/AuthenticationScheme.cs
+../referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs
+../referencesource/System/net/System/Net/Authorization.cs
 ../referencesource/System/net/System/Net/cookie.cs
 ../referencesource/System/net/System/Net/cookiecollection.cs
 ../referencesource/System/net/System/Net/cookiecontainer.cs
 ../referencesource/System/net/System/Net/cookieexception.cs
+../referencesource/System/net/System/Net/DnsEndPoint.cs
+../referencesource/System/net/System/Net/EndPoint.cs
+../referencesource/System/net/System/Net/FtpStatusCode.cs
+../referencesource/System/net/System/Net/filewebrequest.cs
+../referencesource/System/net/System/Net/filewebresponse.cs
+../referencesource/System/net/System/Net/HttpListenerException.cs
 ../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs
+../referencesource/System/net/System/Net/HttpRequestHeader.cs
+../referencesource/System/net/System/Net/HttpResponseHeader.cs
+../referencesource/System/net/System/Net/HttpStatusCode.cs
+../referencesource/System/net/System/Net/HttpVersion.cs
+../referencesource/System/net/System/Net/IAuthenticationModule.cs
+../referencesource/System/net/System/Net/ICertificatePolicy.cs
+../referencesource/System/net/System/Net/ICredentials.cs
+../referencesource/System/net/System/Net/ICredentialsByHost.cs
 ../referencesource/System/net/System/Net/Internal.cs
+../referencesource/System/net/System/Net/IPAddress.cs
+../referencesource/System/net/System/Net/IPEndPoint.cs
+../referencesource/System/net/System/Net/IPHostEntry.cs
+../referencesource/System/net/System/Net/iwebproxy.cs
+../referencesource/System/net/System/Net/IWebRequestCreate.cs
+../referencesource/System/net/System/Net/NetworkAccess.cs
+../referencesource/System/net/System/Net/ProtocolViolationException.cs
+../referencesource/System/net/System/Net/TransportContext.cs
+../referencesource/System/net/System/Net/TransportType.cs
 ../referencesource/System/net/System/Net/UnicodeDecodingConformance.cs
 ../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs
 ../referencesource/System/net/System/Net/ServicePointManager.cs
+../referencesource/System/net/System/Net/SocketAddress.cs
 ../referencesource/System/net/System/Net/webclient.cs
+../referencesource/System/net/System/Net/WebException.cs
+../referencesource/System/net/System/Net/WebExceptionStatus.cs
+../referencesource/System/net/System/Net/WebHeaderCollection.cs
 ../referencesource/System/net/System/Net/WebPermission.cs
+../referencesource/System/net/System/Net/WebRequestMethods.cs
+../referencesource/System/net/System/Net/WebResponse.cs
 ../referencesource/System/net/System/Net/WebUtility.cs
 ../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs
 
@@ -1063,6 +1063,8 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/sys/system/threading/Barrier.cs
 ../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
 
+../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs
+
 ../referencesource/System/security/system/security/cryptography/oid.cs
 
 ../referencesource/System/security/system/security/cryptography/x509/x509utils.cs
index 19a47097a7d84a270b7a491340627317e5754887..6e83c3090ec0038d44a7c54e04cc73e5ed99c56a 100644 (file)
@@ -1,6 +1,8 @@
 using NUnit.Framework;
 using System;
+using System.Net;
 using System.Net.NetworkInformation;
+using System.Threading;
 
 namespace MonoTests.System.Net.NetworkInformation
 {
@@ -28,6 +30,90 @@ namespace MonoTests.System.Net.NetworkInformation
                        Assert.AreEqual(IPStatus.Success, p.Status);
 #endif
                }               
+
+               [Test]
+#if MONOTOUCH
+               [Ignore("Ping implementation is broken on MT (requires sudo access)")]
+#endif
+               public void SendAsyncIPV4Succeeds()
+               {
+                       var testIp = IPAddress.Loopback;
+                       var ping = new Ping ();
+                       PingReply reply = null;
+
+                       using (var waiter = new AutoResetEvent (false)) {
+                               ping.PingCompleted += new PingCompletedEventHandler ( 
+                                       (s, e) => {
+                                               reply = e.Reply;
+                                               (e.UserState as AutoResetEvent) ?.Set ();
+                                       });
+
+                               ping.SendAsync (testIp, waiter);
+
+                               waiter.WaitOne (TimeSpan.FromSeconds (8));
+                       }
+
+                       Assert.AreEqual (IPStatus.Success, reply.Status);
+               }
+
+               [Test]
+#if MONOTOUCH
+               [Ignore("Ping implementation is broken on MT (requires sudo access)")]
+#endif
+               public void SendAsyncIPV4Fails()
+               {
+                       var testIp = IPAddress.Parse("192.0.2.0");
+                       var ping = new Ping ();
+                       PingReply reply = null;
+
+                       using (var waiter = new AutoResetEvent (false)) {
+                               ping.PingCompleted += new PingCompletedEventHandler ( 
+                                       (s, e) => {
+                                               reply = e.Reply;
+                                               (e.UserState as AutoResetEvent) ?.Set ();
+                                       });
+
+                               ping.SendAsync (testIp, waiter);
+
+                               waiter.WaitOne (TimeSpan.FromSeconds (8));
+                       }
+
+                       Assert.AreNotEqual (IPStatus.Success, reply.Status);
+               }
+
+               [Test]
+#if MONOTOUCH
+               [Ignore("Ping implementation is broken on MT (requires sudo access)")]
+#endif
+               public void SendPingAsyncIPV4Succeeds()
+               {
+                       var testIp = IPAddress.Loopback;
+                       var ping = new Ping ();
+                       var task = ping.SendPingAsync (testIp);
+
+                       task.Wait();
+
+                       var result = task.Result;
+
+                       Assert.AreEqual (IPStatus.Success, result.Status);
+               }
+
+               [Test]
+#if MONOTOUCH
+               [Ignore("Ping implementation is broken on MT (requires sudo access)")]
+#endif
+               public void SendPingAsyncIPV4Fails()
+               {
+                       var testIp = IPAddress.Parse("192.0.2.0");
+                       var ping = new Ping ();
+                       var task = ping.SendPingAsync (testIp);
+
+                       task.Wait();
+
+                       var result = task.Result;
+
+                       Assert.AreNotEqual (IPStatus.Success, result.Status);
+               }
        }
 }
 
index fe3769fd5455e49f1795d6cd89d16be27f12fc1a..a1b5f51cdd2ec37df3ae8037cfc242a9986c4ecb 100644 (file)
@@ -9,7 +9,7 @@
 // \r
 \r
 using System;\r
-using System.Collections;\r
+using System.Linq;\r
 using System.Net;\r
 using System.Net.Sockets;\r
 using System.Threading;\r
@@ -55,8 +55,9 @@ namespace MonoTests.System.Net
 \r
                        IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);\r
                        IPHostEntry entry = Dns.EndResolve (async);\r
-                       SubTestValidIPHostEntry (entry);\r
-                       Assert.AreEqual (site1Dot, entry.AddressList [0].ToString ());\r
+                       SubTestValidIPHostEntry (entry);
+                       var ip = GetIPv4Address (entry);\r
+                       Assert.AreEqual (site1Dot, ip.ToString ());\r
                }\r
 \r
                void ResolveCallback (IAsyncResult ar)\r
@@ -205,12 +206,21 @@ namespace MonoTests.System.Net
                        }\r
                }\r
 \r
+               static IPAddress GetIPv4Address (IPHostEntry h)\r
+               {\r
+                       var al = h.AddressList.FirstOrDefault (x => x.AddressFamily == AddressFamily.InterNetwork);\r
+                       if (al == null)\r
+                               Assert.Ignore ("Could not resolve an IPv4 address as required by this test case, e.g. running on an IPv6 only network");\r
+                       return al;\r
+               }\r
+\r
                void SubTestGetHostByName (string siteName, string siteDot)\r
                {\r
                        IPHostEntry h = Dns.GetHostByName (siteName);\r
                        SubTestValidIPHostEntry (h);\r
                        Assert.AreEqual (siteName, h.HostName, "siteName");\r
-                       Assert.AreEqual (siteDot, h.AddressList [0].ToString (), "siteDot");\r
+                       var ip = GetIPv4Address (h);\r
+                       Assert.AreEqual (siteDot, ip.ToString (), "siteDot");\r
                }\r
 \r
                [Test]\r
@@ -287,7 +297,8 @@ namespace MonoTests.System.Net
                        IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site1IP));\r
                        IPHostEntry h = Dns.GetHostByAddress (addr);\r
                        SubTestValidIPHostEntry (h);\r
-                       Assert.AreEqual (addr.ToString (), h.AddressList [0].ToString ());\r
+                       var ip = GetIPv4Address (h);\r
+                       Assert.AreEqual (addr.ToString (), ip.ToString ());\r
                }\r
 \r
                [Test]\r
@@ -295,8 +306,9 @@ namespace MonoTests.System.Net
                {\r
                        IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site2IP));\r
                        IPHostEntry h = Dns.GetHostByAddress (addr);\r
-                       SubTestValidIPHostEntry (h);\r
-                       Assert.AreEqual (addr.ToString (), h.AddressList [0].ToString ());\r
+                       SubTestValidIPHostEntry (h);
+                       var ip = GetIPv4Address (h);\r
+                       Assert.AreEqual (addr.ToString (), ip.ToString ());\r
                }\r
 \r
                [Test]\r
index 8d6ee23de6e57f4c6979715142c2ed79318f3d65..6793d2a48fdeffefa3c47d532c664f915bcc4330 100644 (file)
@@ -660,7 +660,7 @@ namespace MonoTests.System.Net
                                Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#3");
                                Assert.IsNotNull (ex.Message, "#4");
                                Assert.IsNotNull (ex.ParamName, "#5");
-                               Assert.IsFalse (ex.ParamName == "value", "#6");
+                               Assert.AreEqual ("value", ex.ParamName, "#6");
                                Assert.IsNull (ex.InnerException, "#7");
                        }
                }
index e2fbcadabd8f3b6be0268557f7a2e066d3d16bca..f3c9ad8367119b15814a51509d33550b8609b37d 100644 (file)
@@ -145,16 +145,8 @@ public class IPAddressTest
                "0xff.0x7f.0x20.0xf", "255.127.32.15",
                "0.0.0.0", IPAddress.Any.ToString(),
                "255.255.255.255", IPAddress.Broadcast.ToString(),
-               "12.1.1.3 abc", "12.1.1.3",
-               "12.1 .1.2", "12.0.0.1",
-               "12.1 .zzzz.2", "12.0.0.1",
                "12.1.7", "12.1.0.7",
                "12", "0.0.0.12",
-               "12.5.3 foo.67.test.test.7FFFFFFFFFfaFFF789FFFFFFFFFFFFFFF", "12.5.0.3",
-               "12.1 foo.bar.test.test.baf", "12.0.0.1",
-               "12.1.4.6 foo.bar.test.test.baf", "12.1.4.6",
-               "12.3 foo.bar.test.test.4", "12.0.0.3",
-               "12 foo.bar.test.test.baf", "0.0.0.12",
                "65536", "0.1.0.0",
                "65535", "0.0.255.255",
                "20.65535", "20.0.255.255",
@@ -187,6 +179,14 @@ public class IPAddressTest
                "12...",
                "  ",
                "7848198702",
+               "12.1.1.3 abc",
+               "12.1 .1.2",
+               "12.1 .zzzz.2",
+               "12.5.3 foo.67.test.test.7FFFFFFFFFfaFFF789FFFFFFFFFFFFFFF",
+               "12.1 foo.bar.test.test.baf",
+               "12.1.4.6 foo.bar.test.test.baf",
+               "12.3 foo.bar.test.test.4",
+               "12 foo.bar.test.test.baf",
        };
 
        static byte [] ipv4MappedIPv6Prefix = new byte [] { 0,0, 0,0, 0,0, 0,0, 0,0, 0xFF,0xFF };
@@ -197,8 +197,8 @@ public class IPAddressTest
                Assert.AreEqual ((long) 0, IPAddress.Any.Address, "#1");
                Assert.AreEqual ((long) 0xFFFFFFFF, IPAddress.Broadcast.Address, "#2");
                long loopback = IPAddress.HostToNetworkOrder (BitConverter.IsLittleEndian ? 
-                                                             0x7f000001 : 
-                                                             0x0100007f);
+                                                                 0x7f000001 : 
+                                                                 0x0100007f);
                Assert.AreEqual (loopback, IPAddress.Loopback.Address, "#3");
                Assert.AreEqual ((long) 0xFFFFFFFF, IPAddress.None.Address, "#4");
        }
@@ -241,8 +241,8 @@ public class IPAddressTest
        [Test]
        public void IsLoopbackV6 ()
        {
-               if (!Socket.SupportsIPv6)
-                       Assert.Ignore ("IPv6 must be enabled in machine.config");
+//             if (!Socket.SupportsIPv6)
+//                     Assert.Ignore ("IPv6 must be enabled in machine.config");
 
                IPAddress ip = IPAddress.IPv6Loopback;
                Assert.IsTrue (IPAddress.IsLoopback (ip), "#1");
@@ -277,24 +277,16 @@ public class IPAddressTest
        [Test]
        public void Address ()
        {
-               // hm, lame, anything is accepted by ms.net
-               /*
                try {
                        IPAddress ip1 = new IPAddress (0x0000000100000000);
-                       Assertion.Fail ("#1");
+                       Assert.Fail ("#1");
                } catch (ArgumentOutOfRangeException) {}
+               
                IPAddress ip = IPAddress.Parse ("127.0.0.1");
                ip.Address = 0;
                ip.Address = 0xffffffff;
-               try {
-                       ip.Address = -1;
-                       Assertion.Fail ("#2");
-               } catch (ArgumentOutOfRangeException) {}
-               try {
-                       ip.Address = 0x0000000100000000;
-                       Assertion.Fail ("#3");
-               } catch (ArgumentOutOfRangeException) {}
-               */
+               ip.Address = -1;
+               ip.Address = 0x0000000100000000;
        }
 
        [Test]
@@ -620,8 +612,8 @@ public class IPAddressTest
        [Test]
        public void ParseWrongV6 ()
        {
-               if (!Socket.SupportsIPv6)
-                       Assert.Ignore ("IPv6 must be enabled in machine.config");
+               //if (!Socket.SupportsIPv6)
+               //      Assert.Ignore ("IPv6 must be enabled in machine.config");
 
                for (int i = 0; i < ipv6ParseWrong.Length; i++) {
                        string ipAddress = ipv6ParseWrong [i];
@@ -631,14 +623,12 @@ public class IPAddressTest
                                Assert.Fail ("#1:" + i + " (" + ipAddress + ")");
                        } catch (FormatException ex) {
                                Assert.AreEqual (typeof (FormatException), ex.GetType (), "#2:" + i);
-                               Assert.IsNull (ex.InnerException, "#3:" + i);
+                               Assert.AreEqual(typeof(SocketException), ex.InnerException.GetType (), "#3:" + i);
                                Assert.IsNotNull (ex.Message, "#4:" + i);
                        }
                }
        }
 
-#if NET_4_5
-
        [Test]
        public void MapToIPv6 ()
        {
@@ -673,8 +663,6 @@ public class IPAddressTest
                return true;
        }
 
-#endif
-
        [Test]
        public void EqualsFromBytes ()
        {
@@ -686,6 +674,18 @@ public class IPAddressTest
 
        }
 
+       [Test]
+       [Category ("NotDotNet")]
+       public void UnixInterfaceNameAsZoneIndex ()
+       {
+               var ip = IPAddress.Parse ("fe80::bae8:56ff:fe47:af7e%en0");
+
+               // Should be en0 but it's of long type!
+               Assert.AreEqual (0, ip.ScopeId);
+               
+               Assert.AreEqual ("fe80::bae8:56ff:fe47:af7e", ip.ToString ());
+       }
+
 }
 }
 
index bfb0ec99b57a8383c440f9f1b75aad1407ab4b56..8a8c3f43f2d3918c4addfa6f8edde6cda4be7b5a 100644 (file)
@@ -132,7 +132,6 @@ System.Net.Security/NegotiateStream.cs
 System.Net.Security/RemoteCertificateValidationCallback.cs
 System.Net.Security/SslPolicyErrors.cs
 System.Net.Security/SslStream.cs
-System.Net/SocketAddress.cs
 System.Net/SocketPermissionAttribute.cs
 System.Net/SocketPermission.cs
 ../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
@@ -165,32 +164,22 @@ System.Net.Sockets/TcpListener.cs
 System.Net.Sockets/UdpClient.cs
 ../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
 System.Net/AuthenticationManager.cs
-System.Net/AuthenticationSchemeSelector.cs
-System.Net/AuthenticationSchemes.cs
-System.Net/Authorization.cs
 System.Net/BasicClient.cs
 System.Net/BindIPEndPoint.cs
 System.Net/ChunkStream.cs
 System.Net/ChunkedInputStream.cs
-System.Net/ConnectionModes.cs
 System.Net/CredentialCache.cs
 System.Net/DecompressionMethods.cs
 System.Net/DefaultCertificatePolicy.cs
 System.Net/DigestClient.cs
 System.Net/Dns.cs
-System.Net/DnsEndPoint.cs
-System.Net/EndPoint.cs
 System.Net/EndPointListener.cs
 System.Net/EndPointManager.cs
 System.Net/EndpointPermission.cs
-System.Net/FileWebRequest.cs
-System.Net/FileWebRequestCreator.cs
-System.Net/FileWebResponse.cs
 System.Net/FtpAsyncResult.cs
 System.Net/FtpDataStream.cs
 System.Net/FtpRequestCreator.cs
 System.Net/FtpStatus.cs
-System.Net/FtpStatusCode.cs
 System.Net/FtpWebRequest.cs
 System.Net/FtpWebResponse.cs
 System.Net/GlobalProxySelection.cs
@@ -198,65 +187,39 @@ System.Net/HttpConnection.cs
 System.Net/HttpListener.cs
 System.Net/HttpListenerBasicIdentity.cs
 System.Net/HttpListenerContext.cs
-System.Net/HttpListenerException.cs
 System.Net/HttpListenerPrefixCollection.cs
 System.Net/HttpListenerRequest.cs
 System.Net/HttpListenerResponse.cs
 System.Net/HttpListenerTimeoutManager.cs
 System.Net/HttpRequestCreator.cs
-System.Net/HttpRequestHeader.cs
-System.Net/HttpResponseHeader.cs
-System.Net/HttpStatusCode.cs
 System.Net/HttpStreamAsyncResult.cs
-System.Net/HttpVersion.cs
 System.Net/HttpWebRequest.cs
 System.Net/HttpWebResponse.cs
-System.Net/IAuthenticationModule.cs
-System.Net/ICertificatePolicy.cs
-System.Net/ICredentialLookup.cs
 System.Net/ICredentialPolicy.cs
-System.Net/ICredentialsByHost.cs
-System.Net/IPAddress.cs
-System.Net/IPAddress.cs
-System.Net/IPEndPoint.cs
-System.Net/IPHostEntry.cs
 System.Net/IPv6Address.cs
 System.Net/IPv6Address.cs
 System.Net/IWebConnectionState.cs
-System.Net/IWebProxy.cs
-System.Net/IWebProxyScript.cs
-System.Net/IWebRequestCreate.cs
 System.Net/ListenerAsyncResult.cs
 System.Net/ListenerPrefix.cs
 System.Net/MacProxy.cs
 System.Net/MonoHttpDate.cs
 System.Net/NetConfig.cs
-System.Net/NetworkAccess.cs
 System.Net/NetworkCredential.cs
 System.Net/NtlmClient.cs
-System.Net/ProtocolViolationException.cs
 System.Net/RequestStream.cs
 System.Net/ResponseStream.cs
-System.Net/SecurityProtocolType.cs
 System.Net/ServicePoint.cs
 System.Net/ServicePointManager.cs
 System.Net/ServicePointManager.extra.cs
 System.Net/SimpleAsyncResult.cs
-System.Net/SocketAddress.cs
-System.Net/TransportContext.cs
-System.Net/TransportType.cs
 System.Net/WebAsyncResult.cs
 System.Net/WebConnection.cs
 System.Net/WebConnectionData.cs
 System.Net/WebConnectionGroup.cs
 System.Net/WebConnectionStream.cs
-System.Net/WebException.cs
-System.Net/WebExceptionStatus.cs
 System.Net/WebHeaderCollection.cs
 System.Net/WebProxy.cs
 System.Net/WebRequest.cs
-System.Net/WebRequestMethods.cs
-System.Net/WebResponse.cs
 System.Net.WebSockets/ClientWebSocket.cs
 System.Net.WebSockets/ClientWebSocketOptions.cs
 System.Net.WebSockets/HttpListenerWebSocketContext.cs
@@ -744,20 +707,54 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/UriScheme.cs
 
 ../referencesource/System/net/System/Net/_BufferOffsetSize.cs
+../referencesource/System/net/System/Net/_IStreams.cs
+../referencesource/System/net/System/Net/_NetRes.cs
 ../referencesource/System/net/System/Net/_LazyAsyncResult.cs
 ../referencesource/System/net/System/Net/_LoggingObject.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
+../referencesource/System/net/System/Net/AuthenticationScheme.cs
+../referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs
+../referencesource/System/net/System/Net/Authorization.cs
 ../referencesource/System/net/System/Net/cookie.cs
 ../referencesource/System/net/System/Net/cookiecollection.cs
 ../referencesource/System/net/System/Net/cookiecontainer.cs
 ../referencesource/System/net/System/Net/cookieexception.cs
+../referencesource/System/net/System/Net/DnsEndPoint.cs
+../referencesource/System/net/System/Net/EndPoint.cs
+../referencesource/System/net/System/Net/FtpStatusCode.cs
+../referencesource/System/net/System/Net/filewebrequest.cs
+../referencesource/System/net/System/Net/filewebresponse.cs
+../referencesource/System/net/System/Net/HttpListenerException.cs
+../referencesource/System/net/System/Net/HttpRequestHeader.cs
+../referencesource/System/net/System/Net/HttpResponseHeader.cs
+../referencesource/System/net/System/Net/HttpStatusCode.cs
 ../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs
+../referencesource/System/net/System/Net/HttpVersion.cs
+../referencesource/System/net/System/Net/IAuthenticationModule.cs
+../referencesource/System/net/System/Net/ICertificatePolicy.cs
+../referencesource/System/net/System/Net/ICredentials.cs
+../referencesource/System/net/System/Net/ICredentialsByHost.cs
 ../referencesource/System/net/System/Net/Internal.cs
+../referencesource/System/net/System/Net/IPAddress.cs
+../referencesource/System/net/System/Net/IPEndPoint.cs
+../referencesource/System/net/System/Net/IPHostEntry.cs
+../referencesource/System/net/System/Net/iwebproxy.cs
+../referencesource/System/net/System/Net/IWebRequestCreate.cs
+../referencesource/System/net/System/Net/NetworkAccess.cs
+../referencesource/System/net/System/Net/ProtocolViolationException.cs
+../referencesource/System/net/System/Net/TransportContext.cs
+../referencesource/System/net/System/Net/TransportType.cs
 ../referencesource/System/net/System/Net/UnicodeDecodingConformance.cs
 ../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs
 ../referencesource/System/net/System/Net/ServicePointManager.cs
+../referencesource/System/net/System/Net/SocketAddress.cs
 ../referencesource/System/net/System/Net/webclient.cs
+../referencesource/System/net/System/Net/WebException.cs
+../referencesource/System/net/System/Net/WebExceptionStatus.cs
+../referencesource/System/net/System/Net/WebHeaderCollection.cs
 ../referencesource/System/net/System/Net/WebPermission.cs
+../referencesource/System/net/System/Net/WebRequestMethods.cs
+../referencesource/System/net/System/Net/WebResponse.cs
 ../referencesource/System/net/System/Net/WebUtility.cs
 ../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs
 
@@ -776,6 +773,8 @@ ReferenceSources/Win32Exception.cs
 
 ../referencesource/System/sys/system/threading/Barrier.cs
 
+../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs
+
 ../referencesource/System/security/system/security/cryptography/oid.cs
 
 ../referencesource/System/security/system/security/cryptography/x509/x509utils.cs
index 73fef7906bb639c401e1f481c212ddd2a20d0e5c..0952e5528fc7a39b92ed8a268c67f53bd94fc6f6 100644 (file)
@@ -57,7 +57,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 146;
+               private const int mono_corlib_version = 147;
 #pragma warning restore 169
 
                [ComVisible (true)]
index c7f73e95d38cfcee8954a4ff30ef4ee83058fa7e..e532913ff24a2632ef221276cea3ef03e1d96367 100644 (file)
@@ -574,37 +574,6 @@ namespace MonoTests.System.Threading
                        t.Name = "b";
                }
 
-               bool rename_finished;
-               bool rename_failed;
-
-               [Test]
-               public void RenameTpThread ()
-               {
-                       object monitor = new object ();
-                       ThreadPool.QueueUserWorkItem (new WaitCallback (Rename_callback), monitor);
-                       lock (monitor) {
-                               if (!rename_finished)
-                                       Monitor.Wait (monitor);
-                       }
-                       Assert.IsTrue (!rename_failed);
-               }
-
-               void Rename_callback (object o) {
-                       Thread.CurrentThread.Name = "a";
-                       try {
-                               Thread.CurrentThread.Name = "b";
-                               //Console.WriteLine ("Thread name is: {0}", Thread.CurrentThread.Name);
-                       } catch (Exception e) {
-                               //Console.Error.WriteLine (e);
-                               rename_failed = true;
-                       }
-                       object monitor = o;
-                       lock (monitor) {
-                               rename_finished = true;
-                               Monitor.Pulse (monitor);
-                       }
-               }
-
                [Test]
                public void TestNestedThreads1()
                {
index 60d4cbd3f1831d9c7034550a0b68a1048adcdff2..519786c3cf2af60442895a8c1350b26edc2950e1 100644 (file)
@@ -18,11 +18,12 @@ install-local:
        $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/*.dll $(PROFILE_DIR)/4.5-api
        $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll $(PROFILE_DIR)/4.5-api/Facades
 
-       # Unfortunately, a few programs (most notably NUnit) have hardcoded checks for <prefix>/lib/mono/4.0/mscorlib.dll,
+       # Unfortunately, a few programs (most notably NUnit and FSharp) have hardcoded checks for <prefix>/lib/mono/4.0/mscorlib.dll or Mono.Posix.dll,
        # so we need to place something there or those tools break. We decided to symlink to the reference assembly for now.
-       # See https://bugzilla.xamarin.com/show_bug.cgi?id=38331
+       # See https://bugzilla.xamarin.com/show_bug.cgi?id=38331 and https://bugzilla.xamarin.com/show_bug.cgi?id=41052
        $(MKINSTALLDIRS) $(PROFILE_DIR)/4.0
        ln -sf ../4.0-api/mscorlib.dll $(PROFILE_DIR)/4.0/mscorlib.dll
+       ln -sf ../4.0-api/Mono.Posix.dll $(PROFILE_DIR)/4.0/Mono.Posix.dll
 
 DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v4.5/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v4.0/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*.dll) Makefile
 
index 53f2e02e5980a3d12800ffc19c2344e6fcf75120..4b6cf7714a5c8cc7c1cbfa67332b5d95174b78f1 100644 (file)
@@ -139,7 +139,9 @@ namespace System.Net {
 
             set 
             {
+#if !DISABLE_CAS_USE
                 ExceptionHelper.ControlPolicyPermission.Demand();
+#endif
                 Instance.CredentialPolicy = value;
             }
         }
@@ -203,7 +205,9 @@ namespace System.Net {
         /// </devdoc>
         public static void Register(IAuthenticationModule authenticationModule) 
         {
+#if !DISABLE_CAS_USE
             ExceptionHelper.UnmanagedPermission.Demand();
+#endif
             Instance.Register(authenticationModule);
         }
 
@@ -212,7 +216,9 @@ namespace System.Net {
         /// </devdoc>
         public static void Unregister(IAuthenticationModule authenticationModule) 
         {
+#if !DISABLE_CAS_USE
             ExceptionHelper.UnmanagedPermission.Demand();
+#endif
             Instance.Unregister(authenticationModule);
         }
 
@@ -221,7 +227,9 @@ namespace System.Net {
         /// </devdoc>
         public static void Unregister(string authenticationScheme) 
         {
+#if !DISABLE_CAS_USE
             ExceptionHelper.UnmanagedPermission.Demand();
+#endif
             Instance.Unregister(authenticationScheme);
         }
 
index fec7f5cde3581f40c4eb63f789bb6ac3fa6bf801..d111e81a484a72aa398bec43d6278c4a4fce11ff 100644 (file)
@@ -5,8 +5,8 @@
 //------------------------------------------------------------------------------
 
 namespace System.Net {
-
+#if SECURITY_DEP
     public delegate AuthenticationSchemes AuthenticationSchemeSelector(HttpListenerRequest httpRequest);
-
+#endif
 }
 
index f9f6b94161e27d15873288644d88414d14870972..328546a1e4e967c1851d12eeeecbea3821726e41 100644 (file)
@@ -104,6 +104,11 @@ namespace System.Net {
             }
         }
 
+#if MONO
+        // Temporary bridge to old implementation
+        internal string ModuleAuthenticationType;
+#endif
+
     } // class Authorization
 
 
index e6b2f8e0371b30575032684de952c06e5777e295..e3273c4c9c95a17746b5cae33d505851391c123c 100644 (file)
@@ -171,7 +171,7 @@ namespace System.Net {
             //
             if (ipString.IndexOf(':') != -1 ) {
 
-#if !FEATURE_PAL
+#if !FEATURE_PAL || MONO
                 //
                 // If the address string contains the colon character
                 // then it can only be an IPv6 address. Use a separate
@@ -184,6 +184,7 @@ namespace System.Net {
                 //
                 SocketException e = null;
                 long   scope = 0;
+#if !MONO
                 if(Socket.OSSupportsIPv6)
                 {
                     byte[] bytes = new byte[IPv6AddressBytes];
@@ -221,6 +222,7 @@ namespace System.Net {
                     e = new SocketException();
                 }
                 else
+#endif
                 {
                     unsafe
                     {
@@ -251,7 +253,14 @@ namespace System.Net {
                                 scopeId = scopeId.Substring(1);
                                 if (UInt32.TryParse(scopeId, NumberStyles.None, null, out result))
                                     return new IPAddress(numbers, result);
-
+#if MONO
+                                //
+                                // HACK: .NET does not support scopes with literals at all (API is long based)
+                                // For backward Mono compatibility parsing IPv6 addresses like
+                                // fe80::bae8:56ff:fe47:af7e%en0 will loose en0 information
+                                //
+                                return new IPAddress(numbers, 0);
+#endif
                             }
                         }
                     }
@@ -271,12 +280,13 @@ namespace System.Net {
             else
             // The new IPv4 parser is better than the native one, it can parse 0xFFFFFFFF. (It's faster too).
             {
+#if !MONO
                 // App-Compat: The .NET 4.0 parser used Winsock.  When we removed this initialization in 4.5 it 
                 // uncovered bugs in IIS's management APIs where they failed to initialize Winsock themselves.
                 // DDCC says we need to keep this for an in place release, but to remove it in the next SxS release.
                 Socket.InitializeSockets();
                 ///////////////////////////
-
+#endif
                 int end = ipString.Length;
                 long result;
                 unsafe
@@ -473,8 +483,14 @@ namespace System.Net {
 
                     m_ToString = addressString.ToString();
 #else // !FEATURE_PAL
+
+#if MONO
+                    var v6 = new IPv6AddressFormatter (m_Numbers, ScopeId);
+                    m_ToString = v6.ToString ();
+#else
                     // IPv6 addresses not supported for FEATURE_PAL
                     throw new SocketException(SocketError.OperationNotSupported);
+#endif
 #endif // !FEATURE_PAL
                 }
                 else {
index 19948efa34ef8728e2e23ed5445d988eec9f5dad..ed21d04c067364c498645e520e98bbd381dc695d 100644 (file)
@@ -981,7 +981,6 @@ namespace System.Net {
             }
         }
 
-#if MONO_FEATURE_WEB_STACK
         internal static WebException IsolatedException {
             get {
                 return new WebException(NetRes.GetWebStatusString("net_requestaborted", WebExceptionStatus.KeepAliveFailure),WebExceptionStatus.KeepAliveFailure, WebExceptionInternalStatus.Isolated, null);
@@ -1005,7 +1004,6 @@ namespace System.Net {
                 return new WebException(NetRes.GetWebStatusString("net_requestaborted", WebExceptionStatus.RequestProhibitedByCachePolicy), WebExceptionStatus.RequestProhibitedByCachePolicy);
             }
         }
-#endif
     }
 
     internal enum WindowsInstallationType
@@ -1893,7 +1891,6 @@ typedef struct _SCHANNEL_CRED
         WriteWait = 2,
     }
 
-#if MONO_FEATURE_WEB_STACK
     //
     // HttpVerb - used to define various per Verb Properties
     //
@@ -1964,7 +1961,7 @@ typedef struct _SCHANNEL_CRED
         }
     }
 
-
+#if MONO_FEATURE_WEB_STACK
     //
     // HttpProtocolUtils - A collection of utility functions for HTTP usage.
     //
index ded74015f3324eda83657791aecaa0775884638d..48bb45802f08f94ea2fef8a6beeb4683a85450e6 100644 (file)
@@ -22,7 +22,7 @@ namespace System.Net {
     using Microsoft.Win32;
     
     // This turned to be a legacy type name that is simply forwarded to System.Security.Authentication.SslProtocols defined values.
-#if !MONO && !FEATURE_PAL
+#if !FEATURE_PAL || MONO
     [Flags]
     public enum SecurityProtocolType
     {
@@ -31,7 +31,8 @@ namespace System.Net {
         Tls11         = System.Security.Authentication.SslProtocols.Tls11,
         Tls12         = System.Security.Authentication.SslProtocols.Tls12,
     }
-
+#endif
+#if !MONO && !FEATURE_PAL
     internal class CertPolicyValidationCallback
     {
         readonly ICertificatePolicy  m_CertificatePolicy;
index 49bc92e0936c999f0079182efe604b6b6d3412f0..d1b49b2aafba20153d5f9b9c2bdd98f97fda7f49 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Net {
     using System.Globalization;
     using System.Security.Permissions;
     using System.Diagnostics.CodeAnalysis;
-
+#if !MONO
     internal enum WebHeaderCollectionType : ushort {
         Unknown,
         WebRequest,
@@ -1971,7 +1971,7 @@ quit:
                 m_InnerCollection.Clear();
         }
     } // class WebHeaderCollection
-
+#endif
 
     internal class CaseInsensitiveAscii : IEqualityComparer, IComparer{
         // ASCII char ToLower table
index 29eb3e52549eb1cc4e4b5cf7bf4a26ab042b5291..46378a6eed3931eb540a6703c51f438a552a396f 100644 (file)
@@ -43,7 +43,9 @@ namespace System.Net {
         //
         public override int Count {
             get {
+#if !DISABLE_CAS_USE
                 ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
                 return m_SyncTable.Count;
             }
         }
@@ -106,7 +108,9 @@ namespace System.Net {
         //
         public override ICollection Keys {
             get {
+#if !DISABLE_CAS_USE
                 ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
                 return m_SyncTable.Keys;
             }
         }
@@ -114,14 +118,18 @@ namespace System.Net {
         public override object SyncRoot {
             [HostProtection(Synchronization=true)]
             get {
+#if !DISABLE_CAS_USE
                 ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
                 return m_SyncTable;
             }
         }
         //
         public override ICollection Values {
             get {
+#if !DISABLE_CAS_USE
                 ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
                 if (m_ValuesWrapper == null)
                 {
                     m_ValuesWrapper = new ValueCollection(this);
@@ -136,7 +144,9 @@ namespace System.Net {
         }
         //
         public override void Clear() {
+#if !DISABLE_CAS_USE
             ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
             m_SyncTable.Clear();
         }
         //
@@ -146,7 +156,9 @@ namespace System.Net {
         }
         //
         public override bool ContainsValue(string value) {
+#if !DISABLE_CAS_USE
             ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
             foreach (SpnToken spnToken in m_SyncTable.Values)
             {
                 if (spnToken.Spn == value)
@@ -157,7 +169,9 @@ namespace System.Net {
 
         // We have to unwrap the SpnKey and just expose the Spn
         public override void CopyTo(Array array, int index) {
+#if !DISABLE_CAS_USE
             ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
             CheckCopyToArguments(array, index, Count);
 
             int offset = 0;
@@ -169,7 +183,9 @@ namespace System.Net {
         }
         //
         public override IEnumerator GetEnumerator() {
+#if !DISABLE_CAS_USE
             ExceptionHelper.WebPermissionUnrestricted.Demand();
+#endif
 
             foreach (string key in m_SyncTable.Keys)
             {
@@ -195,7 +211,9 @@ namespace System.Net {
             try {
                 Uri uri = new Uri(key);
                 key = uri.GetParts(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.SafeUnescaped);
+#if !DISABLE_CAS_USE
                 new WebPermission(NetworkAccess.Connect, new Uri(key)).Demand();
+#endif
             }
             catch(UriFormatException e) {
                 throw new ArgumentException(SR.GetString(SR.net_mustbeuri, "key"), "key", e);
index 4ae8d5c7c05875839a2adcf8ed0a1a0a43e44522..0db05f3620e2fc500dfb3c0db05801c66b6bf99c 100644 (file)
@@ -246,9 +246,11 @@ namespace System.Net {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetRequestStream", exception);
                 throw;
             } finally {
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogBeginGetRequestStream(success, synchronous: false);
                 }
+#endif
                 GlobalLog.Leave("FileWebRequest::BeginGetRequestSteam");
             }
 
@@ -280,9 +282,11 @@ namespace System.Net {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetResponse", exception);
                 throw;
             } finally {
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogBeginGetResponse(success, synchronous: false);
                 }
+#endif
                 GlobalLog.Leave("FileWebRequest::BeginGetResponse");
             }
 
@@ -319,9 +323,11 @@ namespace System.Net {
                 throw;
             } finally {
                 GlobalLog.Leave("FileWebRequest::EndGetRequestStream");
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogEndGetRequestStream(success, synchronous: false);
                 }
+#endif
             }
 
             return stream;
@@ -355,10 +361,12 @@ namespace System.Net {
             } finally {
                 GlobalLog.Leave("FileWebRequest::EndGetResponse");
 
+#if !MONO
                 // there is no statusCode in FileWebRequest object, defaulting it to zero.
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogEndGetResponse(success, synchronous: false, statusCode: 0);
                 }
+#endif
             }
 
             return response;
index 6395e90ff41b3499337d075e126a72376dd6f35e..9f75c85749a37752bcad3cd58875435b4db876a1 100755 (executable)
@@ -10,8 +10,8 @@
 // (C) 2016 Xamarin Inc
 //
 // Missing features:
-// * Implement --cross, --local-targets, --list-targets, --no-auto-fetch
-// * concatenate target with package to form native binary
+// * Add support for packaging native libraries, extracting at runtime and setting the library path.
+// * Implement --list-targets lists all the available remote targets
 //
 using System;
 using System.Diagnostics;
@@ -24,6 +24,7 @@ using System.Text;
 using IKVM.Reflection;
 using System.Linq;
 using System.Diagnostics;
+using System.Net;
 using System.Threading.Tasks;
 
 class MakeBundle {
@@ -46,9 +47,12 @@ class MakeBundle {
        static bool skip_scan;
        static string ctor_func;
        static bool quiet;
+       static string cross_target = null;
+       static string fetch_target = null;
        static bool custom_mode = true;
        static string embedded_options = null;
        static string runtime = null;
+       static string target_server = "https://download.mono-project.com/runtimes/raw/";
        
        static int Main (string [] args)
        {
@@ -76,7 +80,44 @@ class MakeBundle {
                        case "-c":
                                compile_only = true;
                                break;
+
+                       case "--local-targets":
+                               CommandLocalTargets ();
+                               return 0;
+
+                       case "--cross":
+                               if (i+1 == top){
+                                       Help (); 
+                                       return 1;
+                               }
+                               custom_mode = false;
+                               autodeps = true;
+                               cross_target = args [++i];
+                               break;
+
+                       case "--fetch-target":
+                               if (i+1 == top){
+                                       Help (); 
+                                       return 1;
+                               }
+                               fetch_target = args [++i];
+                               break;
+
+                       case "--list-targets":
+                               var wc = new WebClient ();
+                               var s = wc.DownloadString (new Uri (target_server + "target-list.txt"));
+                               Console.WriteLine ("Cross-compilation targets available:\n" + s);
+                               
+                               return 0;
                                
+                       case "--target-server":
+                               if (i+1 == top){
+                                       Help (); 
+                                       return 1;
+                               }
+                               target_server = args [++i];
+                               break;
+
                        case "-o": 
                                if (i+1 == top){
                                        Help (); 
@@ -230,14 +271,59 @@ class MakeBundle {
                        if (!QueueAssembly (files, file))
                                return 1;
 
+               if (fetch_target != null){
+                       var truntime = Path.Combine (targets_dir, fetch_target, "mono");
+                       Directory.CreateDirectory (Path.GetDirectoryName (truntime));
+                       var wc = new WebClient ();
+                       var uri = new Uri ($"{target_server}{fetch_target}");
+                       try {
+                               wc.DownloadFile (uri, truntime);
+                       } catch {
+                               Console.Error.WriteLine ($"Failure to download the specified runtime from {uri}");
+                               File.Delete (truntime);
+                               return 1;
+                       }
+                       return 0;
+               }
+               
                if (custom_mode)
                        GenerateBundles (files);
-               else
+               else {
+                       if (cross_target == "default")
+                               runtime = null;
+                       else {
+                               var truntime = Path.Combine (targets_dir, cross_target, "mono");
+                               if (!File.Exists (truntime)){
+                                       Console.Error.WriteLine ($"The runtime for the {cross_target} does not exist, use --fetch-target {cross_target} to download first");
+                                       return 1;
+                               }
+                       }                               
                        GeneratePackage (files);
+               }
                
                return 0;
        }
 
+       static string targets_dir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mono", "targets");
+       
+       static void CommandLocalTargets ()
+       {
+               string [] targets;
+
+               Console.WriteLine ("Available targets:");
+               Console.WriteLine ("\tdefault\t- Current System Mono");
+               try {
+                       targets = Directory.GetDirectories (targets_dir);
+               } catch {
+                       return;
+               }
+               foreach (var target in targets){
+                       var p = Path.Combine (target, "mono");
+                       if (File.Exists (p))
+                               Console.WriteLine ("\t{0}", Path.GetFileName (target));
+               }
+       }
+
        static void WriteSymbol (StreamWriter sw, string name, long size)
        {
                switch (style){
@@ -934,10 +1020,10 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                   "--simple   Simple mode does not require a C toolchain and can cross compile\n" + 
                                   "    --cross TARGET      Generates a binary for the given TARGET\n"+
                                   "    --local-targets     Lists locally available targets\n" +
-                                  "    --list-targets [SERVER] Lists available targets on the remote server\n" +
-                                  "    --no-auto-fetch     Prevents the tool from auto-fetching a TARGET\n" +
+                                  "    --list-targets      Lists available targets on the remote server\n" +
                                   "    --options OPTIONS   Embed the specified Mono command line options on target\n" +
-                                  "    --runtime RUNTIME   Manually specifies the Mono runtime to use\n" + 
+                                  "    --runtime RUNTIME   Manually specifies the Mono runtime to use\n" +
+                                  "    --target-server URL Specified a server to download targets from, default is " + target_server + "\n" +
                                   "\n" +
                                   "--custom   Builds a custom launcher, options for --custom\n" +
                                   "    -c                  Produce stub only, do not compile\n" +
index effa46abdd1d93de67209e08d95a85a33301d450..b8be86856554388123c952a9a4036e2fac283153 100644 (file)
@@ -81,7 +81,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 146
+#define MONO_CORLIB_VERSION 147
 
 typedef struct
 {
@@ -2537,9 +2537,9 @@ guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
 {
        guint32 result;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        result = WaitForSingleObjectEx (handle, timeout, alertable);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return result;
 }
@@ -2573,7 +2573,6 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        unload_data *thread_data;
        MonoNativeThreadId tid;
        MonoDomain *caller_domain = mono_domain_get ();
-       char *name;
 
        /* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, mono_native_thread_id_get ()); */
 
@@ -2633,10 +2632,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, 0, CREATE_SUSPENDED, &tid);
        if (thread_handle == NULL)
                return;
-       name = g_strdup_printf ("Unload thread for domain %x", domain);
-       mono_thread_info_set_name (tid, name);
        mono_thread_info_resume (tid);
-       g_free (name);
 
        /* Wait for the thread */       
        while (!thread_data->done && guarded_wait (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION) {
index 5e1605fd972295a21362b31a4be27f3d4f7d61a7..9f6f1e6a836f794dca7bbc2ae4453786b1845f6c 100644 (file)
@@ -493,7 +493,7 @@ receiver_thread (void *arg)
        guint8 *p, *p_end;
        MonoObject *exc;
 
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Attach receiver");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Attach receiver");
 
        printf ("attach: Listening on '%s'...\n", server_uri);
 
index 3ebe507d0d185472c7aada8bed2713c8b11847df..8b4143b7ac5d34cb9805cea47c685e8838d2a4ce 100644 (file)
@@ -599,7 +599,7 @@ mono_cominterop_init (void)
        register_icall (cominterop_get_interface, "cominterop_get_interface", "ptr object ptr int32", FALSE);
 
        register_icall (mono_string_to_bstr, "mono_string_to_bstr", "ptr obj", FALSE);
-       register_icall (mono_string_from_bstr, "mono_string_from_bstr", "obj ptr", FALSE);
+       register_icall (mono_string_from_bstr_icall, "mono_string_from_bstr_icall", "obj ptr", FALSE);
        register_icall (mono_free_bstr, "mono_free_bstr", "void ptr", FALSE);
        register_icall (cominterop_type_from_handle, "cominterop_type_from_handle", "object ptr", FALSE);
 
@@ -1696,9 +1696,11 @@ ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type)
         * Constructor does not need to be called. Will be called later.
        */
        MonoVTable *vtable = mono_class_vtable_full (domain, klass, &error);
-       mono_error_raise_exception (&error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
        obj = mono_object_new_alloc_specific_checked (vtable, &error);
-       mono_error_raise_exception (&error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
 
        return obj;
 }
@@ -2424,15 +2426,15 @@ static const IID MONO_IID_IMarshal = {0x3, 0x0, 0x0, {0xC0, 0x0, 0x0, 0x0, 0x0,
 #ifdef HOST_WIN32
 /* All ccw objects are free threaded */
 static int
-cominterop_ccw_getfreethreadedmarshaler (MonoCCW* ccw, MonoObject* object, gpointer* ppv)
+cominterop_ccw_getfreethreadedmarshaler (MonoCCW* ccw, MonoObject* object, gpointer* ppv, MonoError *error)
 {
+       mono_error_init (error);
 #ifdef HOST_WIN32
-       MonoError error;
        if (!ccw->free_marshaler) {
                int ret = 0;
                gpointer tunk;
-               tunk = cominterop_get_ccw_checked (object, mono_class_get_iunknown_class (), &error);
-               mono_error_raise_exception (&error); /* FIXME don't raise here */
+               tunk = cominterop_get_ccw_checked (object, mono_class_get_iunknown_class (), error);
+               return_val_if_nok (error, MONO_E_NOINTERFACE);
                ret = CoCreateFreeThreadedMarshaler (tunk, (LPUNKNOWN*)&ccw->free_marshaler);
        }
                
@@ -2491,7 +2493,9 @@ cominterop_ccw_queryinterface (MonoCCWInterface* ccwe, guint8* riid, gpointer* p
 #ifdef HOST_WIN32
        /* handle IMarshal special */
        if (0 == memcmp (riid, &MONO_IID_IMarshal, sizeof (IID))) {
-               return cominterop_ccw_getfreethreadedmarshaler (ccw, object, ppv);      
+               int res = cominterop_ccw_getfreethreadedmarshaler (ccw, object, ppv, &error);
+               mono_error_assert_ok (&error);
+               return res;
        }
 #endif
        klass_iter = klass;
@@ -2776,22 +2780,41 @@ MonoString *
 mono_string_from_bstr (gpointer bstr)
 {
        MonoError error;
+       MonoString *result = mono_string_from_bstr_checked (bstr, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoString *
+mono_string_from_bstr_icall (gpointer bstr)
+{
+       MonoError error;
+       MonoString *result = mono_string_from_bstr_checked (bstr, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+MonoString *
+mono_string_from_bstr_checked (gpointer bstr, MonoError *error)
+{
        MonoString * res = NULL;
        
+       mono_error_init (error);
+
        if (!bstr)
                return NULL;
 #ifdef HOST_WIN32
-       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, SysStringLen (bstr), &error);
+       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, SysStringLen (bstr), error);
 #else
        if (com_provider == MONO_COM_DEFAULT) {
-               res = mono_string_new_utf16_checked (mono_domain_get (), (const mono_unichar2 *)bstr, *((guint32 *)bstr - 1) / sizeof(gunichar2), &error);
+               res = mono_string_new_utf16_checked (mono_domain_get (), (const mono_unichar2 *)bstr, *((guint32 *)bstr - 1) / sizeof(gunichar2), error);
        } else if (com_provider == MONO_COM_MS && init_com_provider_ms ()) {
                MonoString* str = NULL;
                glong written = 0;
                gunichar2* utf16 = NULL;
 
                utf16 = g_ucs4_to_utf16 ((const gunichar *)bstr, sys_string_len_ms (bstr), NULL, &written, NULL);
-               str = mono_string_new_utf16_checked (mono_domain_get (), utf16, written, &error);
+               str = mono_string_new_utf16_checked (mono_domain_get (), utf16, written, error);
                g_free (utf16);
                res = str;
        } else {
@@ -2799,7 +2822,6 @@ mono_string_from_bstr (gpointer bstr)
        }
 
 #endif
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
        return res;
 }
 
@@ -3118,6 +3140,7 @@ int mono_marshal_safe_array_get_ubound (gpointer psa, guint nDim, glong* plUboun
        return result;
 }
 
+/* This is an icall */
 static gboolean
 mono_marshal_safearray_begin (gpointer safearray, MonoArray **result, gpointer *indices, gpointer empty, gpointer parameter, gboolean allocateNewArray)
 {
@@ -3161,14 +3184,16 @@ mono_marshal_safearray_begin (gpointer safearray, MonoArray **result, gpointer *
                                hr = mono_marshal_safe_array_get_lbound (safearray, i+1, &lbound);
                                if (hr < 0) {
                                        cominterop_set_hr_error (&error, hr);
-                                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                                       if (mono_error_set_pending_exception (&error))
+                                               return FALSE;
                                }
                                if (lbound != 0)
                                        bounded = TRUE;
                                hr = mono_marshal_safe_array_get_ubound (safearray, i+1, &ubound);
                                if (hr < 0) {
                                        cominterop_set_hr_error (&error, hr);
-                                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                                       if (mono_error_set_pending_exception (&error))
+                                               return FALSE;
                                }
                                cursize = ubound-lbound+1;
                                sizes [i] = cursize;
@@ -3183,7 +3208,8 @@ mono_marshal_safearray_begin (gpointer safearray, MonoArray **result, gpointer *
                        if (allocateNewArray) {
                                aklass = mono_bounded_array_class_get (mono_defaults.object_class, dim, bounded);
                                *result = mono_array_new_full_checked (mono_domain_get (), aklass, sizes, bounds, &error);
-                               mono_error_raise_exception (&error); /* FIXME don't raise here */
+                               if (mono_error_set_pending_exception (&error))
+                                       return FALSE;
                        } else {
                                *result = (MonoArray *)parameter;
                        }
@@ -3192,6 +3218,7 @@ mono_marshal_safearray_begin (gpointer safearray, MonoArray **result, gpointer *
        return TRUE;
 }
 
+/* This is an icall */
 static 
 gpointer mono_marshal_safearray_get_value (gpointer safearray, gpointer indices)
 {
@@ -3201,14 +3228,16 @@ gpointer mono_marshal_safearray_get_value (gpointer safearray, gpointer indices)
        int hr = SafeArrayPtrOfIndex (safearray, indices, &result);
        if (hr < 0) {
                        cominterop_set_hr_error (&error, hr);
-                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                       mono_error_set_pending_exception (&error);
+                       return NULL;
        }
 #else
        if (com_provider == MONO_COM_MS && init_com_provider_ms ()) {
                int hr = safe_array_ptr_of_index_ms (safearray, (glong *)indices, &result);
                if (hr < 0) {
                        cominterop_set_hr_error (&error, hr);
-                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                       mono_error_set_pending_exception (&error);
+                       return NULL;
                }
        } else {
                g_assert_not_reached ();
@@ -3217,6 +3246,7 @@ gpointer mono_marshal_safearray_get_value (gpointer safearray, gpointer indices)
        return result;
 }
 
+/* This is an icall */
 static 
 gboolean mono_marshal_safearray_next (gpointer safearray, gpointer indices)
 {
@@ -3234,7 +3264,8 @@ gboolean mono_marshal_safearray_next (gpointer safearray, gpointer indices)
                hr = mono_marshal_safe_array_get_ubound (safearray, i+1, &ubound);
                if (hr < 0) {
                        cominterop_set_hr_error (&error, hr);
-                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                       mono_error_set_pending_exception (&error);
+                       return FALSE;
                }
 
                if (++pIndices[i] <= ubound) {
@@ -3244,7 +3275,8 @@ gboolean mono_marshal_safearray_next (gpointer safearray, gpointer indices)
                hr = mono_marshal_safe_array_get_lbound (safearray, i+1, &lbound);
                if (hr < 0) {
                        cominterop_set_hr_error (&error, hr);
-                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                       mono_error_set_pending_exception (&error);
+                       return FALSE;
                }
 
                pIndices[i] = lbound;
@@ -3316,6 +3348,7 @@ mono_marshal_safearray_create (MonoArray *input, gpointer *newsafearray, gpointe
        return TRUE;
 }
 
+/* This is an icall */
 static 
 void mono_marshal_safearray_set_value (gpointer safearray, gpointer indices, gpointer value)
 {
@@ -3324,14 +3357,16 @@ void mono_marshal_safearray_set_value (gpointer safearray, gpointer indices, gpo
        int hr = SafeArrayPutElement (safearray, indices, value);
        if (hr < 0) {
                cominterop_set_hr_error (&error, hr);
-               mono_error_raise_exception (&error); /* FIXME don't raise here */
+               mono_error_set_pending_exception (&error);
+               return;
        }
 #else
        if (com_provider == MONO_COM_MS && init_com_provider_ms ()) {
                int hr = safe_array_put_element_ms (safearray, (glong *)indices, (void **)value);
                if (hr < 0) {
                        cominterop_set_hr_error (&error, hr);
-                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                       mono_error_set_pending_exception (&error);
+                       return;
                }
        } else
                g_assert_not_reached ();
@@ -3360,7 +3395,7 @@ mono_cominterop_init (void)
        emit an exception in the generated IL.
        */
        register_icall (mono_string_to_bstr, "mono_string_to_bstr", "ptr obj", FALSE);
-       register_icall (mono_string_from_bstr, "mono_string_from_bstr", "obj ptr", FALSE);
+       register_icall (mono_string_from_bstr_icall, "mono_string_from_bstr_icall", "obj ptr", FALSE);
        register_icall (mono_free_bstr, "mono_free_bstr", "void ptr", FALSE);
 }
 
@@ -3398,19 +3433,37 @@ mono_string_to_bstr (MonoString *string_obj)
 #endif
 }
 
+
 MonoString *
 mono_string_from_bstr (gpointer bstr)
 {
-       MonoString *res = NULL;
        MonoError error;
+       MonoString *result = mono_string_from_bstr_checked (bstr, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoString *
+mono_string_from_bstr_icall (gpointer bstr)
+{
+       MonoError error;
+       MonoString *result = mono_string_from_bstr_checked (bstr, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+MonoString *
+mono_string_from_bstr_checked (gpointer bstr, MonoError *error)
+{
+       MonoString *res = NULL;
+       mono_error_init (error);
        if (!bstr)
                return NULL;
 #ifdef HOST_WIN32
-       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, SysStringLen (bstr), &error);
+       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, SysStringLen (bstr), error);
 #else
-       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, *((guint32 *)bstr - 1) / sizeof(gunichar2), &error);
+       res = mono_string_new_utf16_checked (mono_domain_get (), bstr, *((guint32 *)bstr - 1) / sizeof(gunichar2), error);
 #endif
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
        return res;
 }
 
@@ -3458,7 +3511,10 @@ ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointe
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr)
 {
-       return mono_string_from_bstr(ptr);
+       MonoError error;
+       MonoString *result = mono_string_from_bstr_checked (ptr, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
 }
 
 gpointer
index 1338bd3b5bc169c8b440a59ea7d6941155542dbf..d80021aa93bba6172773640a9e9d23c49917d76f 100644 (file)
@@ -47,9 +47,16 @@ mono_cominterop_emit_marshal_safearray (EmitMarshalContext *m, int argnum,
                                                                                int conv_arg, MonoType **conv_arg_type,
                                                                                MarshalAction action);
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoString * 
 mono_string_from_bstr (gpointer bstr);
 
+MonoString *
+mono_string_from_bstr_icall (gpointer bstr);
+
+MonoString *
+mono_string_from_bstr_checked (gpointer bstr, MonoError *error);
+
 MONO_API void 
 mono_free_bstr (gpointer bstr);
 
index 5e3adb36a48537df661e036429f35b7b745af26a..feb69c01cc75e2f9f5aabb36b5a564ddbb7342b9 100644 (file)
@@ -409,6 +409,7 @@ struct _MonoDomain {
        MonoImage *socket_assembly;
        MonoClass *sockaddr_class;
        MonoClassField *sockaddr_data_field;
+       MonoClassField *sockaddr_data_length_field;
 
        /* Cache function pointers for architectures  */
        /* that require wrappers */
index c10b1fee8d934b8249c8ca70b32497e0c5a174dc..0ee01d806d2675dcbed94d83deefe255c12820ff 100644 (file)
@@ -270,7 +270,7 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -279,7 +279,7 @@ ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error)
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -287,7 +287,7 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -296,7 +296,7 @@ ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error)
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -404,9 +404,9 @@ ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
        
        *ioerror = ERROR_SUCCESS;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        names = get_filesystem_entries (mono_string_chars (path), mono_string_chars (path_with_pattern), attrs, mask, ioerror);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (!names) {
                // If there's no array and no error, then return an empty array.
@@ -531,14 +531,14 @@ ves_icall_System_IO_MonoIO_FindClose (gpointer handle)
        IncrementalFind *ifh = (IncrementalFind *)handle;
        gint32 error;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        if (FindClose (ifh->find_handle) == FALSE){
                error = GetLastError ();
        } else
                error = ERROR_SUCCESS;
        g_free (ifh->utf8_path);
        g_free (ifh);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return error;
 }
@@ -602,7 +602,7 @@ ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
                                     gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
 
@@ -611,7 +611,7 @@ ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -623,7 +623,7 @@ ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *
        gboolean ret;
        gunichar2 *utf16_sourceFileName = NULL, *utf16_destinationFileName = NULL, *utf16_destinationBackupFileName = NULL;
        guint32 replaceFlags = REPLACEFILE_WRITE_THROUGH;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        if (sourceFileName)
                utf16_sourceFileName = mono_string_chars (sourceFileName);
@@ -642,7 +642,7 @@ ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *
        if (ret == FALSE)
                *error = GetLastError ();
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return ret;
 }
 
@@ -651,7 +651,7 @@ ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
                                     MonoBoolean overwrite, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -660,7 +660,7 @@ ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -668,7 +668,7 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -677,7 +677,7 @@ ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -685,7 +685,7 @@ gint32
 ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error)
 {
        gint32 ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -702,7 +702,7 @@ ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -711,7 +711,7 @@ ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
                                              gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -721,7 +721,7 @@ ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -729,7 +729,7 @@ gint32
 ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -741,7 +741,7 @@ ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -751,7 +751,7 @@ ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
 {
        gboolean result;
        WIN32_FILE_ATTRIBUTE_DATA data;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -764,7 +764,7 @@ ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
                memset (stat, 0, sizeof (MonoIOStat));
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return result;
 }
 
@@ -776,7 +776,7 @@ ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
        HANDLE ret;
        int attributes, attrs;
        gunichar2 *chars;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        chars = mono_string_chars (filename);   
        *error=ERROR_SUCCESS;
@@ -821,7 +821,7 @@ ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
                *error=GetLastError ();
        } 
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -829,7 +829,7 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -838,7 +838,7 @@ ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -862,9 +862,9 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
 
        buffer = mono_array_addr (dest, guchar, dest_offset);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        result = ReadFile (handle, buffer, count, &n, NULL);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (!result) {
                *error=GetLastError ();
@@ -893,9 +893,9 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
        }
        
        buffer = mono_array_addr (src, guchar, src_offset);
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        result = WriteFile (handle, buffer, count, &n, NULL);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (!result) {
                *error=GetLastError ();
@@ -910,7 +910,7 @@ ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
                                 gint32 *error)
 {
        gint32 offset_hi;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -922,7 +922,7 @@ ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return offset | ((gint64)offset_hi << 32);
 }
 
@@ -930,7 +930,7 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -939,7 +939,7 @@ ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -948,7 +948,7 @@ ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
 {
        gint64 length;
        guint32 length_hi;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -957,7 +957,7 @@ ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
                *error=GetLastError ();
        }
        
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return length | ((gint64)length_hi << 32);
 }
 
@@ -1019,7 +1019,7 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
        const FILETIME *creation_filetime;
        const FILETIME *last_access_filetime;
        const FILETIME *last_write_filetime;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        *error=ERROR_SUCCESS;
        
@@ -1043,7 +1043,7 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
                *error=GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return(ret);
 }
 
@@ -1075,9 +1075,9 @@ ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle, HANDLE *write_handle
        attr.bInheritHandle=TRUE;
        attr.lpSecurityDescriptor=NULL;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret=CreatePipe (read_handle, write_handle, &attr, 0);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if(ret==FALSE) {
                *error = GetLastError ();
@@ -1095,9 +1095,9 @@ ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, HANDLE
        /* This is only used on Windows */
        gboolean ret;
        
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret=DuplicateHandle (source_process_handle, source_handle, target_process_handle, target_handle, access, inherit, options);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if(ret==FALSE) {
                *error = GetLastError ();
@@ -1196,7 +1196,7 @@ void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
                                      gint64 length, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -1206,14 +1206,14 @@ void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
                *error = GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 }
 
 void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
                                        gint64 length, gint32 *error)
 {
        gboolean ret;
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        
        *error=ERROR_SUCCESS;
        
@@ -1223,7 +1223,7 @@ void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
                *error = GetLastError ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 }
 
 //Support for io-layer free mmap'd files.
@@ -1237,7 +1237,7 @@ mono_filesize_from_path (MonoString *string)
        gint64 res;
        char *path = mono_string_to_utf8 (string);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        if (stat (path, &buf) == -1)
                res = -1;
        else
@@ -1245,7 +1245,7 @@ mono_filesize_from_path (MonoString *string)
 
        g_free (path);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return res;
 }
 
@@ -1255,9 +1255,9 @@ mono_filesize_from_fd (int fd)
        struct stat buf;
        int res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        res = fstat (fd, &buf);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        
        if (res == -1)
                return (gint64)-1;
index eb1827a0c6055f863341ad2c12cdcf55b11ec600..d87e158776704977c890c70bbce699ab8854ff53 100644 (file)
@@ -231,9 +231,9 @@ ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq_ptr, gpointer change
                return -1;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        res = kevent (*kq_ptr, changelist, nchanges, eventlist, nevents, NULL);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
 
index 2cff646db1771c099780ffccbf618800d049a270..6050c0dc4b727581e0ba3dd751c25b15f7421de4 100644 (file)
@@ -85,9 +85,9 @@ guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
 {
        guint32 result;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        result = WaitForSingleObjectEx (handle, timeout, alertable);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return result;
 }
@@ -95,11 +95,13 @@ guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
 static void
 add_thread_to_finalize (MonoInternalThread *thread)
 {
+       MonoError error;
        mono_finalizer_lock ();
        if (!threads_to_finalize)
                MONO_GC_REGISTER_ROOT_SINGLE (threads_to_finalize, MONO_ROOT_SOURCE_FINALIZER_QUEUE, "finalizable threads list");
-       threads_to_finalize = mono_mlist_append (threads_to_finalize, (MonoObject*)thread);
+       threads_to_finalize = mono_mlist_append_checked (threads_to_finalize, (MonoObject*)thread, &error);
        mono_finalizer_unlock ();
+       mono_error_raise_exception (&error); /* FIXME don't raise here */
 }
 
 static gboolean suspend_finalizers = FALSE;
index 15e17edb0d9cde932cb54ee5e530a664122ac492..81ffe98fa2649b334cde41b997ac26ebcae23884 100644 (file)
@@ -7173,11 +7173,14 @@ leave:
 ICALL_EXPORT MonoString *
 ves_icall_System_IO_DriveInfo_GetDriveFormat (MonoString *path)
 {
+       MonoError error;
        gunichar2 volume_name [MAX_PATH + 1];
        
        if (GetVolumeInformation (mono_string_chars (path), NULL, 0, NULL, NULL, NULL, volume_name, MAX_PATH + 1) == FALSE)
                return NULL;
-       return mono_string_from_utf16 (volume_name);
+       MonoString *result = mono_string_from_utf16_checked (volume_name, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
 }
 
 ICALL_EXPORT MonoString *
index dfe806d97ec86f6875d742d66168887f19fd127a..4d7f6cb95a1069c95ce4ad51e24fddfc9f19cece 100644 (file)
@@ -79,7 +79,9 @@ static MonoNativeTlsKey load_type_info_tls_id;
 
 static gboolean use_aot_wrappers;
 
-static MonoFtnPtrEHCallback ftnptr_eh_callback;
+static void ftnptr_eh_callback_default (guint32 gchandle);
+
+static MonoFtnPtrEHCallback ftnptr_eh_callback = ftnptr_eh_callback_default;
 
 static void
 delegate_hash_table_add (MonoDelegate *d);
@@ -194,9 +196,6 @@ mono_array_to_lparray (MonoArray *array);
 void
 mono_free_lparray (MonoArray *array, gpointer* nativeArray);
 
-static gint32
-mono_marshal_has_ftnptr_eh_callback (void);
-
 static void
 mono_marshal_ftnptr_eh_callback (guint32 gchandle);
 
@@ -255,6 +254,15 @@ mono_object_isinst_icall (MonoObject *obj, MonoClass *klass)
        return result;
 }
 
+static MonoString*
+ves_icall_mono_string_from_utf16 (gunichar2 *data)
+{
+       MonoError error;
+       MonoString *result = mono_string_from_utf16_checked (data, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
 void
 mono_marshal_init (void)
 {
@@ -269,7 +277,7 @@ mono_marshal_init (void)
                register_icall (mono_marshal_string_to_utf16, "mono_marshal_string_to_utf16", "ptr obj", FALSE);
                register_icall (mono_marshal_string_to_utf16_copy, "mono_marshal_string_to_utf16_copy", "ptr obj", FALSE);
                register_icall (mono_string_to_utf16, "mono_string_to_utf16", "ptr obj", FALSE);
-               register_icall (mono_string_from_utf16, "mono_string_from_utf16", "obj ptr", FALSE);
+               register_icall (ves_icall_mono_string_from_utf16, "ves_icall_mono_string_from_utf16", "obj ptr", FALSE);
                register_icall (mono_string_from_byvalstr, "mono_string_from_byvalstr", "obj ptr int", FALSE);
                register_icall (mono_string_from_byvalwstr, "mono_string_from_byvalwstr", "obj ptr int", FALSE);
                register_icall (mono_string_new_wrapper, "mono_string_new_wrapper", "obj ptr", FALSE);
@@ -313,18 +321,12 @@ mono_marshal_init (void)
                register_icall (mono_gchandle_get_target, "mono_gchandle_get_target", "object int32", TRUE);
                register_icall (mono_gchandle_new, "mono_gchandle_new", "uint32 object bool", TRUE);
                register_icall (mono_marshal_isinst_with_cache, "mono_marshal_isinst_with_cache", "object object ptr ptr", FALSE);
-               register_icall (mono_marshal_has_ftnptr_eh_callback, "mono_marshal_has_ftnptr_eh_callback", "int32", TRUE);
                register_icall (mono_marshal_ftnptr_eh_callback, "mono_marshal_ftnptr_eh_callback", "void uint32", TRUE);
+               register_icall (mono_threads_enter_gc_safe_region_unbalanced, "mono_threads_enter_gc_safe_region_unbalanced", "ptr ptr", TRUE);
+               register_icall (mono_threads_exit_gc_safe_region_unbalanced, "mono_threads_exit_gc_safe_region_unbalanced", "void ptr ptr", TRUE);
 
                mono_cominterop_init ();
                mono_remoting_init ();
-
-               if (mono_threads_is_coop_enabled ()) {
-                       register_icall (mono_threads_prepare_blocking, "mono_threads_prepare_blocking", "ptr ptr", FALSE);
-                       register_icall (mono_threads_finish_blocking, "mono_threads_finish_blocking", "void ptr ptr", FALSE);
-                       register_icall (mono_threads_reset_blocking_start, "mono_threads_reset_blocking_start","ptr ptr", TRUE);
-                       register_icall (mono_threads_reset_blocking_end, "mono_threads_reset_blocking_end","void ptr ptr", TRUE);
-               }
        }
 }
 
@@ -1442,7 +1444,7 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                } else {
                        mono_mb_emit_ldloc (mb, 1);
                        mono_mb_emit_ldloc (mb, 0);
-                       mono_mb_emit_icall (mb, mono_string_from_utf16);
+                       mono_mb_emit_icall (mb, ves_icall_mono_string_from_utf16);
                }
                mono_mb_emit_byte (mb, CEE_STIND_REF);          
                break;          
@@ -1451,7 +1453,7 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
 #ifdef TARGET_WIN32
-               mono_mb_emit_icall (mb, mono_string_from_utf16);
+               mono_mb_emit_icall (mb, ves_icall_mono_string_from_utf16);
 #else
                mono_mb_emit_icall (mb, mono_string_new_wrapper);
 #endif
@@ -1468,7 +1470,7 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
-               mono_mb_emit_icall (mb, mono_string_from_utf16);
+               mono_mb_emit_icall (mb, ves_icall_mono_string_from_utf16);
                mono_mb_emit_byte (mb, CEE_STIND_REF);
                break;
        case MONO_MARSHAL_CONV_OBJECT_STRUCT: {
@@ -1581,7 +1583,7 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
                return mono_marshal_string_to_utf16;            
        case MONO_MARSHAL_CONV_LPWSTR_STR:
                *ind_store_type = CEE_STIND_REF;
-               return mono_string_from_utf16;
+               return ves_icall_mono_string_from_utf16;
        case MONO_MARSHAL_CONV_LPTSTR_STR:
                *ind_store_type = CEE_STIND_REF;
                return mono_string_new_wrapper;
@@ -1600,7 +1602,7 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
                return mono_string_to_bstr;
        case MONO_MARSHAL_CONV_BSTR_STR:
                *ind_store_type = CEE_STIND_REF;
-               return mono_string_from_bstr;
+               return mono_string_from_bstr_icall;
        case MONO_MARSHAL_CONV_STR_TBSTR:
        case MONO_MARSHAL_CONV_STR_ANSIBSTR:
                return mono_string_to_ansibstr;
@@ -7278,12 +7280,10 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
        EmitMarshalContext m;
        MonoMethodSignature *csig;
        MonoClass *klass;
-       MonoExceptionClause *clause;
        int i, argnum, *tmp_locals;
        int type, param_shift = 0;
        static MonoMethodSignature *get_last_error_sig = NULL;
-       int coop_gc_stack_dummy, coop_gc_var, coop_unblocked_var;
-       int leave_pos;
+       int coop_gc_stack_dummy, coop_gc_var;
 
        memset (&m, 0, sizeof (m));
        m.mb = mb;
@@ -7326,12 +7326,20 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                coop_gc_stack_dummy = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                /* local 5, the local to be used when calling the suspend funcs */
                coop_gc_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
-               coop_unblocked_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
-
-               clause = (MonoExceptionClause *)mono_image_alloc0 (image, sizeof (MonoExceptionClause));
-               clause->flags = MONO_EXCEPTION_CLAUSE_FINALLY;
        }
 
+       /*
+        * cookie = mono_threads_enter_gc_safe_region_unbalanced (ref dummy);
+        *
+        * ret = method (...);
+        *
+        * mono_threads_exit_gc_safe_region_unbalanced (cookie, ref dummy);
+        *
+        * <interrupt check>
+        *
+        * return ret;
+        */
+
        if (MONO_TYPE_ISSTRUCT (sig->ret))
                m.vtaddr_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
 
@@ -7363,10 +7371,8 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                        mono_mb_emit_byte (mb, CEE_POP); // Result not needed yet
                }
 
-               clause->try_offset = mono_mb_get_label (mb);
-
                mono_mb_emit_ldloc_addr (mb, coop_gc_stack_dummy);
-               mono_mb_emit_icall (mb, mono_threads_prepare_blocking);
+               mono_mb_emit_icall (mb, mono_threads_enter_gc_safe_region_unbalanced);
                mono_mb_emit_stloc (mb, coop_gc_var);
        }
 
@@ -7391,8 +7397,7 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
 #else
                g_assert_not_reached ();
 #endif
-       }
-       else {
+       } else {
                if (aot) {
                        /* Reuse the ICALL_ADDR opcode for pinvokes too */
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
@@ -7403,6 +7408,24 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                }
        }
 
+       if (MONO_TYPE_ISSTRUCT (sig->ret)) {
+               MonoClass *klass = mono_class_from_mono_type (sig->ret);
+               mono_class_init (klass);
+               if (!(((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) || klass->blittable)) {
+                       /* This is used by emit_marshal_vtype (), but it needs to go right before the call */
+                       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+                       mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
+                       mono_mb_emit_stloc (mb, m.vtaddr_var);
+               }
+       }
+
+       /* Unblock before converting the result, since that can involve calls into the runtime */
+       if (mono_threads_is_coop_enabled ()) {
+               mono_mb_emit_ldloc (mb, coop_gc_var);
+               mono_mb_emit_ldloc_addr (mb, coop_gc_stack_dummy);
+               mono_mb_emit_icall (mb, mono_threads_exit_gc_safe_region_unbalanced);
+       }
+
        /* Set LastError if needed */
        if (piinfo->piflags & PINVOKE_ATTRIBUTE_SUPPORTS_LAST_ERROR) {
                if (!get_last_error_sig) {
@@ -7412,7 +7435,7 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                }
 
 #ifdef TARGET_WIN32
-               /* 
+               /*
                 * Have to call GetLastError () early and without a wrapper, since various runtime components could
                 * clobber its value.
                 */
@@ -7421,26 +7444,6 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
 #else
                mono_mb_emit_icall (mb, mono_marshal_set_last_error);
 #endif
-       }               
-
-       if (MONO_TYPE_ISSTRUCT (sig->ret)) {
-               MonoClass *klass = mono_class_from_mono_type (sig->ret);
-               mono_class_init (klass);
-               if (!(((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) || klass->blittable)) {
-                       /* This is used by emit_marshal_vtype (), but it needs to go right before the call */
-                       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
-                       mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
-                       mono_mb_emit_stloc (mb, m.vtaddr_var);
-               }
-       }
-
-       /* Unblock before converting the result, since that can involve calls into the runtime */
-       if (mono_threads_is_coop_enabled ()) {
-               mono_mb_emit_ldloc (mb, coop_gc_var);
-               mono_mb_emit_ldloc_addr (mb, coop_gc_stack_dummy);
-               mono_mb_emit_icall (mb, mono_threads_finish_blocking);
-               mono_mb_emit_icon (mb, 1);
-               mono_mb_emit_stloc (mb, coop_unblocked_var);
        }
 
        /* convert the result */
@@ -7497,31 +7500,6 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                mono_mb_emit_stloc (mb, 3);
        }
 
-       if (mono_threads_is_coop_enabled ()) {
-               int pos;
-
-               leave_pos = mono_mb_emit_branch (mb, CEE_LEAVE);
-
-               clause->try_len = mono_mb_get_label (mb) - clause->try_offset;
-               clause->handler_offset = mono_mb_get_label (mb);
-
-               mono_mb_emit_ldloc (mb, coop_unblocked_var);
-               mono_mb_emit_icon (mb, 1);
-               pos = mono_mb_emit_branch (mb, CEE_BEQ);
-
-               mono_mb_emit_ldloc (mb, coop_gc_var);
-               mono_mb_emit_ldloc_addr (mb, coop_gc_stack_dummy);
-               mono_mb_emit_icall (mb, mono_threads_finish_blocking);
-
-               mono_mb_patch_branch (mb, pos);
-
-               mono_mb_emit_byte (mb, CEE_ENDFINALLY);
-
-               clause->handler_len = mono_mb_get_pos (mb) - clause->handler_offset;
-
-               mono_mb_patch_branch (mb, leave_pos);
-       }
-
        /* 
         * Need to call this after converting the result since MONO_VTADDR needs 
         * to be adjacent to the call instruction.
@@ -7559,10 +7537,6 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
                mono_mb_emit_ldloc (mb, 3);
 
        mono_mb_emit_byte (mb, CEE_RET);
-
-       if (mono_threads_is_coop_enabled ()) {
-               mono_mb_set_clauses (mb, 1, clause);
-       }
 }
 #endif /* DISABLE_JIT */
 
@@ -7970,7 +7944,7 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
        MonoMethodSignature *sig, *csig;
        MonoExceptionClause *clauses, *clause_finally, *clause_catch;
        int i, *tmp_locals, ex_local, e_local;
-       int leave_try_pos, leave_catch_pos, ex_m1_pos, rethrow_pos;
+       int leave_try_pos, leave_catch_pos, ex_m1_pos;
        gboolean closed = FALSE;
 
        sig = m->sig;
@@ -8013,14 +7987,13 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
         *
         *   ret = method (...);
         * } catch (Exception e) {
-        *   if (!mono_marshal_has_ftnptr_eh_callback ())
-        *     throw e;
         *   ex = mono_gchandle_new (e, false);
         * } finally {
         *   mono_jit_detach ();
+        *
+        *   if (ex != -1)
+        *     mono_marshal_ftnptr_eh_callback (ex);
         * }
-        * if (ex != -1)
-        *   mono_marshal_ftnptr_eh_callback (ex);
         *
         * return ret;
         */
@@ -8198,23 +8171,14 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
 
        leave_try_pos = mono_mb_emit_branch (mb, CEE_LEAVE);
 
-       /* } catch (Exception e) { */
+       /* } [endtry] */
+
+       /* catch (Exception e) { */
        clause_catch->try_len = mono_mb_get_label (mb) - clause_catch->try_offset;
        clause_catch->handler_offset = mono_mb_get_label (mb);
 
        mono_mb_emit_stloc (mb, e_local);
 
-       /* if (!mono_marshal_has_ftnptr_eh_callback ()) { */
-       mono_mb_emit_icall (mb, mono_marshal_has_ftnptr_eh_callback);
-       rethrow_pos = mono_mb_emit_branch (mb, CEE_BRTRUE);
-
-       /* throw e; */
-       mono_mb_emit_ldloc (mb, e_local);
-       mono_mb_emit_byte (mb, CEE_THROW);
-
-       /* } [endif] */
-       mono_mb_patch_branch (mb, rethrow_pos);
-
        /* ex = mono_gchandle_new (e, false); */
        mono_mb_emit_ldloc (mb, e_local);
        mono_mb_emit_icon (mb, 0);
@@ -8226,7 +8190,7 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
        /* } [endcatch] */
        clause_catch->handler_len = mono_mb_get_pos (mb) - clause_catch->handler_offset;
 
-       /* finally { */
+       /* finally { */
        clause_finally->try_len = mono_mb_get_label (mb) - clause_finally->try_offset;
        clause_finally->handler_offset = mono_mb_get_label (mb);
 
@@ -8238,14 +8202,6 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
        mono_mb_emit_byte (mb, CEE_MONO_JIT_DETACH);
 
-       mono_mb_emit_byte (mb, CEE_ENDFINALLY);
-
-       /* } [endfinally] */
-       clause_finally->handler_len = mono_mb_get_pos (mb) - clause_finally->handler_offset;
-
-       mono_mb_patch_branch (mb, leave_try_pos);
-       mono_mb_patch_branch (mb, leave_catch_pos);
-
        /* if (ex != -1) */
        mono_mb_emit_ldloc (mb, ex_local);
        mono_mb_emit_icon (mb, -1);
@@ -8259,6 +8215,14 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
        /* [ex == -1] */
        mono_mb_patch_branch (mb, ex_m1_pos);
 
+       mono_mb_emit_byte (mb, CEE_ENDFINALLY);
+
+       /* } [endfinally] */
+       clause_finally->handler_len = mono_mb_get_pos (mb) - clause_finally->handler_offset;
+
+       mono_mb_patch_branch (mb, leave_try_pos);
+       mono_mb_patch_branch (mb, leave_catch_pos);
+
        /* return ret; */
        if (m->retobj_var) {
                mono_mb_emit_ldloc (mb, m->retobj_var);
@@ -11692,10 +11656,12 @@ mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method)
        GHashTable *cache;
        MonoMethod *res;
        int i, param_count, sig_size, pos_leave;
-       int coop_gc_var, coop_gc_dummy_local;
 
        g_assert (method);
 
+       // FIXME: we need to store the exception into a MonoHandle
+       g_assert (!mono_threads_is_coop_enabled ());
+
        klass = method->klass;
        image = method->klass->image;
 
@@ -11745,26 +11711,11 @@ mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method)
        if (!MONO_TYPE_IS_VOID (sig->ret))
                mono_mb_add_local (mb, sig->ret);
 
-       if (mono_threads_is_coop_enabled ()) {
-               /* local 4, the local to be used when calling the reset_blocking funcs */
-               /* tons of code hardcode 3 to be the return var */
-               coop_gc_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
-               /* local 5, the local used to get a stack address for suspend funcs */
-               coop_gc_dummy_local = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
-       }
-
        /* clear exception arg */
        mono_mb_emit_ldarg (mb, param_count - 1);
        mono_mb_emit_byte (mb, CEE_LDNULL);
        mono_mb_emit_byte (mb, CEE_STIND_REF);
 
-       if (mono_threads_is_coop_enabled ()) {
-               /* FIXME this is technically wrong as the callback itself must be executed in gc unsafe context. */
-               mono_mb_emit_ldloc_addr (mb, coop_gc_dummy_local);
-               mono_mb_emit_icall (mb, mono_threads_reset_blocking_start);
-               mono_mb_emit_stloc (mb, coop_gc_var);
-       }
-
        /* try */
        clause = (MonoExceptionClause *)mono_image_alloc0 (image, sizeof (MonoExceptionClause));
        clause->try_offset = mono_mb_get_label (mb);
@@ -11834,13 +11785,6 @@ mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method)
                        mono_mb_emit_op (mb, CEE_BOX, mono_class_from_mono_type (sig->ret));
        }
 
-       if (mono_threads_is_coop_enabled ()) {
-               /* XXX merge reset_blocking_end with detach */
-               mono_mb_emit_ldloc (mb, coop_gc_var);
-               mono_mb_emit_ldloc_addr (mb, coop_gc_dummy_local);
-               mono_mb_emit_icall (mb, mono_threads_reset_blocking_end);
-       }
-
        mono_mb_emit_byte (mb, CEE_RET);
 #endif
 
@@ -11881,12 +11825,6 @@ mono_marshal_free_dynamic_wrappers (MonoMethod *method)
                mono_marshal_unlock ();
 }
 
-static gint32
-mono_marshal_has_ftnptr_eh_callback (void)
-{
-       return ftnptr_eh_callback != NULL;
-}
-
 static void
 mono_marshal_ftnptr_eh_callback (guint32 gchandle)
 {
@@ -11894,6 +11832,23 @@ mono_marshal_ftnptr_eh_callback (guint32 gchandle)
        ftnptr_eh_callback (gchandle);
 }
 
+static void
+ftnptr_eh_callback_default (guint32 gchandle)
+{
+       MonoException *exc;
+       gpointer stackdata;
+
+       g_assert (gchandle >= 0);
+
+       mono_threads_enter_gc_unsafe_region_unbalanced (&stackdata);
+
+       exc = (MonoException*) mono_gchandle_get_target (gchandle);
+
+       mono_gchandle_free (gchandle);
+
+       mono_raise_exception (exc);
+}
+
 /*
  * mono_install_ftnptr_eh_callback:
  *
index 0fe4b593d58e782171e329439a29745266bdd87f..6cf9691777ea783631f39c7cac24c239cd180a7f 100644 (file)
@@ -881,9 +881,9 @@ retry_contended:
         * We pass TRUE instead of allow_interruption since we have to check for the
         * StopRequested case below.
         */
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret = WaitForSingleObjectEx (mon->entry_sem, waitms, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
        
@@ -1279,9 +1279,9 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms)
         * is private to this thread.  Therefore even if the event was
         * signalled before we wait, we still succeed.
         */
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret = WaitForSingleObjectEx (event, ms, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        /* Reset the thread state fairly early, so we don't have to worry
         * about the monitor error checking
@@ -1304,9 +1304,9 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms)
                /* Poll the event again, just in case it was signalled
                 * while we were trying to regain the monitor lock
                 */
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
                ret = WaitForSingleObjectEx (event, 0, FALSE);
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
        }
 
        /* Pulse will have popped our event from the queue if it signalled
index 657800afbe35e70255efb0f3588a9a41f7ef0225..42d646444b136658a5a5fc76a87ebf5a89d8828d 100644 (file)
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/object-internals.h"
 
+
+static
+MonoMList*  mono_mlist_alloc_checked       (MonoObject *data, MonoError *error);
+
+
 /* matches the System.MonoListItem object*/
 struct _MonoMList {
        MonoObject object;
@@ -40,14 +45,35 @@ MonoMList*
 mono_mlist_alloc (MonoObject *data)
 {
        MonoError error;
+       MonoMList *result = mono_mlist_alloc_checked (data, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_mlist_alloc_checked:
+ * @data: object to use as data
+ * @error: set on error
+ *
+ * Allocates a new managed list node with @data as the contents.  A
+ * managed list node also represents a singly-linked list.  Managed
+ * lists are garbage collected, so there is no free routine and the
+ * user is required to keep references to the managed list to prevent
+ * it from being garbage collected. On failure returns NULL and sets
+ * @error.
+ */
+MonoMList*
+mono_mlist_alloc_checked (MonoObject *data, MonoError *error)
+{
+       mono_error_init (error);
        MonoMList* res;
        if (!monolist_item_vtable) {
                MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoListItem");
                monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
                g_assert (monolist_item_vtable);
        }
-       res = (MonoMList*)mono_object_new_fast_checked (monolist_item_vtable, &error);
-       mono_error_raise_exception (&error);
+       res = (MonoMList*)mono_object_new_fast_checked (monolist_item_vtable, error);
+       return_val_if_nok (error, NULL);
        MONO_OBJECT_SETREF (res, data, data);
        return res;
 }
@@ -152,7 +178,29 @@ mono_mlist_last (MonoMList* list)
 MonoMList*
 mono_mlist_prepend (MonoMList* list, MonoObject *data)
 {
-       MonoMList* res = mono_mlist_alloc (data);
+       MonoError error;
+       MonoMList *result = mono_mlist_prepend_checked (list, data, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_mlist_prepend_checked:
+ * @list: the managed list
+ * @data: the object to add to the list
+ * @error: set on error
+ *
+ * Allocate a new list node with @data as content and prepend it to
+ * the list @list. @list can be NULL. On failure returns NULL and sets
+ * @error.
+ */
+MonoMList*
+mono_mlist_prepend_checked (MonoMList* list, MonoObject *data, MonoError *error)
+{
+       mono_error_init (error);
+       MonoMList* res = mono_mlist_alloc_checked (data, error);
+       return_val_if_nok (error, NULL);
+
        if (list)
                MONO_OBJECT_SETREF (res, next, list);
        return res;
@@ -170,7 +218,30 @@ mono_mlist_prepend (MonoMList* list, MonoObject *data)
 MonoMList*
 mono_mlist_append (MonoMList* list, MonoObject *data)
 {
-       MonoMList* res = mono_mlist_alloc (data);
+       MonoError error;
+       MonoMList *result = mono_mlist_append_checked (list, data, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_mlist_append_checked:
+ * @list: the managed list
+ * @data: the object to add to the list
+ * @error: set on error
+ *
+ * Allocate a new list node with @data as content and append it
+ * to the list @list. @list can be NULL.
+ * Since managed lists are singly-linked, this operation takes O(n) time.
+ * On failure returns NULL and sets @error.
+ */
+MonoMList*
+mono_mlist_append_checked (MonoMList* list, MonoObject *data, MonoError *error)
+{
+       mono_error_init (error);
+       MonoMList* res = mono_mlist_alloc_checked (data, error);
+       return_val_if_nok (error, NULL);
+
        if (list) {
                MonoMList* last = mono_mlist_last (list);
                MONO_OBJECT_SETREF (last, next, res);
index 199496a42eeee2dfa64e709910f73c9e7be8804e..c625ecacc84aa1cece647e2084760c8cee2c08f7 100644 (file)
@@ -8,6 +8,7 @@
 #include <mono/metadata/object.h>
 
 typedef struct _MonoMList MonoMList;
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoMList*  mono_mlist_alloc       (MonoObject *data);
 MONO_API MonoObject* mono_mlist_get_data    (MonoMList* list);
 MONO_API void        mono_mlist_set_data    (MonoMList* list, MonoObject *data);
@@ -15,8 +16,14 @@ MONO_API MonoMList*  mono_mlist_set_next    (MonoMList* list, MonoMList *next);
 MONO_API int         mono_mlist_length      (MonoMList* list);
 MONO_API MonoMList*  mono_mlist_next        (MonoMList* list);
 MONO_API MonoMList*  mono_mlist_last        (MonoMList* list);
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoMList*  mono_mlist_prepend     (MonoMList* list, MonoObject *data);
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoMList*  mono_mlist_append      (MonoMList* list, MonoObject *data);
+
+MonoMList*  mono_mlist_prepend_checked      (MonoMList* list, MonoObject *data, MonoError *error);
+MonoMList*  mono_mlist_append_checked       (MonoMList* list, MonoObject *data, MonoError *error);
+
 MONO_API MonoMList*  mono_mlist_remove_item (MonoMList* list, MonoMList *item);
 
 #endif /* __MONO_METADATA_MONO_MLIST_H__ */
index f1fc19c418f2bdb55c856f7d7fcc33475632fbda..13ad74572d2c42353517dde92c1966c158649661 100644 (file)
@@ -1691,6 +1691,12 @@ mono_string_new_checked (MonoDomain *domain, const char *text, MonoError *merror
 MonoString *
 mono_string_new_utf16_checked (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error);
 
+MonoString *
+mono_string_from_utf16_checked (mono_unichar2 *data, MonoError *error);
+
+MonoString *
+mono_string_from_utf32_checked (mono_unichar4 *data, MonoError *error);
+
 gboolean
 mono_runtime_object_init_checked (MonoObject *this_obj, MonoError *error);
 
index 0f3310af9a9191025a813dc6a309ae5506736e4d..fa68faab7123b38defc9d0daa800c10e23ad4dbc 100644 (file)
@@ -2892,11 +2892,11 @@ do_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **ex
        if (mono_profiler_get_events () & MONO_PROFILE_METHOD_EVENTS)
                mono_profiler_method_start_invoke (method);
 
-       MONO_PREPARE_RESET_BLOCKING;
+       MONO_ENTER_GC_UNSAFE;
 
        result = callbacks.runtime_invoke (method, obj, params, exc, error);
 
-       MONO_FINISH_RESET_BLOCKING;
+       MONO_EXIT_GC_UNSAFE;
 
        if (mono_profiler_get_events () & MONO_PROFILE_METHOD_EVENTS)
                mono_profiler_method_end_invoke (method);
@@ -3115,10 +3115,12 @@ mono_method_get_unmanaged_thunk (MonoMethod *method)
 
        gpointer res;
 
-       MONO_PREPARE_RESET_BLOCKING;
+       g_assert (!mono_threads_is_coop_enabled ());
+
+       MONO_ENTER_GC_UNSAFE;
        method = mono_marshal_get_thunk_invoke_wrapper (method);
        res = mono_compile_method (method);
-       MONO_FINISH_RESET_BLOCKING;
+       MONO_EXIT_GC_UNSAFE;
 
        return res;
 }
@@ -6768,10 +6770,28 @@ mono_string_to_utf32 (MonoString *s)
 MonoString *
 mono_string_from_utf16 (gunichar2 *data)
 {
+       MonoError error;
+       MonoString *result = mono_string_from_utf16_checked (data, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_string_from_utf16_checked:
+ * @data: the UTF16 string (LPWSTR) to convert
+ * @error: set on error
+ *
+ * Converts a NULL terminated UTF16 string (LPWSTR) to a MonoString.
+ *
+ * Returns: a MonoString. On failure sets @error and returns NULL.
+ */
+MonoString *
+mono_string_from_utf16_checked (gunichar2 *data, MonoError *error)
+{
+
        MONO_REQ_GC_UNSAFE_MODE;
 
-       MonoError error;
-       MonoString *res = NULL;
+       mono_error_init (error);
        MonoDomain *domain = mono_domain_get ();
        int len = 0;
 
@@ -6780,9 +6800,7 @@ mono_string_from_utf16 (gunichar2 *data)
 
        while (data [len]) len++;
 
-       res = mono_string_new_utf16_checked (domain, data, len, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
-       return res;
+       return mono_string_new_utf16_checked (domain, data, len, error);
 }
 
 /**
@@ -6795,12 +6813,31 @@ mono_string_from_utf16 (gunichar2 *data)
  */
 MonoString *
 mono_string_from_utf32 (mono_unichar4 *data)
+{
+       MonoError error;
+       MonoString *result = mono_string_from_utf32_checked (data, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_string_from_utf32_checked:
+ * @data: the UTF32 string (LPWSTR) to convert
+ * @error: set on error
+ *
+ * Converts a UTF32 (UCS-4)to a MonoString.
+ *
+ * Returns: a MonoString. On failure returns NULL and sets @error.
+ */
+MonoString *
+mono_string_from_utf32_checked (mono_unichar4 *data, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
+       mono_error_init (error);
        MonoString* result = NULL;
        mono_unichar2 *utf16_output = NULL;
-       GError *error = NULL;
+       GError *gerror = NULL;
        glong items_written;
        int len = 0;
 
@@ -6809,12 +6846,12 @@ mono_string_from_utf32 (mono_unichar4 *data)
 
        while (data [len]) len++;
 
-       utf16_output = g_ucs4_to_utf16 (data, len, NULL, &items_written, &error);
+       utf16_output = g_ucs4_to_utf16 (data, len, NULL, &items_written, &gerror);
 
-       if (error)
-               g_error_free (error);
+       if (gerror)
+               g_error_free (gerror);
 
-       result = mono_string_from_utf16 (utf16_output);
+       result = mono_string_from_utf16_checked (utf16_output, error);
        g_free (utf16_output);
        return result;
 }
index 8ef51ede65a6ea0ebb2494201a75f0c4e9e750e1..52b6b079aa2eafb7efe8178f61f18d79c1aa537e 100644 (file)
@@ -156,9 +156,11 @@ mono_string_to_utf16           (MonoString *string_obj);
 MONO_API mono_unichar4 *
 mono_string_to_utf32       (MonoString *string_obj);
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoString *
 mono_string_from_utf16     (mono_unichar2 *data);
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoString *
 mono_string_from_utf32     (mono_unichar4 *data);
 
index 3b419bc00482aefea82f8f87c73a86826c7e589c..4a651b09f18df10603a8e3e6b20011f145f75a5d 100644 (file)
@@ -294,9 +294,9 @@ mono_reflection_init (void)
 static inline void
 dynamic_image_lock (MonoDynamicImage *image)
 {
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        mono_image_lock ((MonoImage*)image);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 }
 
 static inline void
@@ -13292,8 +13292,6 @@ mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb)
         */
        klass->flags = tb->attrs;
        klass->has_cctor = 1;
-       klass->has_finalize = 1;
-       klass->has_finalize_inited = 1;
 
        mono_class_setup_parent (klass, klass->parent);
        /* fool mono_class_setup_supertypes */
index 7e29d804156b0e64dd760868319245931a497a3d..6510bfe0f1ffc69f965bc211cdecd5725531eb03 100644 (file)
@@ -2284,7 +2284,7 @@ void
 sgen_client_thread_register_worker (void)
 {
        mono_thread_info_register_small_id ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "SGen worker");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "SGen worker");
 }
 
 /* Variables holding start/end nursery so it won't have to be passed at every call */
index c6374c00c450ad8846c2f45bbc5354d446f60d5e..eb272c241d6a56f46d0c307ab2aa1047c33005cf 100644 (file)
@@ -695,9 +695,9 @@ ves_icall_System_Net_Sockets_Socket_Close_internal (SOCKET sock, gint32 *werror)
         * polling system does not notify when the socket is closed */
        mono_threadpool_ms_io_remove_socket (GPOINTER_TO_INT (sock));
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        closesocket (sock);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 }
 
 gint32
@@ -758,7 +758,7 @@ ves_icall_System_Net_Sockets_Socket_Accept_internal (SOCKET sock, gint32 *werror
                return NULL;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
 #ifdef HOST_WIN32
        {
@@ -771,7 +771,7 @@ ves_icall_System_Net_Sockets_Socket_Accept_internal (SOCKET sock, gint32 *werror
        newsock = _wapi_accept (sock, NULL, 0);
 #endif
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -794,11 +794,11 @@ ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, guint32 backlog
        
        *werror = 0;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_listen (sock, backlog);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret == SOCKET_ERROR)
                *werror = WSAGetLastError ();
@@ -841,10 +841,16 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
        
        /* Locate the SocketAddress data buffer in the object */
        if (!domain->sockaddr_data_field) {
-               domain->sockaddr_data_field = mono_class_get_field_from_name (domain->sockaddr_class, "data");
+               domain->sockaddr_data_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Buffer");
                g_assert (domain->sockaddr_data_field);
        }
 
+       /* Locate the SocketAddress data buffer length in the object */
+       if (!domain->sockaddr_data_length_field) {
+               domain->sockaddr_data_length_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Size");
+               g_assert (domain->sockaddr_data_length_field);
+       }
+
        /* May be the +2 here is too conservative, as sa_len returns
         * the length of the entire sockaddr_in/in6, including
         * sizeof (unsigned short) of the family */
@@ -871,8 +877,9 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                struct sockaddr_in *sa_in = (struct sockaddr_in *)saddr;
                guint16 port = ntohs (sa_in->sin_port);
                guint32 address = ntohl (sa_in->sin_addr.s_addr);
+               int buffer_size = 8;
                
-               if (sa_size < 8) {
+               if (sa_size < buffer_size) {
                        mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
                        return NULL;
                }
@@ -885,15 +892,17 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                mono_array_set (data, guint8, 7, (address) & 0xff);
        
                mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
+               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
 
                return sockaddr_obj;
        } else if (saddr->sa_family == AF_INET6) {
                struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)saddr;
                int i;
+               int buffer_size = 28;
 
                guint16 port = ntohs (sa_in->sin6_port);
 
-               if (sa_size < 28) {
+               if (sa_size < buffer_size) {
                        mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
                        return NULL;
                }
@@ -921,17 +930,20 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                                                (sa_in->sin6_scope_id >> 24) & 0xff);
 
                mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
+               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
 
                return sockaddr_obj;
        }
 #ifdef HAVE_SYS_UN_H
        else if (saddr->sa_family == AF_UNIX) {
                int i;
+               int buffer_size = sa_size + 2;
 
                for (i = 0; i < sa_size; i++)
                        mono_array_set (data, guint8, i + 2, saddr->sa_data [i]);
                
                mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
+               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
 
                return sockaddr_obj;
        }
@@ -979,11 +991,11 @@ ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (SOCKET sock, gint32
        }
        sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_getsockname (sock, (struct sockaddr *)sa, &salen);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        
        if (ret == SOCKET_ERROR) {
                *werror = WSAGetLastError ();
@@ -1021,11 +1033,11 @@ ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (SOCKET sock, gint32
        sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
        /* Note: linux returns just 2 for AF_UNIX. Always. */
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_getpeername (sock, (struct sockaddr *)sa, &salen);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret == SOCKET_ERROR) {
                *werror = WSAGetLastError ();
@@ -1047,16 +1059,29 @@ ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (SOCKET sock, gint32
 static struct sockaddr*
 create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error)
 {
-       MonoClassField *field;
+       MonoDomain *domain = mono_domain_get ();
        MonoArray *data;
        gint32 family;
        int len;
 
        mono_error_init (error);
 
-       /* Dig the SocketAddress data buffer out of the object */
-       field = mono_class_get_field_from_name (saddr_obj->vtable->klass, "data");
-       data = *(MonoArray **)(((char *)saddr_obj) + field->offset);
+       if (!domain->sockaddr_class)
+               domain->sockaddr_class = mono_class_load_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
+
+       /* Locate the SocketAddress data buffer in the object */
+       if (!domain->sockaddr_data_field) {
+               domain->sockaddr_data_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Buffer");
+               g_assert (domain->sockaddr_data_field);
+       }
+
+       /* Locate the SocketAddress data buffer length in the object */
+       if (!domain->sockaddr_data_length_field) {
+               domain->sockaddr_data_length_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Size");
+               g_assert (domain->sockaddr_data_length_field);
+       }
+
+       data = *(MonoArray **)(((char *)saddr_obj) + domain->sockaddr_data_field->offset);
 
        /* The data buffer is laid out as follows:
         * byte 0 is the address family low byte
@@ -1067,12 +1092,9 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
         * UNIX:
         *      the rest is the file name
         */
-       len = mono_array_length (data);
-       if (len < 2) {
-               mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
-               return NULL;
-       }
-       
+       len = *(int *)(((char *)saddr_obj) + domain->sockaddr_data_length_field->offset);
+       g_assert (len >= 2);
+
        family = convert_family ((MonoAddressFamily)(mono_array_get (data, guint8, 0) + (mono_array_get (data, guint8, 1) << 8)));
        if (family == AF_INET) {
                struct sockaddr_in *sa;
@@ -1228,11 +1250,11 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode,
                        return FALSE;
                }
 
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
 
                ret = mono_poll (pfds, 1, timeout);
 
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
 
                mono_thread_info_uninstall_interrupt (&interrupted);
                if (interrupted) {
@@ -1307,11 +1329,11 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (SOCKET sock, MonoObject *s
                return;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_connect (sock, sa, sa_size);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1354,7 +1376,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
 
        LOGDEBUG (g_message("%s: disconnecting from socket %p (reuse %d)", __func__, sock, reuse));
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        /* I _think_ the extension function pointers need to be looked
         * up for each socket.  FIXME: check the best way to store
@@ -1364,7 +1386,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
        ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, (gchar *)&disco_guid, sizeof (GUID),
                                        (gchar *)&_wapi_disconnectex, sizeof (void *), &output_bytes, NULL, NULL);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret != 0) {
                /* make sure that WSAIoctl didn't put crap in the
@@ -1372,7 +1394,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
                 */
                _wapi_disconnectex = NULL;
 
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
 
                /*
                 * Use the SIO_GET_EXTENSION_FUNCTION_POINTER to
@@ -1385,7 +1407,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
                ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, (gchar *)&trans_guid, sizeof(GUID),
                                (gchar *)&_wapi_transmitfile, sizeof(void *), &output_bytes, NULL, NULL);
 
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
 
                if (ret != 0)
                        _wapi_transmitfile = NULL;
@@ -1397,7 +1419,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
                return;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        if (_wapi_disconnectex != NULL) {
                if (!_wapi_disconnectex (sock, NULL, TF_REUSE_SOCKET, 0))
@@ -1409,7 +1431,7 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
                *werror = ERROR_NOT_SUPPORTED;
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted)
@@ -1444,7 +1466,7 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *bu
        if (interrupted)
                return 0;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
 #ifdef HOST_WIN32
        {
@@ -1456,7 +1478,7 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *bu
        ret = _wapi_recv (sock, buf, count, recvflags);
 #endif
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1498,11 +1520,11 @@ ves_icall_System_Net_Sockets_Socket_Receive_array_internal (SOCKET sock, MonoArr
                return 0;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = WSARecv (sock, wsabufs, count, &recv, &recvflags, NULL, NULL);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1559,11 +1581,11 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (SOCKET sock, MonoArray
                return 0;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_recvfrom (sock, buf, count, recvflags, sa, &sa_size);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1631,11 +1653,11 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (SOCKET sock, MonoArray *buffe
                return 0;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_send (sock, buf, count, sendflags);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1677,11 +1699,11 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (SOCKET sock, MonoArray
                return 0;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = WSASend (sock, wsabufs, count, &sent, sendflags, NULL, NULL);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1744,11 +1766,11 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (SOCKET sock, MonoArray *buf
                return 0;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_sendto (sock, buf, count, sendflags, sa, sa_size);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -1835,11 +1857,11 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32
                        return;
                }
 
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
 
                ret = mono_poll (pfds, nfds, timeout);
 
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
 
                mono_thread_info_uninstall_interrupt (&interrupted);
                if (interrupted) {
@@ -1981,7 +2003,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (SOCKET sock, g
                return;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        /* No need to deal with MulticastOption names here, because
         * you cant getsockopt AddMembership or DropMembership (the
@@ -2008,7 +2030,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (SOCKET sock, g
                ret = _wapi_getsockopt (sock, system_level, system_name, &val, &valsize);
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret == SOCKET_ERROR) {
                *werror = WSAGetLastError ();
@@ -2120,11 +2142,11 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (SOCKET sock, g
        valsize = mono_array_length (*byte_val);
        buf = mono_array_addr (*byte_val, guchar, 0);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = _wapi_getsockopt (sock, system_level, system_name, buf, &valsize);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret == SOCKET_ERROR)
                *werror = WSAGetLastError ();
@@ -2157,19 +2179,20 @@ ipaddress_to_struct_in6_addr (MonoObject *ipaddr)
        int i;
 
        field = mono_class_get_field_from_name (ipaddr->vtable->klass, "m_Numbers");
+       g_assert (field);
        data = *(MonoArray **)(((char *)ipaddr) + field->offset);
 
-/* Solaris has only the 8 bit version. */
-#ifndef s6_addr16
        for (i = 0; i < 8; i++) {
-               guint16 s = mono_array_get (data, guint16, i);
+               const guint16 s = GUINT16_TO_BE (mono_array_get (data, guint16, i));
+
+/* Solaris/MacOS have only the 8 bit version. */
+#ifndef s6_addr16
                in6addr.s6_addr[2 * i + 1] = (s >> 8) & 0xff;
                in6addr.s6_addr[2 * i] = s & 0xff;
-       }
 #else
-       for (i = 0; i < 8; i++)
-               in6addr.s6_addr16[i] = mono_array_get (data, guint16, i);
+               in6addr.s6_addr16[i] = s;
 #endif
+       }
        return in6addr;
 }
 #endif
@@ -2274,6 +2297,7 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (SOCKET sock, gint3
                                 *      Get group address
                                 */
                                field = mono_class_get_field_from_name (obj_val->vtable->klass, "m_Group");
+                               g_assert (field);
                                address = *(MonoObject **)(((char *)obj_val) + field->offset);
                                
                                if (address)
@@ -2422,12 +2446,12 @@ ves_icall_System_Net_Sockets_Socket_Shutdown_internal (SOCKET sock, gint32 how,
                return;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        /* Currently, the values for how (recv=0, send=1, both=2) match the BSD API */
        ret = _wapi_shutdown (sock, how);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -2469,11 +2493,11 @@ ves_icall_System_Net_Sockets_Socket_IOControl_internal (SOCKET sock, gint32 code
                o_len = mono_array_length (output);
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = WSAIoctl (sock, code, i_buffer, i_len, o_buffer, o_len, &output_bytes, NULL, NULL);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret == SOCKET_ERROR) {
                *werror = WSAGetLastError ();
@@ -2688,7 +2712,7 @@ ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **
 
        g_free (address);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        switch (family) {
        case AF_INET: {
@@ -2709,7 +2733,7 @@ ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **
                g_assert_not_reached ();
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (!ret)
                return FALSE;
@@ -2780,11 +2804,11 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
                return FALSE;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        ret = TransmitFile (sock, file, 0, 0, NULL, &buffers, flags);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
@@ -2793,11 +2817,11 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
                return FALSE;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        CloseHandle (file);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return ret;
 }
index be330aa413a76fb8e08c626c6851795937d005ce..abbccd6a19a633dbb8d8f2b6a4cf4a7d3fd2fa3c 100644 (file)
@@ -39,7 +39,7 @@ ves_icall_System_String_InternalAllocateStr (gint32 length)
 {
        MonoError error;
        MonoString *str = mono_string_new_size_checked (mono_domain_get (), length, &error);
-       mono_error_raise_exception (&error);
+       mono_error_set_pending_exception (&error);
 
        return str;
 }
index 7aa39b2b4a5b2a435dd301663859c08e2111b3dc..1840ac45699797f617d7c851eecee2b8fd168825 100644 (file)
@@ -347,7 +347,8 @@ selector_thread (gpointer data)
                                g_assert (job);
 
                                exists = mono_g_hash_table_lookup_extended (states, GINT_TO_POINTER (fd), &k, (gpointer*) &list);
-                               list = mono_mlist_append (list, (MonoObject*) job);
+                               list = mono_mlist_append_checked (list, (MonoObject*) job, &error);
+                               mono_error_raise_exception (&error); /* FIXME don't raise here */
                                mono_g_hash_table_replace (states, GINT_TO_POINTER (fd), list);
 
                                operations = get_operations_for_jobs (list);
index 69ade32e593ef5fc5db50665d5924f1069595dcb..59095d9122c21a9c21f93cdf888af001f499f012 100644 (file)
@@ -1401,9 +1401,9 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono
                        MONO_OBJECT_SETREF (ares, handle, (MonoObject*) wait_handle);
                }
                mono_monitor_exit ((MonoObject*) ares);
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
                WaitForSingleObjectEx (wait_event, INFINITE, TRUE);
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
        }
 
        ac = (MonoAsyncCall*) ares->object_data;
@@ -1461,9 +1461,9 @@ mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout)
                        }
                }
 
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
                WaitForSingleObject (sem, timeout != -1 ? end - now : timeout);
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
        }
 
        domain->cleanup_semaphore = NULL;
index add9a4a3b04aecadf4cbe2f498abb4e5b4ba350f..9cc43855c299a0f3142330d6a7e264a171f84be8 100644 (file)
@@ -216,7 +216,7 @@ gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len
 
 MONO_API MonoException* mono_thread_get_undeniable_exception (void);
 
-void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed, MonoError *error);
+void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean permanent, MonoError *error);
 
 void mono_runtime_set_has_tls_get (gboolean val);
 gboolean mono_runtime_has_tls_get (void);
index 3eff0768001f44bf538e13c1be48e3ed617c628a..253e9c32c3f4938dc73ab6b1caf66fca406b2d53 100644 (file)
@@ -458,6 +458,8 @@ static void thread_cleanup (MonoInternalThread *thread)
        if (!mono_thread_info_lookup (MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid))->tools_thread)
                mono_profiler_thread_end (thread->tid);
 
+       mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
+
        if (thread == mono_thread_internal_current ()) {
                /*
                 * This will signal async signal handlers that the thread has exited.
@@ -727,12 +729,13 @@ static guint32 WINAPI start_wrapper_internal(void *data)
        mono_profiler_thread_start (tid);
 
        /* if the name was set before starting, we didn't invoke the profiler callback */
-       if (internal->name && (internal->flags & MONO_THREAD_FLAG_NAME_SET)) {
+       if (internal->name) {
                char *tname = g_utf16_to_utf8 (internal->name, internal->name_len, NULL, NULL, NULL);
                mono_profiler_thread_name (internal->tid, tname);
-               mono_thread_info_set_name (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid), tname);
+               mono_native_thread_set_name (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid), tname);
                g_free (tname);
        }
+
        /* start_func is set only for unmanaged start functions */
        if (start_func) {
                start_func (start_arg);
@@ -879,9 +882,9 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star
                 */
                THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") waiting for thread %p (%"G_GSIZE_FORMAT") to start", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
 
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
                WaitForSingleObjectEx (internal->start_notify, INFINITE, FALSE);
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
 
                CloseHandle (internal->start_notify);
                internal->start_notify = NULL;
@@ -1364,13 +1367,13 @@ ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj
 }
 
 void 
-mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed, MonoError *error)
+mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean permanent, MonoError *error)
 {
        LOCK_THREAD (this_obj);
 
        mono_error_init (error);
 
-       if ((this_obj->flags & MONO_THREAD_FLAG_NAME_SET) && !this_obj->threadpool_thread) {
+       if ((this_obj->flags & MONO_THREAD_FLAG_NAME_SET)) {
                UNLOCK_THREAD (this_obj);
                
                mono_error_set_invalid_operation (error, "Thread.Name can only be set once.");
@@ -1384,19 +1387,20 @@ mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, g
                this_obj->name = g_new (gunichar2, mono_string_length (name));
                memcpy (this_obj->name, mono_string_chars (name), mono_string_length (name) * 2);
                this_obj->name_len = mono_string_length (name);
+
+               if (permanent)
+                       this_obj->flags |= MONO_THREAD_FLAG_NAME_SET;
        }
        else
                this_obj->name = NULL;
 
-       if (managed)
-               this_obj->flags |= MONO_THREAD_FLAG_NAME_SET;
        
        UNLOCK_THREAD (this_obj);
 
        if (this_obj->name && this_obj->tid) {
                char *tname = mono_string_to_utf8 (name);
                mono_profiler_thread_name (this_obj->tid, tname);
-               mono_thread_info_set_name (thread_get_tid (this_obj), tname);
+               mono_native_thread_set_name (thread_get_tid (this_obj), tname);
                mono_free (tname);
        }
 }
@@ -1556,9 +1560,9 @@ ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms)
        
        mono_thread_set_state (cur_thread, ThreadState_WaitSleepJoin);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret=WaitForSingleObjectEx (handle, ms, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        mono_thread_clr_state (cur_thread, ThreadState_WaitSleepJoin);
        
@@ -1584,12 +1588,12 @@ mono_wait_uninterrupted (MonoInternalThread *thread, gboolean multiple, guint32
 
        start = (ms == -1) ? 0 : mono_100ns_ticks ();
        do {
-               MONO_PREPARE_BLOCKING;
+               MONO_ENTER_GC_SAFE;
                        if (multiple)
                        ret = WaitForMultipleObjectsEx (numhandles, handles, waitall, wait, alertable);
                else
                        ret = WaitForSingleObjectEx (handles [0], ms, alertable);
-               MONO_FINISH_BLOCKING;
+               MONO_EXIT_GC_SAFE;
 
                if (ret != WAIT_IO_COMPLETION)
                        break;
@@ -1734,9 +1738,9 @@ ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (HANDLE toSignal, H
 
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
        
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret = SignalObjectAndWait (toSignal, toWait, ms, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
 
@@ -2905,9 +2909,9 @@ static void wait_for_tids (struct wait_data *wait, guint32 timeout)
        
        THREAD_DEBUG (g_message("%s: %d threads to wait for in this batch", __func__, wait->num));
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret=WaitForMultipleObjectsEx(wait->num, wait->handles, TRUE, timeout, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if(ret==WAIT_FAILED) {
                /* See the comment in build_wait_tids() */
@@ -2968,9 +2972,9 @@ static void wait_for_tids_or_state_change (struct wait_data *wait, guint32 timeo
                count++;
        }
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret=WaitForMultipleObjectsEx (count, wait->handles, FALSE, timeout, TRUE);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if(ret==WAIT_FAILED) {
                /* See the comment in build_wait_tids() */
index a8c0946eeed8948f957c193793eaf1185463e70e..17cc1ca5ade4c65fab37963df8e1e2e2cb1b263d 100644 (file)
@@ -8104,12 +8104,6 @@ mono_aot_get_method_name (MonoCompile *cfg)
 gboolean
 mono_aot_is_linkonce_method (MonoMethod *method)
 {
-       // FIXME:
-       // This doesn't work yet, because
-       // it can make us call methods which belong
-       // to aot modules which haven't been loaded yet,
-       // so the init method will read uninitialized got
-       // entries.
        return FALSE;
 #if 0
        WrapperInfo *info;
index ef9a9c035c90e1ce1de80e3e06898e274711d46f..2078e8ef8543dc8da7291bd9306b1f8021552522 100644 (file)
@@ -3822,12 +3822,15 @@ register_jump_target_got_slot (MonoDomain *domain, MonoMethod *method, gpointer
  * METHOD might not be set if the caller only has the image/token info.
  */
 static gpointer
-load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoMethod *method, guint32 token, int method_index)
+load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoMethod *method, guint32 token, int method_index,
+                        MonoError *error)
 {
        MonoJitInfo *jinfo = NULL;
        guint8 *code = NULL, *info;
        gboolean res;
 
+       mono_error_init (error);
+
        init_amodule_got (amodule);
 
        if (mono_profiler_get_events () & MONO_PROFILE_ENTER_LEAVE) {
@@ -3859,9 +3862,9 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                                char *full_name;
 
                                if (!method) {
-                                       MonoError error;
-                                       method = mono_get_method_checked (image, token, NULL, NULL, &error);
-                                       g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+                                       method = mono_get_method_checked (image, token, NULL, NULL, error);
+                                       if (!method)
+                                               return NULL;
                                }
                                full_name = mono_method_full_name (method, TRUE);
                                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT: NOT FOUND: %s.", full_name);
@@ -3894,10 +3897,9 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                                return NULL;
                else if (mono_jit_stats.methods_aot == mono_last_aot_method - 1) {
                        if (!method) {
-                               MonoError error;
-                               method = mono_get_method_checked (image, token, NULL, NULL, &error);
+                               method = mono_get_method_checked (image, token, NULL, NULL, error);
                                if (!method)
-                                       mono_error_cleanup (&error);/* FIXME don't swallow the error */
+                                       return NULL;
                        }
                        if (method) {
                                char *name = mono_method_full_name (method, TRUE);
@@ -3910,11 +3912,7 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
        }
 
        if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY))) {
-               MonoError error;
-
-               res = init_method (amodule, method_index, method, NULL, NULL, &error);
-               if (!mono_error_ok (&error))
-                       mono_error_raise_exception (&error); /* FIXME: Don't raise here */
+               res = init_method (amodule, method_index, method, NULL, NULL, error);
                if (!res)
                        goto cleanup;
        }
@@ -3923,10 +3921,9 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                char *full_name;
 
                if (!method) {
-                       MonoError error;
-                       method = mono_get_method_checked (image, token, NULL, NULL, &error);
+                       method = mono_get_method_checked (image, token, NULL, NULL, error);
                        if (!method)
-                               g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+                               return NULL;
                }
 
                full_name = mono_method_full_name (method, TRUE);
@@ -3955,10 +3952,9 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                MonoJitInfo *jinfo;
 
                if (!method) {
-                       MonoError error;
-                       method = mono_get_method_checked (amodule->assembly->image, token, NULL, NULL, &error);
+                       method = mono_get_method_checked (amodule->assembly->image, token, NULL, NULL, error);
                        if (!method)
-                               g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+                               return NULL;
                }
                mono_profiler_method_jit (method);
                jinfo = mono_jit_info_table_find (domain, (char*)code);
@@ -4294,6 +4290,7 @@ mono_aot_init_gshared_method_this (gpointer aot_module, guint32 method_index, Mo
        g_assert (context);
 
        res = init_method (amodule, method_index, NULL, klass, context, &error);
+       /* Its okay to raise in llvmonly mode */
        mono_error_raise_exception (&error);
 }
 
@@ -4313,6 +4310,7 @@ mono_aot_init_gshared_method_mrgctx (gpointer aot_module, guint32 method_index,
        context.method_inst = rgctx->method_inst;
 
        res = init_method (amodule, method_index, NULL, rgctx->class_vtable->klass, &context, &error);
+       /* Its okay to raise in llvmonly mode */
        mono_error_raise_exception (&error);
 }
 
@@ -4337,18 +4335,19 @@ mono_aot_init_gshared_method_vtable (gpointer aot_module, guint32 method_index,
        g_assert (context);
 
        res = init_method (amodule, method_index, NULL, klass, context, &error);
+       /* Its okay to raise in llvmonly mode */
        mono_error_raise_exception (&error);
 }
 
 /*
- * mono_aot_get_method:
+ * mono_aot_get_method_checked:
  *
  *   Return a pointer to the AOTed native code for METHOD if it can be found,
  * NULL otherwise.
  * On platforms with function pointers, this doesn't return a function pointer.
  */
 gpointer
-mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
+mono_aot_get_method_checked (MonoDomain *domain, MonoMethod *method, MonoError *error)
 {
        MonoClass *klass = method->klass;
        MonoMethod *orig_method = method;
@@ -4357,6 +4356,8 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
        guint8 *code;
        gboolean cache_result = FALSE;
 
+       mono_error_init (error);
+
        if (domain != mono_get_root_domain ())
                /* Non shared AOT code can't be used in other appdomains */
                return NULL;
@@ -4571,7 +4572,9 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
                method_index = mono_metadata_token_index (method->token) - 1;
        }
 
-       code = (guint8 *)load_method (domain, amodule, klass->image, method, method->token, method_index);
+       code = (guint8 *)load_method (domain, amodule, klass->image, method, method->token, method_index, error);
+       if (!is_ok (error))
+               return NULL;
        if (code && cache_result) {
                amodule_lock (amodule);
                g_hash_table_insert (amodule->method_to_code, orig_method, code);
@@ -4580,6 +4583,23 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
        return code;
 }
 
+/*
+ * mono_aot_get_method:
+ *
+ *   Return a pointer to the AOTed native code for METHOD if it can be found,
+ * NULL otherwise.
+ * On platforms with function pointers, this doesn't return a function pointer.
+ */
+gpointer
+mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
+{
+       MonoError error;
+
+       gpointer res = mono_aot_get_method_checked (domain, method, &error);
+       mono_error_raise_exception (&error);
+       return res;
+}
+
 /**
  * Same as mono_aot_get_method, but we try to avoid loading any metadata from the
  * method.
@@ -4589,13 +4609,17 @@ mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 to
 {
        MonoAotModule *aot_module = (MonoAotModule *)image->aot_module;
        int method_index;
+       MonoError error;
+       gpointer res;
 
        if (!aot_module)
                return NULL;
 
        method_index = mono_metadata_token_index (token) - 1;
 
-       return load_method (domain, aot_module, image, NULL, token, method_index);
+       res = load_method (domain, aot_module, image, NULL, token, method_index, &error);
+       mono_error_raise_exception (&error); /* FIXME: Don't raise here */
+       return res;
 }
 
 typedef struct {
index f20488678275766dead56f79d41d81401b5f4400..e5906b18d89aeee6d1819fd5a1693030d00b9ccd 100644 (file)
@@ -1123,7 +1123,7 @@ socket_transport_recv (void *buf, int len)
        static gint64 last_keepalive;
        gint64 msecs;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        do {
        again:
@@ -1149,7 +1149,7 @@ socket_transport_recv (void *buf, int len)
                }
        } while ((res > 0 && total < len) || (res == -1 && get_last_sock_error () == MONO_EINTR));
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return total;
 }
@@ -1173,9 +1173,9 @@ set_keepalive (void)
 static int
 socket_transport_accept (int socket_fd)
 {
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        conn_fd = accept (socket_fd, NULL, NULL);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (conn_fd == -1) {
                fprintf (stderr, "debugger-agent: Unable to listen on %d\n", socket_fd);
@@ -1191,13 +1191,13 @@ socket_transport_send (void *data, int len)
 {
        int res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        do {
                res = send (conn_fd, data, len, 0);
        } while (res == -1 && get_last_sock_error () == MONO_EINTR);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (res != len)
                return FALSE;
@@ -1316,9 +1316,9 @@ socket_transport_connect (const char *address)
                        FD_ZERO (&readfds);
                        FD_SET (sfd, &readfds);
 
-                       MONO_PREPARE_BLOCKING;
+                       MONO_ENTER_GC_SAFE;
                        res = select (sfd + 1, &readfds, NULL, NULL, &tv);
-                       MONO_FINISH_BLOCKING;
+                       MONO_EXIT_GC_SAFE;
 
                        if (res == 0) {
                                fprintf (stderr, "debugger-agent: Timed out waiting to connect.\n");
@@ -1345,16 +1345,16 @@ socket_transport_connect (const char *address)
                        if (sfd == -1)
                                continue;
 
-                       MONO_PREPARE_BLOCKING;
+                       MONO_ENTER_GC_SAFE;
                        res = connect (sfd, &sockaddr.addr, sock_len);
-                       MONO_FINISH_BLOCKING;
+                       MONO_EXIT_GC_SAFE;
 
                        if (res != -1)
                                break;       /* Success */
                        
-                       MONO_PREPARE_BLOCKING;
+                       MONO_ENTER_GC_SAFE;
                        close (sfd);
-                       MONO_FINISH_BLOCKING;
+                       MONO_EXIT_GC_SAFE;
                }
 
                if (rp == 0) {
@@ -1385,9 +1385,9 @@ socket_transport_close1 (void)
 #else
        shutdown (conn_fd, SHUT_RD);
        shutdown (listen_fd, SHUT_RDWR);
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        close (listen_fd);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 #endif
 }
 
index 3c1a17befe59f4a3408d59315e951dd0bb9ac500..0409cd7d78d0b20f7c73f59982a985442802ecfa 100644 (file)
@@ -1264,6 +1264,9 @@ mono_decompose_vtype_opts (MonoCompile *cfg)
                                case OP_STOREV_MEMBASE: {
                                        src_var = get_vreg_to_inst (cfg, ins->sreg1);
 
+                                       if (COMPILE_LLVM (cfg) && !mini_is_gsharedvt_klass (ins->klass) && !cfg->gen_write_barriers)
+                                               break;
+
                                        if (!src_var) {
                                                g_assert (ins->klass);
                                                src_var = mono_compile_create_var_for_vreg (cfg, &ins->klass->byval_arg, OP_LOCAL, ins->sreg1);
index 452eaedf706b9d9165f9189fc6d787b54ff5e316..b2ba4d7e7a3b46b4e4c578370912d615327b00e0 100644 (file)
@@ -1167,13 +1167,18 @@ load_agent (MonoDomain *domain, char *desc)
                return 1;
        }
        
-       g_free (agent);
 
        pa [0] = main_args;
        /* Pass NULL as 'exc' so unhandled exceptions abort the runtime */
        mono_runtime_invoke_checked (method, NULL, pa, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       if (!is_ok (&error)) {
+               g_print ("The entry point method of assembly '%s' could not execute due to %s\n", agent, mono_error_get_message (&error));
+               mono_error_cleanup (&error);
+               g_free (agent);
+               return 1;
+       }
 
+       g_free (agent);
        return 0;
 }
 
@@ -1990,7 +1995,7 @@ mono_main (int argc, char* argv[])
         * We only set the native name of the thread since MS.NET leaves the
         * managed thread name for the main thread as null.
         */
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Main");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Main");
 
        if (enable_profile) {
                mono_profiler_load (profile_options);
index 4c2b5ce821db200b5cbb1765ac463eb54cde8463..3afb37380d04824d2eaec787315d48fcfbdfcb15 100644 (file)
@@ -111,6 +111,8 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
        ARM_MOV_REG_REG (code, ARMREG_IP, ARMREG_SP);
        ARM_PUSH (code, MONO_ARM_REGSAVE_MASK);
 
+       ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 8);
+
        /* restore all the regs from ctx (in r0), but not sp, the stack pointer */
        ctx_reg = ARMREG_R0;
        ARM_LDR_IMM (code, ARMREG_IP, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, pc));
@@ -121,6 +123,8 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
        ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
        ARM_MOV_REG_REG (code, ARMREG_PC, ARMREG_R1);
 
+       ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 8);
+
        /* epilog */
        ARM_POP_NWB (code, 0xff0 | ((1 << ARMREG_SP) | (1 << ARMREG_PC)));
 
index d6f560b8553076bf053bbd828ac48aef10b5090d..c90c5de2c596fd0226642c1ec74d683d026e4252 100644 (file)
@@ -189,8 +189,6 @@ ves_icall_runtime_class_init (MonoVTable *vtable);
 void
 mono_generic_class_init (MonoVTable *vtable);
 
-void mono_interruption_checkpoint_from_trampoline (void);
-
 MonoObject*
 mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gboolean deref_arg, gpointer *args);
 
index 18121c85b69607ce34967263a895c31b53ee3cb4..e882bfe5f41a797affcd7e6e57e1a60d8bbea604 100644 (file)
@@ -5343,8 +5343,10 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method)
                                return FALSE;
                        if (!cfg->compile_aot) {
                                MonoError error;
-                               if (!mono_runtime_class_init_full (vtable, &error))
-                                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                               if (!mono_runtime_class_init_full (vtable, &error)) {
+                                       mono_error_cleanup (&error);
+                                       return FALSE;
+                               }
                        }
                } else if (method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) {
                        if (cfg->run_cctors && method->klass->has_cctor) {
@@ -5361,8 +5363,10 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method)
                                if (! vtable->initialized)
                                        return FALSE;
                                MonoError error;
-                               if (!mono_runtime_class_init_full (vtable, &error))
-                                       mono_error_raise_exception (&error); /* FIXME don't raise here */
+                               if (!mono_runtime_class_init_full (vtable, &error)) {
+                                       mono_error_cleanup (&error);
+                                       return FALSE;
+                               }
                        }
                } else if (mono_class_needs_cctor_run (method->klass, NULL)) {
                        if (!method->klass->runtime_info)
@@ -9304,7 +9308,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_CFG_ERROR;
                        }
 
-                       if (cfg->llvm_only && !cfg->method->wrapper_type)
+                       if (cfg->llvm_only && !cfg->method->wrapper_type && (!cmethod || cmethod->is_inflated))
                                cfg->signatures = g_slist_prepend_mempool (cfg->mempool, cfg->signatures, fsig);
 
                        /* See code below */
index af41792adcd4b516150aead64a4989fbebf1b06a..e90855340de9ee46d1081a99bb856540fdc2c534 100644 (file)
@@ -939,6 +939,11 @@ mono_arch_cpu_enumerate_simd_versions (void)
        return 0;
 }
 
+gboolean
+mono_arm_is_hard_float (void)
+{
+       return arm_fpu == MONO_ARM_FPU_VFP_HARD;
+}
 
 #ifndef DISABLE_JIT
 
@@ -967,12 +972,6 @@ mono_arch_is_soft_float (void)
 }
 #endif
 
-gboolean
-mono_arm_is_hard_float (void)
-{
-       return arm_fpu == MONO_ARM_FPU_VFP_HARD;
-}
-
 static gboolean
 is_regsize_var (MonoType *t)
 {
index 16ea7ed29acfe1cda29106d24564eae2d9d92e31..46a12c45677b5339236d4dd1f77893f92cee68fe 100644 (file)
@@ -1332,7 +1332,8 @@ setup_stack_trace (MonoException *mono_ex, GSList *dynamic_methods, MonoArray *i
                                        if (dis_link) {
                                                MonoObject *o = mono_gchandle_get_target (dis_link);
                                                if (o) {
-                                                       list = mono_mlist_prepend (list, o);
+                                                       list = mono_mlist_prepend_checked (list, o, &error);
+                                                       mono_error_assert_ok (&error);
                                                }
                                        }
                                }
@@ -2005,6 +2006,8 @@ mono_debugger_run_finally (MonoContext *start_ctx)
 gboolean
 mono_handle_exception (MonoContext *ctx, MonoObject *obj)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->exceptions_thrown++;
 #endif
@@ -2145,6 +2148,8 @@ restore_stack_protection (void)
 gpointer
 mono_altstack_restore_prot (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        void (*func)(void) = (void (*)(void))tramp_data;
        func ();
        return NULL;
@@ -2546,6 +2551,8 @@ mono_print_thread_dump_from_ctx (MonoContext *ctx)
 void
 mono_resume_unwind (MonoContext *ctx)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
        MonoContext new_ctx;
 
index ec606a934b7955538e0c0576f26c2d1c27333ce6..3b55b58689c3eec7ce46bff99fe168499a063582 100644 (file)
@@ -1359,6 +1359,9 @@ mini_get_gsharedvt_out_sig_wrapper (MonoMethodSignature *sig)
                // FIXME:
                if (stind_op == CEE_STOBJ)
                        mono_mb_emit_op (mb, CEE_STOBJ, mono_class_from_mono_type (sig->ret));
+               else if (stind_op == CEE_STIND_REF)
+                       /* Avoid write barriers, the vret arg points to the stack */
+                       mono_mb_emit_byte (mb, CEE_STIND_I);
                else
                        mono_mb_emit_byte (mb, stind_op);
        }
index 7955a0e2be07ed9347cbd17be4add38c8eb9d57e..3d6c6690c184c7d60eee6ed77034c594deeb032c 100644 (file)
@@ -7085,6 +7085,12 @@ emit_method_inner (EmitContext *ctx)
 
                // FIXME: beforefieldinit
                if (ctx->has_got_access || mono_class_get_cctor (cfg->method->klass)) {
+                       /*
+                        * linkonce methods shouldn't have initialization,
+                        * because they might belong to assemblies which
+                        * haven't been loaded yet.
+                        */
+                       g_assert (!ctx->is_linkonce);
                        emit_init_method (ctx);
                } else {
                        LLVMBuildBr (ctx->builder, ctx->inited_bb);
index 95b45b56afb55485e6fef0845395d5e4638f6177..870a5b584a8ae903d480f13873879097e6751600 100644 (file)
@@ -704,7 +704,7 @@ static mono_native_thread_return_t
 sampling_thread_func (void *data)
 {
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler sampler");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler sampler");
 
        gint64 rate = 1000000000 / mono_profiler_get_sampling_rate ();
 
index 94a4ca0409221b9bf7ce6824e4fc96caa8dd83e0..ac123365f90fd3e8dd1a0c02f624c89502c41e99 100644 (file)
@@ -163,7 +163,8 @@ G_GNUC_UNUSED static char*
 get_method_from_ip (void *ip)
 {
        MonoJitInfo *ji;
-       char *method;
+       MonoMethod *method;
+       char *method_name;
        char *res;
        MonoDomain *domain = mono_domain_get ();
        MonoDebugSourceLocation *location;
@@ -192,14 +193,15 @@ get_method_from_ip (void *ip)
                return res;
        }
 
-       method = mono_method_full_name (jinfo_get_method (ji), TRUE);
+       method = jinfo_get_method (ji);
+       method_name = mono_method_full_name (method, TRUE);
        /* FIXME: unused ? */
-       location = mono_debug_lookup_source_location (jinfo_get_method (ji), (guint32)((guint8*)ip - (guint8*)ji->code_start), domain);
+       location = mono_debug_lookup_source_location (method, (guint32)((guint8*)ip - (guint8*)ji->code_start), domain);
 
-       res = g_strdup_printf (" %s + 0x%x (%p %p) [%p - %s]", method, (int)((char*)ip - (char*)ji->code_start), ji->code_start, (char*)ji->code_start + ji->code_size, domain, domain->friendly_name);
+       res = g_strdup_printf (" %s {%p} + 0x%x (%p %p) [%p - %s]", method_name, method, (int)((char*)ip - (char*)ji->code_start), ji->code_start, (char*)ji->code_start + ji->code_size, domain, domain->friendly_name);
 
        mono_debug_free_source_location (location);
-       g_free (method);
+       g_free (method_name);
 
        return res;
 }
@@ -954,11 +956,11 @@ mono_jit_thread_attach (MonoDomain *domain, gpointer *dummy)
                        *dummy = NULL;
                        /* mono_thread_attach put the thread in RUNNING mode from STARTING, but we need to
                         * return the right cookie. */
-                       return mono_threads_cookie_for_reset_blocking_start (mono_thread_info_current (), 1);
+                       return mono_threads_enter_gc_unsafe_region_cookie (mono_thread_info_current ());
                } else {
                        *dummy = orig;
                        /* thread state (BLOCKING|RUNNING) -> RUNNING */
-                       return mono_threads_reset_blocking_start (dummy);
+                       return mono_threads_enter_gc_unsafe_region (dummy);
                }
        }
 }
@@ -992,7 +994,7 @@ mono_jit_thread_detach (gpointer cookie, gpointer *dummy)
 
                /* it won't do anything if cookie is NULL
                 * thread state RUNNING -> (RUNNING|BLOCKING) */
-               mono_threads_reset_blocking_end (cookie, dummy);
+               mono_threads_exit_gc_unsafe_region (cookie, dummy);
 
                if (orig != domain) {
                        if (!orig)
@@ -2007,7 +2009,7 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *er
 
                mono_class_init (method->klass);
 
-               if ((code = mono_aot_get_method (domain, method))) {
+               if ((code = mono_aot_get_method_checked (domain, method, error))) {
                        MonoVTable *vtable;
 
                        /*
@@ -2022,6 +2024,8 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *er
                                        return NULL;
                        }
                }
+               if (!is_ok (error))
+                       return NULL;
        }
 #endif
 
index c464a0033a77c727829ba44f5e6acea3bba0e84c..9a71893c239fa4137906d382c43df066c9b1ebde 100644 (file)
@@ -502,13 +502,13 @@ mini_add_method_wrappers_llvmonly (MonoMethod *m, gpointer compiled_method, gboo
 }
 
 /**
- * common_call_trampoline_inner:
+ * common_call_trampoline:
  *
  *   The code to handle normal, virtual, and interface method calls and jumps, both
  * from JITted and LLVM compiled code.
  */
 static gpointer
-common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error)
+common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error)
 {
        gpointer addr, compiled_method;
        gboolean generic_shared = FALSE;
@@ -804,16 +804,6 @@ common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVT
        return addr;
 }
 
-static gpointer
-common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error)
-{
-       gpointer res;
-       MONO_PREPARE_RESET_BLOCKING;
-       res = common_call_trampoline_inner (regs, code, m, vt, vtable_slot, error);
-       MONO_FINISH_RESET_BLOCKING;
-       return res;
-}
-
 /**
  * mono_magic_trampoline:
  *
@@ -822,16 +812,21 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
 gpointer
 mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp)
 {
-       MonoError error;
        gpointer res;
 
+       MONO_ENTER_GC_UNSAFE_UNBALANCED;
+
+       MonoError error;
+
        trampoline_calls ++;
 
        res = common_call_trampoline (regs, code, (MonoMethod *)arg, NULL, NULL, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return NULL;
-       }
+       mono_error_set_pending_exception (&error);
+
+       mono_interruption_checkpoint_from_trampoline ();
+
+       MONO_EXIT_GC_UNSAFE_UNBALANCED;
+
        return res;
 }
 
@@ -843,6 +838,8 @@ mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp)
 static gpointer
 mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoObject *this_arg;
        MonoVTable *vt;
        gpointer *vtable_slot;
@@ -914,6 +911,8 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
 gpointer
 mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoError error;
        MonoGenericContext context = { NULL, NULL };
        MonoMethod *imt_method, *declaring;
@@ -962,6 +961,8 @@ gpointer
 mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, 
                                         guint8* tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoImage *image;
        guint32 token;
        MonoMethod *method = NULL;
@@ -1005,6 +1006,8 @@ gpointer
 mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module, 
                                                 guint8* tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        guint32 plt_info_offset = mono_aot_get_plt_info_offset (regs, code);
        gpointer res;
        MonoError error;
@@ -1028,6 +1031,8 @@ mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module,
 static gpointer
 mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, guint8 *tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        static gboolean inited = FALSE;
        static int num_lookups = 0;
        guint32 slot = GPOINTER_TO_UINT (data);
@@ -1067,6 +1072,8 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu
 gpointer
 mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoDomain *domain = mono_domain_get ();
        MonoDelegate *delegate;
        MonoJitInfo *ji;
@@ -1254,6 +1261,8 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
 static gpointer
 mono_handler_block_guard_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_info, guint8* tramp)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        MonoContext ctx;
        MonoException *exc;
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
index 8926d4809842cc6f292702562b409f394420cbbf..76adac07895b888867a6e4dd680952b838894803 100644 (file)
@@ -3044,6 +3044,10 @@ static void
 mono_create_gc_safepoint (MonoCompile *cfg, MonoBasicBlock *bblock)
 {
        MonoInst *poll_addr, *ins;
+
+       if (cfg->disable_gc_safe_points)
+               return;
+
        if (cfg->verbose_level > 1)
                printf ("ADDING SAFE POINT TO BB %d\n", bblock->block_num);
 
@@ -3129,8 +3133,7 @@ mono_insert_safepoints (MonoCompile *cfg)
 
                if (info && info->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER &&
                        (info->d.icall.func == mono_thread_interruption_checkpoint ||
-                       info->d.icall.func == mono_threads_finish_blocking ||
-                       info->d.icall.func == mono_threads_reset_blocking_start)) {
+                       info->d.icall.func == mono_threads_exit_gc_safe_region_unbalanced)) {
                        /* These wrappers are called from the wrapper for the polling function, leading to potential stack overflow */
                        if (cfg->verbose_level > 1)
                                printf ("SKIPPING SAFEPOINTS for wrapper %s\n", cfg->method->name);
@@ -3546,6 +3549,17 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
 
        mini_gc_init_cfg (cfg);
 
+       if (method->wrapper_type == MONO_WRAPPER_UNKNOWN) {
+               WrapperInfo *info = mono_marshal_get_wrapper_info (method);
+
+               /* These wrappers are using linkonce linkage, so they can't access GOT slots */
+               if ((info && (info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG || info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG))) {
+                       cfg->disable_gc_safe_points = TRUE;
+                       /* This is safe, these wrappers only store to the stack */
+                       cfg->gen_write_barriers = FALSE;
+               }
+       }
+
        if (COMPILE_LLVM (cfg)) {
                cfg->opt |= MONO_OPT_ABCREM;
        }
index c4f3fb096f191243432dbf54d162c783181cb7db..ec6bcb6eea13bb278111e814a2eb0b31db65c45f 100644 (file)
@@ -1661,6 +1661,7 @@ typedef struct {
        guint            disable_deadce_vars : 1;
        guint            disable_out_of_line_bblocks : 1;
        guint            disable_direct_icalls : 1;
+       guint            disable_gc_safe_points : 1;
        guint            create_lmf_var : 1;
        /*
         * When this is set, the code to push/pop the LMF from the LMF stack is generated as IR
@@ -2486,6 +2487,8 @@ void      mono_aot_init                     (void);
 void      mono_aot_cleanup                  (void);
 gpointer  mono_aot_get_method               (MonoDomain *domain,
                                                                                         MonoMethod *method);
+gpointer  mono_aot_get_method_checked       (MonoDomain *domain,
+                                                                                        MonoMethod *method, MonoError *error);
 gpointer  mono_aot_get_method_from_token    (MonoDomain *domain, MonoImage *image, guint32 token);
 gboolean  mono_aot_is_got_entry             (guint8 *code, guint8 *addr);
 guint8*   mono_aot_get_plt_entry            (guint8 *code);
@@ -3197,5 +3200,9 @@ gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal);
  */
 void mono_exception_native_unwind (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info);
 
+/*
+ * Coop support for trampolines
+ */
+void mono_interruption_checkpoint_from_trampoline (void);
 
 #endif /* __MONO_MINI_H__ */
index 23605903f4350f01b1a6c982b077a56648aae204..dfd801d8ae18e18159c9c4bc4b648515a3b59bd3 100644 (file)
@@ -4020,7 +4020,7 @@ helper_thread (void* arg)
        MonoThread *thread = NULL;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler helper");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper");
 
        //fprintf (stderr, "Server listening\n");
        command_socket = -1;
@@ -4275,7 +4275,7 @@ writer_thread (void *arg)
        MonoProfiler *prof = (MonoProfiler *)arg;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler writer");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer");
 
        dump_header (prof);
 
@@ -4386,7 +4386,7 @@ dumper_thread (void *arg)
        MonoProfiler *prof = (MonoProfiler *)arg;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler dumper");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper");
 
        while (InterlockedRead (&prof->run_dumper_thread)) {
                mono_os_sem_wait (&prof->dumper_queue_sem, MONO_SEM_FLAGS_NONE);
index 236d39a6b64cd4d7fe0181d312f2c7e638b6d614..ad4c4b0673e7dfc1a7eb91eced406517015f73d5 100644 (file)
@@ -585,6 +585,12 @@ endif
 
 endif
 
+if ENABLE_COOP
+COOP_DISABLED_TESTS= thunks.exe
+else
+COOP_DISABLED_TESTS= 
+endif
+
 # The two finalizer tests only work under sgen
 # gc-altstack.exe fails under boehm because it has no support for altstack
 # bug-459094.exe creates an extremely deep directory tree
@@ -598,7 +604,8 @@ DISABLED_TESTS=                     \
        delegate-invoke.exe \
        bug-Xamarin-5278.exe \
        $(PLATFORM_DISABLED_TESTS) \
-       $(EXTRA_DISABLED_TESTS)
+       $(EXTRA_DISABLED_TESTS) \
+       $(COOP_DISABLED_TESTS)
 
 DISABLED_TESTS_WRENCH= \
        $(DISABLED_TESTS)       \
index 2893874805ce000b7d1f5c88f0eb56032d9e59b0..2704c8662a8d1e2919a99fb3afb91361a551bb1d 100644 (file)
@@ -253,6 +253,8 @@ typedef struct {
 #if defined(HOST_WATCHOS)
 
 #define MONO_CONTEXT_GET_CURRENT(ctx) do { \
+       gpointer _dummy; \
+    ctx.regs [ARMREG_SP] = &_dummy; \
 } while (0);
 
 #else
index 0a812754019e814dd9e7be61fbb78edd66a0a3d6..9e074bbea77041bdf92bb715635083023d4947b5 100644 (file)
@@ -50,11 +50,11 @@ mono_coop_mutex_lock (MonoCoopMutex *mutex)
        if (mono_os_mutex_trylock (&mutex->m) == 0)
                return 0;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        res = mono_os_mutex_lock (&mutex->m);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return res;
 }
@@ -88,11 +88,11 @@ mono_coop_cond_wait (MonoCoopCond *cond, MonoCoopMutex *mutex)
 {
        gint res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        res = mono_os_cond_wait (&cond->c, &mutex->m);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return res;
 }
@@ -102,11 +102,11 @@ mono_coop_cond_timedwait (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 time
 {
        gint res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        res = mono_os_cond_timedwait (&cond->c, &mutex->m, timeout_ms);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return res;
 }
index bcf45a2f294d526dcbea6a3abbcffa48d4fdbb9f..3e8a06e8789e46370e212ff6ae13c0d1e730fd5f 100644 (file)
@@ -35,11 +35,11 @@ mono_coop_sem_wait (MonoCoopSem *sem, MonoSemFlags flags)
 {
        gint res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        res = mono_os_sem_wait (&sem->s, flags);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return res;
 }
@@ -49,11 +49,11 @@ mono_coop_sem_timedwait (MonoCoopSem *sem, guint timeout_ms, MonoSemFlags flags)
 {
        gint res;
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        res = mono_os_sem_timedwait (&sem->s, timeout_ms, flags);
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return res;
 }
index 42e096efee787b951b4a84fe707de0a9e4fef787..edd71d5eebf82dcb494bbae018c845ae6c09266b 100644 (file)
@@ -44,24 +44,23 @@ This will put the current thread in GC Unsafe mode.
 
 For further explanation of what can and can't be done in GC unsafe mode:
 http://www.mono-project.com/docs/advanced/runtime/docs/coop-suspend/#gc-unsafe-mode
-
 */
-#define MONO_BEGIN_GC_UNSAFE   \
+#define MONO_ENTER_GC_UNSAFE   \
        do {    \
-               gpointer __dummy;       \
-               gpointer __gc_unsafe_cookie = mono_threads_enter_gc_unsafe_region (&__dummy)    \
+               gpointer __gc_unsafe_dummy;     \
+               gpointer __gc_unsafe_cookie = mono_threads_enter_gc_unsafe_region (&__gc_unsafe_dummy)  \
 
-#define MONO_END_GC_UNSAFE     \
-               mono_threads_exit_gc_unsafe_region      (__gc_unsafe_cookie, &__dummy); \
+#define MONO_EXIT_GC_UNSAFE    \
+               mono_threads_exit_gc_unsafe_region      (__gc_unsafe_cookie, &__gc_unsafe_dummy);       \
        } while (0)
 
-#define MONO_BEGIN_GC_SAFE     \
+#define MONO_ENTER_GC_SAFE     \
        do {    \
-               gpointer __dummy;       \
-               gpointer __gc_safe_cookie = mono_threads_enter_gc_safe_region (&__dummy)        \
+               gpointer __gc_safe_dummy;       \
+               gpointer __gc_safe_cookie = mono_threads_enter_gc_safe_region (&__gc_safe_dummy)        \
 
-#define MONO_END_GC_SAFE       \
-               mono_threads_exit_gc_safe_region (__gc_safe_cookie, &__dummy);  \
+#define MONO_EXIT_GC_SAFE      \
+               mono_threads_exit_gc_safe_region (__gc_safe_cookie, &__gc_safe_dummy);  \
        } while (0)
 
 MONO_END_DECLS
index 9eb62c0c2812b28673f0a544ea681f57f50cc9cd..a327f581e25457c7b45385a13aae97d14f085669 100644 (file)
@@ -44,30 +44,46 @@ volatile size_t mono_polling_required;
 // FIXME: This would be more efficient if instead of instantiating the stack it just pushed a simple depth counter up and down,
 // perhaps with a per-thread cookie in the high bits.
 #ifdef ENABLE_CHECKED_BUILD_GC
+
 // Maintains a single per-thread stack of ints, used to ensure nesting is not violated
-MonoNativeTlsKey coop_reset_count_stack_key;
-static int coop_tls_push (int v) {
-       GArray *stack = mono_native_tls_get_value (coop_reset_count_stack_key);
+static MonoNativeTlsKey coop_reset_count_stack_key;
+
+static void
+coop_tls_push (gpointer cookie)
+{
+       GArray *stack;
+
+       stack = mono_native_tls_get_value (coop_reset_count_stack_key);
        if (!stack) {
-               stack = g_array_new (FALSE,FALSE,sizeof(int));
+               stack = g_array_new (FALSE, FALSE, sizeof(gpointer));
                mono_native_tls_set_value (coop_reset_count_stack_key, stack);
        }
-       g_array_append_val (stack, v);
-       return stack->len;
+
+       g_array_append_val (stack, cookie);
 }
-static int coop_tls_pop (int *v) {
-       GArray *stack = mono_native_tls_get_value (coop_reset_count_stack_key);
+
+static void
+coop_tls_pop (gpointer received_cookie)
+{
+       GArray *stack;
+       gpointer expected_cookie;
+
+       stack = mono_native_tls_get_value (coop_reset_count_stack_key);
        if (!stack || 0 == stack->len)
-               return -1;
-       stack->len--;
-       *v = g_array_index (stack, int, stack->len);
-       int len = stack->len;
-       if (0 == len) {
+               mono_fatal_with_history ("Received cookie %p but found no stack at all, %x\n", received_cookie);
+
+       expected_cookie = g_array_index (stack, gpointer, stack->len - 1);
+       stack->len --;
+
+       if (0 == stack->len) {
                g_array_free (stack,TRUE);
                mono_native_tls_set_value (coop_reset_count_stack_key, NULL);
        }
-       return len;
+
+       if (expected_cookie != received_cookie)
+               mono_fatal_with_history ("Received cookie %p but expected %p\n", received_cookie, expected_cookie);
 }
+
 #endif
 
 static int coop_reset_blocking_count;
@@ -119,7 +135,7 @@ return_stack_ptr ()
 }
 
 static void
-copy_stack_data (MonoThreadInfo *info, void* stackdata_begin)
+copy_stack_data (MonoThreadInfo *info, gpointer *stackdata_begin)
 {
        MonoThreadUnwindState *state;
        int stackdata_size;
@@ -146,8 +162,26 @@ copy_stack_data (MonoThreadInfo *info, void* stackdata_begin)
        state->gc_stackdata_size = stackdata_size;
 }
 
-void*
-mono_threads_prepare_blocking (void* stackdata)
+gpointer
+mono_threads_enter_gc_safe_region (gpointer *stackdata)
+{
+       gpointer cookie;
+
+       if (!mono_threads_is_coop_enabled ())
+               return NULL;
+
+       cookie = mono_threads_enter_gc_safe_region_unbalanced (stackdata);
+
+#ifdef ENABLE_CHECKED_BUILD_GC
+       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC))
+               coop_tls_push (cookie);
+#endif
+
+       return cookie;
+}
+
+gpointer
+mono_threads_enter_gc_safe_region_unbalanced (gpointer *stackdata)
 {
        MonoThreadInfo *info;
 
@@ -181,7 +215,21 @@ retry:
 }
 
 void
-mono_threads_finish_blocking (void *cookie, void* stackdata)
+mono_threads_exit_gc_safe_region (gpointer cookie, gpointer *stackdata)
+{
+       if (!mono_threads_is_coop_enabled ())
+               return;
+
+#ifdef ENABLE_CHECKED_BUILD_GC
+       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC))
+               coop_tls_pop (cookie);
+#endif
+
+       mono_threads_exit_gc_safe_region_unbalanced (cookie, stackdata);
+}
+
+void
+mono_threads_exit_gc_safe_region_unbalanced (gpointer cookie, gpointer *stackdata)
 {
        static gboolean warned_about_bad_transition;
        MonoThreadInfo *info;
@@ -215,41 +263,41 @@ mono_threads_finish_blocking (void *cookie, void* stackdata)
        }
 }
 
+void
+mono_threads_assert_gc_safe_region (void)
+{
+       MONO_REQ_GC_SAFE_MODE;
+}
 
 gpointer
-mono_threads_cookie_for_reset_blocking_start (MonoThreadInfo *info, int reset_blocking_count)
+mono_threads_enter_gc_unsafe_region (gpointer *stackdata)
 {
+       gpointer cookie;
+
+       if (!mono_threads_is_coop_enabled ())
+               return NULL;
+
+       cookie = mono_threads_enter_gc_unsafe_region_unbalanced (stackdata);
+
 #ifdef ENABLE_CHECKED_BUILD_GC
-       g_assert (reset_blocking_count != 0);
-       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC)) {
-               int level = coop_tls_push (reset_blocking_count);
-               //g_warning("Entering reset nest; level %d; cookie %d\n", level, reset_blocking_count);
-               return (void *)(intptr_t)reset_blocking_count;
-       }
+       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC))
+               coop_tls_push (cookie);
 #endif
 
-       return info;
+       return cookie;
 }
 
-void*
-mono_threads_reset_blocking_start (void* stackdata)
+gpointer
+mono_threads_enter_gc_unsafe_region_unbalanced (gpointer *stackdata)
 {
        MonoThreadInfo *info;
 
        if (!mono_threads_is_coop_enabled ())
                return NULL;
 
-       info = mono_thread_info_current_unchecked ();
+       ++coop_reset_blocking_count;
 
-#ifdef ENABLE_CHECKED_BUILD_GC
-       int reset_blocking_count = InterlockedIncrement (&coop_reset_blocking_count);
-       // In this mode, the blocking count is used as the reset cookie. We would prefer
-       // (but do not require) this to be unique across invocations and threads.
-       if (reset_blocking_count == 0) // We *do* require it be nonzero
-               reset_blocking_count = coop_reset_blocking_count = 1;
-#else
-       int reset_blocking_count = ++coop_reset_blocking_count;
-#endif
+       info = mono_thread_info_current_unchecked ();
 
        /* If the thread is not attached, it doesn't make sense prepare for suspend. */
        if (!info || !mono_thread_info_is_live (info))
@@ -274,11 +322,38 @@ mono_threads_reset_blocking_start (void* stackdata)
                g_error ("Unknown thread state");
        }
 
-       return mono_threads_cookie_for_reset_blocking_start (info, reset_blocking_count);
+       return info;
+}
+
+gpointer
+mono_threads_enter_gc_unsafe_region_cookie (MonoThreadInfo *info)
+{
+       g_assert (mono_threads_is_coop_enabled ());
+
+#ifdef ENABLE_CHECKED_BUILD_GC
+       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC))
+               coop_tls_push (info);
+#endif
+
+       return info;
+}
+
+void
+mono_threads_exit_gc_unsafe_region (gpointer cookie, gpointer *stackdata)
+{
+       if (!mono_threads_is_coop_enabled ())
+               return;
+
+#ifdef ENABLE_CHECKED_BUILD_GC
+       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC))
+               coop_tls_pop (cookie);
+#endif
+
+       mono_threads_exit_gc_unsafe_region_unbalanced (cookie, stackdata);
 }
 
 void
-mono_threads_reset_blocking_end (void *cookie, void* stackdata)
+mono_threads_exit_gc_unsafe_region_unbalanced (gpointer cookie, gpointer *stackdata)
 {
        if (!mono_threads_is_coop_enabled ())
                return;
@@ -287,22 +362,19 @@ mono_threads_reset_blocking_end (void *cookie, void* stackdata)
                return;
 
 #ifdef ENABLE_CHECKED_BUILD_GC
-       if (mono_check_mode_enabled (MONO_CHECK_MODE_GC)) {
-               int received_cookie = (int)(intptr_t)cookie;
-               int desired_cookie;
-               int level = coop_tls_pop (&desired_cookie);
-               //g_warning("Leaving reset nest; back to level %d; desired cookie %d; received cookie %d\n", level, desired_cookie, received_cookie);
-               if (level < 0)
-                       mono_fatal_with_history ("Expected cookie %d but found no stack at all, %x\n", desired_cookie, level);
-               if (desired_cookie != received_cookie)
-                       mono_fatal_with_history ("Expected cookie %d but received %d\n", desired_cookie, received_cookie);
-       } else // Notice this matches the line after the endif
+       if (!mono_check_mode_enabled (MONO_CHECK_MODE_GC))
 #endif
        {
                g_assert (((MonoThreadInfo *)cookie) == mono_thread_info_current_unchecked ());
        }
 
-       mono_threads_prepare_blocking (stackdata);
+       mono_threads_enter_gc_safe_region_unbalanced (stackdata);
+}
+
+void
+mono_threads_assert_gc_unsafe_region (void)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
 }
 
 void
@@ -336,51 +408,3 @@ mono_threads_coop_end_global_suspend (void)
        if (mono_threads_is_coop_enabled ())
                mono_polling_required = 0;
 }
-
-gpointer
-mono_threads_enter_gc_unsafe_region (gpointer* stackdata)
-{
-       if (!mono_threads_is_coop_enabled ())
-               return NULL;
-
-       return mono_threads_reset_blocking_start (stackdata);
-}
-
-void
-mono_threads_exit_gc_unsafe_region (gpointer cookie, gpointer* stackdata)
-{
-       if (!mono_threads_is_coop_enabled ())
-               return;
-
-       mono_threads_reset_blocking_end (cookie, stackdata);
-}
-
-void
-mono_threads_assert_gc_unsafe_region (void)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-}
-
-gpointer
-mono_threads_enter_gc_safe_region (gpointer *stackdata)
-{
-       if (!mono_threads_is_coop_enabled ())
-               return NULL;
-
-       return mono_threads_prepare_blocking (stackdata);
-}
-
-void
-mono_threads_exit_gc_safe_region (gpointer cookie, gpointer *stackdata)
-{
-       if (!mono_threads_is_coop_enabled ())
-               return;
-
-       mono_threads_finish_blocking (cookie, stackdata);
-}
-
-void
-mono_threads_assert_gc_safe_region (void)
-{
-       MONO_REQ_GC_SAFE_MODE;
-}
index 52efd8309f3523ea7e5bfa86530ec563ce5e5e43..dae50c19c545fdbedfe86eefef1aaadc48c97b7c 100644 (file)
@@ -14,6 +14,7 @@
 #include <glib.h>
 
 #include "checked-build.h"
+#include "mono-threads-api.h"
 
 G_BEGIN_DECLS
 
@@ -40,18 +41,6 @@ mono_threads_is_coop_enabled (void)
 void
 mono_threads_state_poll (void);
 
-gpointer
-mono_threads_prepare_blocking (gpointer stackdata);
-
-void
-mono_threads_finish_blocking (gpointer cookie, gpointer stackdata);
-
-gpointer
-mono_threads_reset_blocking_start (gpointer stackdata);
-
-void
-mono_threads_reset_blocking_end (gpointer cookie, gpointer stackdata);
-
 static inline void
 mono_threads_safepoint (void)
 {
@@ -59,23 +48,30 @@ mono_threads_safepoint (void)
                mono_threads_state_poll ();
 }
 
-#define MONO_PREPARE_BLOCKING  \
-       MONO_REQ_GC_NOT_CRITICAL;               \
-       do {    \
-               gpointer __dummy;       \
-               gpointer __blocking_cookie = mono_threads_prepare_blocking (&__dummy)
+/*
+ * The following are used for wrappers and trampolines as their
+ * calls might be unbalanced, due to exception unwinding.
+ */
 
-#define MONO_FINISH_BLOCKING \
-               mono_threads_finish_blocking (__blocking_cookie, &__dummy);     \
-       } while (0)
+gpointer
+mono_threads_enter_gc_safe_region_unbalanced (gpointer *stackdata);
+
+void
+mono_threads_exit_gc_safe_region_unbalanced (gpointer cookie, gpointer *stackdata);
+
+gpointer
+mono_threads_enter_gc_unsafe_region_unbalanced (gpointer *stackdata);
+
+void
+mono_threads_exit_gc_unsafe_region_unbalanced (gpointer cookie, gpointer *stackdata);
 
-#define MONO_PREPARE_RESET_BLOCKING    \
+#define MONO_ENTER_GC_UNSAFE_UNBALANCED        \
        do {    \
                gpointer __dummy;       \
-               gpointer __reset_cookie = mono_threads_reset_blocking_start (&__dummy)
+               gpointer __reset_cookie = mono_threads_enter_gc_unsafe_region_unbalanced (&__dummy)
 
-#define MONO_FINISH_RESET_BLOCKING \
-               mono_threads_reset_blocking_end (__reset_cookie, &__dummy);     \
+#define MONO_EXIT_GC_UNSAFE_UNBALANCED \
+               mono_threads_exit_gc_unsafe_region_unbalanced (__reset_cookie, &__dummy);       \
        } while (0)
 
 G_END_DECLS
index 395fdb5bdab19dacdf2de564c7e8fa534cd9b936..0111d5fd9086a939033748796442d08902d2a8d6 100644 (file)
@@ -277,7 +277,7 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
 }
 
 void
-mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 {
 #ifdef __MACH__
        /*
index b5dfb5dc2e3a7d58f3a92248725551b13816a4b7..2ec53e35bc2380a018e381b7c459a5198593285c 100644 (file)
@@ -344,7 +344,7 @@ typedef struct tagTHREADNAME_INFO
 #endif
 
 void
-mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 {
 #if defined(_MSC_VER)
        /* http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx */
index f38a1afdbdd02ce3a3cc1eb479cec79d2b5a4e03..1919a00bc965d421efb0042e02ddfc4bd98ffb40 100644 (file)
@@ -1193,7 +1193,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
        if (alerted)
                return sleep_interruptable (ms, alerted);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
 
        if (ms == INFINITE) {
                do {
@@ -1238,7 +1238,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
 #endif /* __linux__ */
        }
 
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        return 0;
 }
@@ -1246,9 +1246,9 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
 gint
 mono_thread_info_usleep (guint64 us)
 {
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        g_usleep (us);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
        return 0;
 }
 
@@ -1310,12 +1310,6 @@ mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
        return mono_threads_core_open_thread_handle (handle, tid);
 }
 
-void
-mono_thread_info_set_name (MonoNativeThreadId tid, const char *name)
-{
-       mono_threads_core_set_name (tid, name);
-}
-
 #define INTERRUPT_STATE ((MonoThreadInfoInterruptToken*) (size_t) -1)
 
 struct _MonoThreadInfoInterruptToken {
index 0bf4bdfb168e46662784f7e2104b1516f125cebe..5eea9d0b56e15aa73d6686403acf054868e74522 100644 (file)
@@ -358,9 +358,6 @@ mono_thread_info_lookup (MonoNativeThreadId id);
 gboolean
 mono_thread_info_resume (MonoNativeThreadId tid);
 
-MONO_API void
-mono_thread_info_set_name (MonoNativeThreadId tid, const char *name);
-
 void
 mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt_kernel, MonoSuspendThreadCallback callback, gpointer user_data);
 
@@ -519,7 +516,6 @@ void mono_threads_core_exit (int exit_code);
 void mono_threads_core_unregister (THREAD_INFO_TYPE *info);
 HANDLE mono_threads_core_open_handle (void);
 HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
-void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name);
 
 void mono_threads_coop_begin_global_suspend (void);
 void mono_threads_coop_end_global_suspend (void);
@@ -533,6 +529,9 @@ mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2);
 gboolean
 mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg);
 
+MONO_API void
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name);
+
 /*Mach specific internals */
 void mono_threads_init_dead_letter (void);
 void mono_threads_install_dead_letter (void);
@@ -609,7 +608,7 @@ MonoAbortBlockingResult mono_threads_transition_abort_blocking (THREAD_INFO_TYPE
 MonoThreadUnwindState* mono_thread_info_get_suspend_state (THREAD_INFO_TYPE *info);
 
 gpointer
-mono_threads_cookie_for_reset_blocking_start (THREAD_INFO_TYPE *info, int reset_blocking_count);
+mono_threads_enter_gc_unsafe_region_cookie (THREAD_INFO_TYPE *info);
 
 
 void mono_thread_info_wait_for_resume (THREAD_INFO_TYPE *info);
index 6a82e68b5a60add404b2d2c00599862fee10d01a..ede69be85f35d83385d2d8acd2e6f5faf3fd44d2 100644 (file)
@@ -73,9 +73,9 @@ mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInf
 #endif
        sprintf (service_name, "%d", port);
 
-       MONO_PREPARE_BLOCKING;
+       MONO_ENTER_GC_SAFE;
        ret = getaddrinfo (hostname, service_name, &hints, &info);
-       MONO_FINISH_BLOCKING;
+       MONO_EXIT_GC_SAFE;
 
        if (ret)
                return 1; /* FIXME propagate the error */