Exemplo n.º 1
0
        protected override bool ReleaseHandle()
        {
            FailCode = Pal.rvn_mmap_dispose_handle(handle, out ErrorNo);

            handle = IntPtr.Zero;
            return(FailCode == PalFlags.FailCodes.Success);
        }
Exemplo n.º 2
0
        public static unsafe string GetNativeErrorString(int lastError, string msg, out PalFlags.ErrnoSpecialCodes errnoSpecialCodes)
        {
            const int maxNativeErrorStr = 256;
            var       buf = stackalloc byte[maxNativeErrorStr];

            var size      = Pal.rvn_get_error_string(lastError, buf, maxNativeErrorStr, out var specialErrnoCodes);
            var nativeMsg = size >= 0 ? Encoding.UTF8.GetString(buf, size) : lastError.ToString();

            errnoSpecialCodes = (PalFlags.ErrnoSpecialCodes)specialErrnoCodes;
            return($"Errno: {lastError}='{nativeMsg}' (rc={specialErrnoCodes}) - '{msg}'");
        }