private static string GetErrorText(int errno) { // strerror() is not threadsafe, and strerror_r() is not portable, so use strerror() plus a lock to help with the threadsafety issue. UnixException.Lock(); try { return(Marshal.PtrToStringAnsi(UnixException.StrError(errno))); } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { } finally { UnixException.Unlock(); } return($"[errno {errno}]"); }
/// <summary>Initializes a new instance of the <see cref="UnixException"/> class, for the specified error code.</summary> public UnixException(int errno) : base(UnixException.GetErrorText(errno), errno) { }