summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-21 08:28:37 +0300
committerPaul Buetow <paul@buetow.org>2026-05-21 08:28:37 +0300
commita0d6f222864301c11afd9c1d3306e6bfe8446d5d (patch)
tree5c8c206146f5f41d930971284082cdc30e6b6a04 /cmd
parentbe8735fe701f7398c19c17c394f4827614eab875 (diff)
f7 wire eventfd kind for fd-from-air IPC syscalls
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ioworkload/scenario_ipc.go33
-rw-r--r--cmd/ioworkload/scenarios.go1
2 files changed, 34 insertions, 0 deletions
diff --git a/cmd/ioworkload/scenario_ipc.go b/cmd/ioworkload/scenario_ipc.go
index 221c3c9..af22505 100644
--- a/cmd/ioworkload/scenario_ipc.go
+++ b/cmd/ioworkload/scenario_ipc.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"syscall"
+ "unsafe"
"golang.org/x/sys/unix"
)
@@ -54,3 +55,35 @@ func createEventfd(number uintptr, initval, flags uintptr) (int, error) {
}
return int(fd), nil
}
+
+func fdFromAirEventfdUsers() error {
+ memfdName, err := syscall.BytePtrFromString("ior-memfd")
+ if err != nil {
+ return fmt.Errorf("memfd name: %w", err)
+ }
+ fd, _, _ := syscall.RawSyscall(unix.SYS_MEMFD_CREATE, uintptr(unsafe.Pointer(memfdName)), uintptr(unix.MFD_CLOEXEC), 0)
+ closeIfValid(int(fd))
+
+ fd, _, _ = syscall.RawSyscall(unix.SYS_MEMFD_SECRET, 0, 0, 0)
+ closeIfValid(int(fd))
+
+ fd, _, _ = syscall.RawSyscall(unix.SYS_USERFAULTFD, uintptr(unix.O_CLOEXEC), 0, 0)
+ closeIfValid(int(fd))
+
+ var mask unix.Sigset_t
+ fd, _, _ = syscall.RawSyscall(unix.SYS_SIGNALFD, ^uintptr(0), uintptr(unsafe.Pointer(&mask)), uintptr(unsafe.Sizeof(mask)))
+ closeIfValid(int(fd))
+
+ fd, _, _ = syscall.RawSyscall(unix.SYS_SIGNALFD4, ^uintptr(0), uintptr(unsafe.Pointer(&mask)), uintptr(unsafe.Sizeof(mask)))
+ closeIfValid(int(fd))
+
+ fd, _, _ = syscall.RawSyscall(unix.SYS_TIMERFD_CREATE, uintptr(unix.CLOCK_MONOTONIC), uintptr(unix.TFD_CLOEXEC), 0)
+ closeIfValid(int(fd))
+ return nil
+}
+
+func closeIfValid(fd int) {
+ if fd >= 0 {
+ _ = syscall.Close(fd)
+ }
+}
diff --git a/cmd/ioworkload/scenarios.go b/cmd/ioworkload/scenarios.go
index 1ec8e6d..ba444ef 100644
--- a/cmd/ioworkload/scenarios.go
+++ b/cmd/ioworkload/scenarios.go
@@ -34,6 +34,7 @@ var scenarios = map[string]func() error{
"pipe2-basic": pipe2Basic,
"eventfd-basic": eventfdBasic,
"eventfd2-basic": eventfd2Basic,
+ "fd-from-air-eventfd-users": fdFromAirEventfdUsers,
"mq-posix-basic": mqPosixBasic,
"mountfs-management": mountfsManagement,
"polling-epoll": pollingEpoll,