[Mono.Posix] Allow building without [Obsolete] Mono.Posix.
authorJonathan Pryor <jonpryor@vt.edu>
Mon, 6 Jul 2015 17:57:26 +0000 (13:57 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Mon, 6 Jul 2015 18:03:32 +0000 (14:03 -0400)
For a future Xamarin.Android release, we'd like to include
Mono.Posix.dll for simple Unix interop support.

That said, since Mono.Posix has never been included with
Xamarin.Andorid before, this makes a perfect opportunity to remove
some [Obsolete] cruft within Mono.Posix.dll, namely the types within
the Mono.Posix namespace.

Unfortunately, simply not compiling the types within the Mono.Posix
directory doesn't result in compilable code, due to references to
types within the Mono.Posix namespace by other types, e.g.
Mono.Unix.PeerCred using Mono.Posix.PeerCredData.

Fix things so that the Mono.Posix sources can be omitted, allowing
compilation of an assembly with fewer [Obsolete] types.

This change shrinks the size of Mono.Posix.dll by ~10.5KB.

mcs/class/Mono.Posix/Mono.Remoting.Channels.Unix/UnixServerTransportSink.cs
mcs/class/Mono.Posix/Mono.Unix/PeerCred.cs

index 5a709ec8645884fccf8bde65d9059eff6f5a81e2..6f91096693ef5520db14bb51be6fbd1149229266 100644 (file)
@@ -34,7 +34,6 @@ using System.Collections;
 using System.Runtime.Remoting.Messaging;
 using System.IO;
 using System.Runtime.Remoting.Channels;
-using Mono.Posix;
 
 namespace Mono.Remoting.Channels.Unix
 {
index d071ec9f280741992e01dd23cf27ba7ef6a45023..aa7bf80a469d5a04cfaecc52feeb646a9d5384bc 100644 (file)
@@ -33,6 +33,12 @@ using System.Net.Sockets;
 
 namespace Mono.Unix
 {
+       internal struct PeerCredData {
+               public int pid;
+               public int uid;
+               public int gid;
+       }
+
        public class PeerCred
        {
                /* Make sure this doesn't clash with anything in
@@ -40,14 +46,14 @@ namespace Mono.Unix
                 * runtime
                 */
                private const int so_peercred=10001;
-               private Mono.Posix.PeerCredData data;
+               private PeerCredData data;
                
                public PeerCred (Socket sock) {
                        if (sock.AddressFamily != AddressFamily.Unix) {
                                throw new ArgumentException ("Only Unix sockets are supported", "sock");
                        }
 
-                       data = (Mono.Posix.PeerCredData)
+                       data = (PeerCredData)
                                sock.GetSocketOption (SocketOptionLevel.Socket, (SocketOptionName)so_peercred);
                }