Background and motivation
Sometimes, I need to know whether I'm on a Linux kernel with at least a specified version to know whether a certain syscall is available and I can do the PInvoke.
API Proposal
namespace System;
public sealed partial class OperatingSystem
{
public static bool IsLinuxKernelVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0);
// Or alternatively, since Linux is a kernel, not an OS
public static bool HasLinuxKernelVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0)
}
API Usage
if (OperatingSystem.IsLinuxKernelVersionAtLeast(6, 1)
// use PInvoke introduced only in linux kernel 6.1
Alternative Designs
No response
Risks
No response
Background and motivation
Sometimes, I need to know whether I'm on a Linux kernel with at least a specified version to know whether a certain syscall is available and I can do the PInvoke.
API Proposal
API Usage
Alternative Designs
No response
Risks
No response