• Willy Tarreau's avatar
    selftests/nolibc: support glibc as well · 1da02f51
    Willy Tarreau authored
    Adding support for glibc can be useful to distinguish between bugs in
    nolibc and bugs in the kernel when a syscall reports an unusual value.
    
    It's not that much work and should not affect the long term
    maintainability of the tests. The necessary changes can essentially be
    summed up like this:
      - set _GNU_SOURCE a the top to access some definitions
      - many includes added when we know we don't come from nolibc (missing
        the stdio include guard)
      - disable gettid() which is not exposed by glibc
      - disable gettimeofday's support of bad pointers since these  crash
        in glibc
      - add a simple itoa() for errorname(); strerror() is too verbose (no
        way to get short messages). strerrorname_np() was added in modern
        glibc (2.32) to do exactly this but that 's too recent to be usable
        as the default fallback.
      - use the standard ioperm() definition. May be we need to implement
        ioperm() in nolibc if that's useful.
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    1da02f51
nolibc-test.c 22.6 KB