github.com/iceber/iouring-go@v0.0.0-20230403020409-002cfd2e2a90/syscall/io_uring_enter.go (about) 1 // +build linux 2 3 package iouring_syscall 4 5 import ( 6 "os" 7 "syscall" 8 "unsafe" 9 10 "golang.org/x/sys/unix" 11 ) 12 13 // IOUringEnter flags 14 const ( 15 IORING_ENTER_FLAGS_GETEVENTS uint32 = 1 << iota 16 IORING_ENTER_FLAGS_SQ_WAKEUP 17 IORING_ENTER_FLAGS_SQ_WAIT 18 ) 19 20 func IOURingEnter(fd int, toSubmit uint32, minComplete uint32, flags uint32, sigset *unix.Sigset_t) (int, error) { 21 res, _, errno := syscall.Syscall6( 22 SYS_IO_URING_ENTER, 23 uintptr(fd), 24 uintptr(toSubmit), 25 uintptr(minComplete), 26 uintptr(flags), 27 uintptr(unsafe.Pointer(sigset)), 28 0, 29 ) 30 if errno != 0 { 31 return 0, os.NewSyscallError("iouring_enter", errno) 32 } 33 if res < 0 { 34 return 0, os.NewSyscallError("iouring_enter", syscall.Errno(-res)) 35 } 36 37 return int(res), nil 38 }