From aa6bf08729aa49589c15007d2afbb04cdeda255d Mon Sep 17 00:00:00 2001 From: Nugraha Date: Thu, 7 Jul 2022 08:25:45 +0700 Subject: [PATCH] setup: fix ring fd not set Signed-off-by: Nugraha --- setup.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.go b/setup.go index ee5b76f..ee43619 100644 --- a/setup.go +++ b/setup.go @@ -5,11 +5,11 @@ import ( "unsafe" ) -func io_uring_queue_init(entries uint32, ring *IoUring, flags uint32) error { - p := new(IoUringParams) - p.Flags = flags - return io_uring_queue_init_params(entries, ring, p) -} +// func io_uring_queue_init(entries uint32, ring *IoUring, flags uint32) error { +// p := new(IoUringParams) +// p.Flags = flags +// return io_uring_queue_init_params(entries, ring, p) +// } func io_uring_queue_init_params(entries uint32, ring *IoUring, p *IoUringParams) error { fd, err := io_uring_setup(entries, p) @@ -46,11 +46,11 @@ func (ring *IoUring) io_uring_queue_exit() { func io_uring_queue_mmap(fd int, p *IoUringParams, ring *IoUring) error { err := io_uring_mmap(fd, p, &ring.Sq, &ring.Cq) if err != nil { - ring.Flags = p.Flags - ring.RingFd = ring.EnterRingFd - ring.IntFlags = 0 return err } + ring.Flags = p.Flags + ring.RingFd, ring.EnterRingFd = int32(fd), int32(fd) + ring.IntFlags = 0 return nil }