public LibcProtectedMemoryAllocatorTest() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { libc = new LinuxLibcLP64(); libcProtectedMemoryAllocator = new LinuxProtectedMemoryAllocatorLP64(); linuxProtectedMemoryAllocatorMock = new Mock <LinuxProtectedMemoryAllocatorLP64>() { CallBase = true }; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { libc = new MacOSLibcLP64(); libcProtectedMemoryAllocator = new MacOSProtectedMemoryAllocatorLP64(); macOsProtectedMemoryAllocatorMock = new Mock <MacOSProtectedMemoryAllocatorLP64>() { CallBase = true }; } else { libc = null; libcProtectedMemoryAllocator = null; macOsProtectedMemoryAllocatorMock = null; } }
public LibcSecureMemoryAllocatorTest() { Trace.Listeners.Clear(); var consoleListener = new ConsoleTraceListener(); Trace.Listeners.Add(consoleListener); Debug.WriteLine("LibcSecureMemoryAllocatorTest ctor"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { libc = new LinuxLibcLP64(); libcSecureMemoryAllocator = new LinuxSecureMemoryAllocatorLP64((LinuxLibcLP64)libc); linuxSecureMemoryAllocatorMock = new Mock <LinuxSecureMemoryAllocatorLP64>() { CallBase = true }; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { libc = new MacOSLibcLP64(); libcSecureMemoryAllocator = new MacOSSecureMemoryAllocatorLP64((MacOSLibcLP64)libc); macOsSecureMemoryAllocatorMock = new Mock <MacOSSecureMemoryAllocatorLP64>() { CallBase = true }; } else { libc = null; libcSecureMemoryAllocator = null; macOsSecureMemoryAllocatorMock = null; } }
protected LibcProtectedMemoryAllocatorLP64(LibcLP64 libc) { if (libc == null) { throw new ArgumentNullException(nameof(libc)); } this.libc = libc; }
protected LibcProtectedMemoryAllocatorLP64(LibcLP64 libc) { this.libc = libc ?? throw new ArgumentNullException(nameof(libc)); libc.getrlimit(GetMemLockLimit(), out var rlim); if (rlim.rlim_max == rlimit.UNLIMITED) { resourceLimit = 0; } else { resourceLimit = (long)rlim.rlim_max; } }
protected LibcProtectedMemoryAllocatorLP64(LibcLP64 libc) { this.libc = libc ?? throw new ArgumentNullException(nameof(libc)); var rlim = GetMemlockResourceLimit(); if (rlim == rlimit.UNLIMITED || rlim > long.MaxValue) { resourceLimit = long.MaxValue; } else { resourceLimit = (long)rlim; } }
protected LibcProtectedMemoryAllocatorLP64(LibcLP64 libc) : base(libc) { var rlim = GetMemlockResourceLimit(); if (rlim == rlimit.UNLIMITED || rlim > long.MaxValue) { resourceLimit = long.MaxValue; } else { resourceLimit = (long)rlim; } }
protected LibcMemoryAllocatorLP64(LibcLP64 libc) { this.libc = libc ?? throw new ArgumentNullException(nameof(libc)); }
protected LibcProtectedMemoryAllocatorLP64(LibcLP64 libc) { this.libc = libc; }
protected LibcSecureMemoryAllocatorLP64(LibcLP64 libc) : base(libc) { }