HaikuDepot: notify work status from main window
[haiku.git] / src / libs / posix_error_mapper / posix_error_mapper.h
blobc7bf6e024cd9d6cf868e956f48c36e12e43e80ba
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef POSIX_ERROR_MAPPER_H
6 #define POSIX_ERROR_MAPPER_H
8 #include <dlfcn.h>
9 #include <errno.h>
11 #include <Errors.h>
14 #define GET_REAL_FUNCTION(returnValue, function, parameters) \
15 static returnValue (*sReal_##function)parameters \
16 = (returnValue (*)parameters)dlsym(RTLD_DEFAULT, #function)
18 #define HIDDEN_FUNCTION(function) asm volatile(".hidden " #function)
20 #define WRAPPER_FUNCTION(returnValue, function, parameters, body) \
21 returnValue function parameters \
22 { \
23 HIDDEN_FUNCTION(function); \
24 GET_REAL_FUNCTION(returnValue, function, parameters); \
25 body \
28 #endif // POSIX_ERROR_MAPPER_H