linux

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: BSD-3-Clause, MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package linux returns information about what features are supported on the running kernel.

Index

Constants

This section is empty.

Variables

View Source
var HasNewMountAPI = gocompat.SyncOnceValue(func() bool {

	fd, err := unix.OpenTree(-int(unix.EBADF), "/", unix.OPEN_TREE_CLOEXEC)
	if err != nil {
		return false
	}
	_ = unix.Close(fd)

	isNotBackport, _ := kernelversion.GreaterEqualThan(kernelversion.KernelVersion{5, 2})
	return isNotBackport
})

HasNewMountAPI returns whether the new fsopen(2) mount API is supported on the running kernel.

View Source
var HasOpenat2 = func() bool {
	if sawOpenat2Error.Load() {
		return false
	}

	fd, err := unix.Openat2(unix.AT_FDCWD, ".", &unix.OpenHow{
		Flags:   unix.O_PATH | unix.O_CLOEXEC,
		Resolve: unix.RESOLVE_NO_SYMLINKS | unix.RESOLVE_IN_ROOT,
	})
	if err != nil {
		sawOpenat2Error.Store(true)
		return false
	}
	_ = unix.Close(fd)
	return true
}

HasOpenat2 returns whether openat2(2) is supported on the running kernel.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL