Files
tailscale/net/uring/capability_linux.go
kadmin 07374071d0 net/uring: add probing capability
Adds the ability to probe for various capabilities. It will not call into C unless
necessary. It also allocates one probe per call to new capability, which may be expensive, so in
theory they could be reused instead.

Signed-off-by: kadmin <julianknodt@gmail.com>
2021-07-13 15:15:16 -07:00

21 lines
435 B
Go

package uring
// #cgo CFLAGS: -I${SRCDIR}/liburing/src/include
// #cgo LDFLAGS: -L${SRCDIR}/liburing/src/ -luring
// #include "io_uring.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
}