mirror of
https://github.com/ii64/gouring.git
synced 2025-04-26 21:46:28 +02:00
Go io uring syscall implementation without CGO, rewrite on branch v0.4
There's other adjustment/addition: * Function name CQE/SQE renamed to Cqe/Sqe. * SQ entry union sets value withput util to reduce function complexity, so leaving function budget for another stuff. * UserData has its own type, implement for uint64, uintptr, and unsafe. * TODO: decide what to use `Syscall` or `RawSyscall`. * Exposed `SeenCqe`. * Ignore *.test file extension. * Inline cost tool. Signed-off-by: Nugraha <richiisei@gmail.com> |
||
---|---|---|
assets | ||
bench/perf | ||
.gitignore | ||
go.mod | ||
go.sum | ||
hdr.go | ||
hdr_int_flags.go | ||
hdr_struct.go | ||
inline_cost.py | ||
Makefile | ||
prep.go | ||
queue.go | ||
queue_test.go | ||
README.md | ||
register.go | ||
setup.go | ||
sigset.go | ||
syscall.go | ||
syscall_nr_amd64.go | ||
uring.go | ||
uring_bench_test.go | ||
uring_test.go | ||
util_ptr_arith.go | ||
util_ptr_arith_test.go | ||
util_union.go |
gouring
go get github.com/ii64/gouring
Example
// setup
h, err := gouring.New(256, 0)
if err != nil { /*...*/ }
defer h.Close()
sqe := h.GetSQE()
b := []byte("io_uring!\n")
PrepWrite(sqe, 1, &b[0], len(b), 0)
submitted, err := h.SubmitAndWait(1)
if err != nil { /*...*/ }
println(submitted) // 1
var cqe *gouring.IoUringCqe
err = h.WaitCqe(&cqe)
if err != nil { /*...*/ } // check also EINTR
_ = cqe.UserData
_ = cqe.Res
_ = cqe.Flags
Graph
SQPOLL | non-SQPOLL |
---|---|