summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmmar Faizi <ammar.faizi@students.amikom.ac.id>2021-10-04 08:35:10 +0700
committerJens Axboe <axboe@kernel.dk>2021-10-03 19:37:01 -0600
commit601648ff09b138cadc312b02d497c204eba7fe48 (patch)
treee623c564faa126b8426b39db3f776216ab14e0e4
parentcccf0fa1762aac3f14323fbfc5cef2c99a03efe4 (diff)
downloadliburing-601648ff09b138cadc312b02d497c204eba7fe48.tar.gz
liburing-601648ff09b138cadc312b02d497c204eba7fe48.tar.bz2
src/syscall: Add `close` syscall wrapper
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@students.amikom.ac.id> Link: https://lore.kernel.org/r/20211004013510.428077-1-ammar.faizi@students.amikom.ac.id Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/setup.c4
-rw-r--r--src/syscall.h8
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