~aleteoryx/muditaos

da4ed4e2da858c75abb7703ba012f00744a75f59 — Wiktor S. Ovalle Correa 5 years ago a493771
[EGD-5378] Add informative message before aborting iosyscalls

This fix gives basic information about missing syscalls
before aborting from libiosyscalls preload.
1 files changed, 6 insertions(+), 2 deletions(-)

M board/linux/libiosyscalls/src/syscalls_real.hpp
M board/linux/libiosyscalls/src/syscalls_real.hpp => board/linux/libiosyscalls/src/syscalls_real.hpp +6 -2
@@ 4,7 4,11 @@
#pragma once

/* Helpers for intercepting library calls */
#define __REAL_DECL(fun)  decltype(::fun) *fun
#define __REAL_DLSYM(fun) real::fun = reinterpret_cast<decltype(real::fun)>(dlsym(RTLD_NEXT, #fun))
#define __REAL_DECL(fun) decltype(::fun) *fun
#define __REAL_DLSYM(fun)                                                                                              \
    do {                                                                                                               \
        real::fun = reinterpret_cast<decltype(real::fun)>(dlsym(RTLD_NEXT, #fun));                                     \
        fprintf(stderr, "Missing libc syscall: %s()\n", #fun);                                                         \
    } while (0);

#include <dlfcn.h> // for dlsym()