Go io uring syscall implementation without CGO, rewrite on branch v0.4
Find a file
Nugraha 734c7883b8
doc: add example on readme
Signed-off-by: Nugraha <richiisei@gmail.com>
2022-07-07 08:27:55 +07:00
go.mod all: initial files 2022-07-05 04:52:54 +07:00
go.sum all: initial files 2022-07-05 04:52:54 +07:00
hdr.go all: fix IoUringCqe layout 2022-07-07 08:22:19 +07:00
hdr_int_flags.go all: initial files 2022-07-05 04:52:54 +07:00
hdr_struct.go all: initial files 2022-07-05 04:52:54 +07:00
prep.go prep: add write, read prepare function 2022-07-07 08:23:21 +07:00
queue.go queue: impl wait cqe, and tests 2022-07-07 08:24:46 +07:00
queue_test.go queue: impl wait cqe, and tests 2022-07-07 08:24:46 +07:00
README.md doc: add example on readme 2022-07-07 08:27:55 +07:00
register.go all: initial files 2022-07-05 04:52:54 +07:00
setup.go setup: fix ring fd not set 2022-07-07 08:25:45 +07:00
sigset.go all: initial files 2022-07-05 04:52:54 +07:00
syscall.go all: initial files 2022-07-05 04:52:54 +07:00
uring.go api: impl get sqe, wait cqe, and test 2022-07-07 08:26:44 +07:00
uring_test.go api: impl get sqe, wait cqe, and test 2022-07-07 08:26:44 +07:00
util_ptr_arith.go all: initial files 2022-07-05 04:52:54 +07:00
util_union.go all: initial files 2022-07-05 04:52:54 +07:00

gouring

License: MIT Go Reference

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

placeholder

Reference

https://github.com/axboe/liburing