* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / UnixEnvironment.cs
index 556761f9811946fe104ee1ab10d186652f52f683..4144c13317fc17f674cb6876df0e763866f75923 100644 (file)
@@ -61,22 +61,11 @@ namespace Mono.Unix {
                                return buf.ToString ();
                        }
                        set {
-                               Native.Syscall.sethostname (value);
+                               int r = Native.Syscall.sethostname (value);
+                               UnixMarshal.ThrowExceptionForLastErrorIf (r);
                        }
                }
 
-               [CLSCompliant (false)]
-               [Obsolete ("Use RealUserId", true)]
-               public static uint User {
-                       get {return UnixUser.GetCurrentUserId ();}
-               }
-
-               [CLSCompliant (false)]
-               [Obsolete ("Use RealUserId", true)]
-               public static uint UserId {
-                       get {return UnixUser.GetCurrentUserId ();}
-               }
-
                public static string UserName {
                        get {return UnixUserInfo.GetRealUser ().UserName;}
                }
@@ -125,45 +114,27 @@ namespace Mono.Unix {
                        get {return UnixUserInfo.GetRealUser ().UserName;}
                }
 
-               [CLSCompliant (false)]
-               [Obsolete ("Use GetConfigurationValue (Mono.Unix.Native.SysconfName)", true)]
-               public static long GetConfigurationValue (SysConf name)
-               {
-                       long r = Syscall.sysconf (name);
-                       if (r == -1 && Syscall.GetLastError() == Error.EINVAL)
-                               UnixMarshal.ThrowExceptionForLastError ();
-                       return r;
-               }
-
                [CLSCompliant (false)]
                public static long GetConfigurationValue (Native.SysconfName name)
                {
                        long r = Native.Syscall.sysconf (name);
-                       if (r == -1 && Native.Stdlib.GetLastError() == Native.Errno.EINVAL)
+                       if (r == -1 && Native.Stdlib.GetLastError() != (Native.Errno) 0)
                                UnixMarshal.ThrowExceptionForLastError ();
                        return r;
                }
 
-               [CLSCompliant (false)]
-               [Obsolete ("Use GetConfigurationString (Mono.Unix.Native.ConfstrName)", true)]
-               public static string GetConfigurationString (ConfStr name)
-               {
-                       ulong len = Syscall.confstr (name, null, 0);
-                       if (len == 0)
-                               return "";
-                       StringBuilder buf = new StringBuilder ((int) len+1);
-                       len = Syscall.confstr (name, buf, len);
-                       return buf.ToString ();
-               }
-
                [CLSCompliant (false)]
                public static string GetConfigurationString (Native.ConfstrName name)
                {
                        ulong len = Native.Syscall.confstr (name, null, 0);
+                       if (len == unchecked ((ulong) (-1)))
+                               UnixMarshal.ThrowExceptionForLastError ();
                        if (len == 0)
                                return "";
                        StringBuilder buf = new StringBuilder ((int) len+1);
                        len = Native.Syscall.confstr (name, buf, len);
+                       if (len == unchecked ((ulong) (-1)))
+                               UnixMarshal.ThrowExceptionForLastError ();
                        return buf.ToString ();
                }
 
@@ -175,7 +146,9 @@ namespace Mono.Unix {
 
                public static int CreateSession ()
                {
-                       return Native.Syscall.setsid ();
+                       int s = Native.Syscall.setsid ();
+                       UnixMarshal.ThrowExceptionForLastErrorIf (s);
+                       return s;
                }
 
                public static void SetProcessGroup ()
@@ -228,21 +201,6 @@ namespace Mono.Unix {
                        return groups;
                }
 
-               [CLSCompliant (false)]
-               [Obsolete ("Use SetSupplementaryGroupIds(long[])", true)]
-               public static void SetSupplementaryGroups (uint[] list)
-               {
-                       SetSupplementaryGroupIds (list);
-               }
-
-               [CLSCompliant (false)]
-               [Obsolete ("Use SetSupplementaryGroupIds(long[])", true)]
-               public static void SetSupplementaryGroupIds (uint[] list)
-               {
-                       int r = Syscall.setgroups (list);
-                       UnixMarshal.ThrowExceptionForLastErrorIf (r);
-               }
-
                public static void SetSupplementaryGroupIds (long[] list)
                {
                        uint[] _list = new uint [list.Length];