• Zhangjin Wu's avatar
    tools/nolibc: fix up #error compile failures with -ENOSYS · ca50df30
    Zhangjin Wu authored
    Compiling nolibc for rv32 got such errors:
    
        In file included from nolibc/sysroot/riscv/include/nolibc.h:99,
                         from nolibc/sysroot/riscv/include/errno.h:26,
                         from nolibc/sysroot/riscv/include/stdio.h:14,
                         from tools/testing/selftests/nolibc/nolibc-test.c:12:
        nolibc/sysroot/riscv/include/sys.h:946:2: error: #error Neither __NR_ppoll nor __NR_poll defined, cannot implement sys_poll()
          946 | #error Neither __NR_ppoll nor __NR_poll defined, cannot implement sys_poll()
              |  ^~~~~
        nolibc/sysroot/riscv/include/sys.h:1062:2: error: #error None of __NR_select, __NR_pselect6, nor __NR__newselect defined, cannot implement sys_select()
         1062 | #error None of __NR_select, __NR_pselect6, nor __NR__newselect defined, cannot implement sys_select()
    
    If a syscall is not supported by a target platform, 'return -ENOSYS' is
    better than '#error', which lets the other syscalls work as-is and
    allows developers to fix up the test failures reported by nolibc-test
    one by one later.
    
    This converts all of the '#error' to 'return -ENOSYS', so, all of the
    '#error' failures are fixed.
    Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4c9c@app.fastmail.com/Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarZhangjin Wu <falcon@tinylab.org>
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    ca50df30
sys.h 25.5 KB