In commit 0c210dbae26a80ee82dbc7430828ab6fd7012548 ("Wrap all syscalls in a kernel style return value"), we forgot to add a syscall wrapper for `close()`. Add it. Fixes: cccf0fa1762aac3f14323fbfc5cef2c99a03efe4 ("Wrap all syscalls in a kernel style return value") Signed-off-by: Ammar Faizi <ammar.faizi@xxxxxxxxxxxxxxxxxxxxx> --- src/setup.c | 4 ++-- src/syscall.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/setup.c b/src/setup.c index bdbf97c..4f006de 100644 --- a/src/setup.c +++ b/src/setup.c @@ -145,7 +145,7 @@ int io_uring_queue_init_params(unsigned entries, struct io_uring *ring, ret = io_uring_queue_mmap(fd, p, ring); if (ret) { - close(fd); + uring_close(fd); return ret; } @@ -174,7 +174,7 @@ void io_uring_queue_exit(struct io_uring *ring) uring_munmap(sq->sqes, *sq->kring_entries * sizeof(struct io_uring_sqe)); io_uring_unmap_rings(sq, cq); - close(ring->ring_fd); + uring_close(ring->ring_fd); } struct io_uring_probe *io_uring_get_probe_ring(struct io_uring *ring) diff --git a/src/syscall.h b/src/syscall.h index a9dd280..9eff968 100644 --- a/src/syscall.h +++ b/src/syscall.h @@ -156,4 +156,12 @@ static inline int uring_setrlimit(int resource, const struct rlimit *rlim) return (ret < 0) ? -errno : ret; } +static inline int uring_close(int fd) +{ + int ret; + + ret = close(fd); + return (ret < 0) ? -errno : ret; +} + #endif -- 2.30.2