On Sat, Jun 3, 2023, at 11:01, Zhangjin Wu wrote:
Suggested-by: Arnd Bergmann arnd@arndb.de Link: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4c9c@app... Signed-off-by: Zhangjin Wu falcon@tinylab.org
tools/include/nolibc/sys.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 856249a11890..78c86f124335 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -124,7 +124,7 @@ int sys_chmod(const char *path, mode_t mode) #elif defined(__NR_chmod) return my_syscall2(__NR_chmod, path, mode); #else -#error Neither __NR_fchmodat nor __NR_chmod defined, cannot implement sys_chmod()
- return -ENOSYS;
#endif }
I think the most logical would be to have each syscall (chmod, fchmodat, ...) have its own function that returns -ENOSYS if that is not defined, and have the logic that decides which one to use as a separate function.
This patch is a step in that direction though, so I think that's totally fine.
Arnd