[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b3e791c9c2cd564e1b9b94d61104aa7d69b603c1.1685856497.git.falcon@tinylab.org>
Date: Sun, 4 Jun 2023 13:36:20 +0800
From: Zhangjin Wu <falcon@...ylab.org>
To: w@....eu
Cc: falcon@...ylab.org, arnd@...db.de, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-riscv@...ts.infradead.org,
thomas@...ch.de
Subject: [PATCH 2/4] tools/nolibc: unistd.h: apply __syscall_ret() helper
get the return type automatically and use __syscall_ret() to shrink 4
code lines.
Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
---
tools/include/nolibc/unistd.h | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h
index 6773e83c16a0..e4e2b4c09771 100644
--- a/tools/include/nolibc/unistd.h
+++ b/tools/include/nolibc/unistd.h
@@ -56,14 +56,10 @@ int tcsetpgrp(int fd, pid_t pid)
return ioctl(fd, TIOCSPGRP, &pid);
}
-#define _syscall(N, ...) \
-({ \
- int _ret = my_syscall##N(__VA_ARGS__); \
- if (_ret < 0) { \
- SET_ERRNO(-_ret); \
- _ret = -1; \
- } \
- _ret; \
+#define _syscall(N, ...) \
+({ \
+ typeof(my_syscall##N(__VA_ARGS__)) _ret = my_syscall##N(__VA_ARGS__); \
+ __syscall_ret(_ret); \
})
#define _sycall_narg(...) __syscall_narg(__VA_ARGS__, 6, 5, 4, 3, 2, 1, 0)
--
2.25.1
Powered by blists - more mailing lists