2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
9 #include "posix_error_mapper.h"
15 GET_REAL_FUNCTION(int*, _errnop
, (void));
16 return sReal__errnop();
23 HIDDEN_FUNCTION(_errnop
);
25 // convert errno to positive error code
26 int* error
= real_errnop();
28 *error
= B_TO_POSITIVE_ERROR(*error
);
34 WRAPPER_FUNCTION(char*, strerror
, (int errorCode
),
35 return sReal_strerror(B_TO_NEGATIVE_ERROR(errorCode
));
39 WRAPPER_FUNCTION(int, strerror_r
,
40 (int errorCode
, char* buffer
, size_t bufferSize
),
41 return sReal_strerror_r(B_TO_NEGATIVE_ERROR(errorCode
), buffer
, bufferSize
);
45 WRAPPER_FUNCTION(void, perror
, (const char* errorPrefix
),
46 // convert errno to negative error code
47 int* error
= real_errnop();
48 int oldError
= *error
;
50 *error
= B_TO_NEGATIVE_ERROR(*error
);
52 // call the real perror()
53 sReal_perror(errorPrefix
);