github.com/iceber/iouring-go@v0.0.0-20230403020409-002cfd2e2a90/eventfd.go (about) 1 // +build linux 2 3 package iouring 4 5 import ( 6 "os" 7 "unsafe" 8 9 "golang.org/x/sys/unix" 10 11 iouring_syscall "github.com/iceber/iouring-go/syscall" 12 ) 13 14 func (iour *IOURing) registerEventfd() error { 15 eventfd, err := unix.Eventfd(0, unix.EFD_NONBLOCK|unix.EFD_CLOEXEC) 16 if err != nil { 17 return os.NewSyscallError("eventfd", err) 18 } 19 iour.eventfd = eventfd 20 21 return iouring_syscall.IOURingRegister( 22 iour.fd, 23 iouring_syscall.IORING_REGISTER_EVENTFD, 24 unsafe.Pointer(&iour.eventfd), 1, 25 ) 26 }