blob: e839206421681e32e76e1fa9c8271232c6b60eec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package uring
// #cgo CFLAGS: -I${SRCDIR}/liburing/src/include
// #cgo LDFLAGS: -L${SRCDIR}/liburing/src/ -luring
// #include "io_uring_linux.c"
import "C"
import (
"syscall"
"unsafe"
)
// hasUring reports whether it is possible to use io_uring syscalls on the system.
func uringSupported() bool {
probe, err := C.io_uring_get_probe()
if err == nil && probe != nil {
C.free(unsafe.Pointer(probe))
}
return err != syscall.ENOSYS
}
// If/when we want to probe for specific io_uring capabilities,
// rather than just the presence of the syscalls,
// this code by Julian Knodt might be handy:
// https://gist.github.com/JulianKnodt/e7030739d163f5251eb47f8ac1d67b62
// (See discussion in https://github.com/tailscale/tailscale/pull/2371.)
|