Ejemplo n.º 1
0
 static void openEndpoint(string path, ref FileHandle file, ref IntPtr mapped, int size)
 {
     file   = FileHandle.openFile(path, eFileFlags.O_RDWR | eFileFlags.O_SYNC);
     mapped = LibC.mmap(IntPtr.Zero, (UIntPtr)size, eMemoryProtection.ReadWrite, (int)eMapFlags.Shared, file, (IntPtr)0);
     if (mapped == LibC.MAP_FAILED)
     {
         throw LibC.exception($"memory map failed for device \"{ path }\"", -1);
     }
 }
Ejemplo n.º 2
0
        public void finalize()
        {
            if (mappedAddress == default)
            {
                return;
            }
            int returnedValue = LibC.munmap(mappedAddress, (UIntPtr)mappedLength);

            if (0 == returnedValue)
            {
                return;
            }
            var ex = LibC.exception("MappedOutput.finalize", returnedValue);

            Logger.logWarning("{0}", ex.Message);
        }