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;}
}
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 ();
}
public static int CreateSession ()
{
- return Native.Syscall.setsid ();
+ int s = Native.Syscall.setsid ();
+ UnixMarshal.ThrowExceptionForLastErrorIf (s);
+ return s;
}
public static void SetProcessGroup ()
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];