]>
Commit | Line | Data |
---|---|---|
ba10cd3c TB |
1 | /* |
2 | * Copyright (C) 2012-2014 Tobias Brunner | |
3 | * Hochschule fuer Technik Rapperswil | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License as published by the | |
7 | * Free Software Foundation; either version 2 of the License, or (at your | |
8 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 | * for more details. | |
14 | */ | |
15 | ||
16 | /** | |
b3811cfd MW |
17 | * @defgroup strerror_i strerror |
18 | * @{ @ingroup utils_i | |
ba10cd3c TB |
19 | */ |
20 | ||
21 | #ifndef STRERROR_H_ | |
22 | #define STRERROR_H_ | |
23 | ||
24 | /** | |
25 | * Thread-safe wrapper around strerror and strerror_r. | |
26 | * | |
27 | * This is required because the first is not thread-safe (on some platforms) | |
28 | * and the second uses two different signatures (POSIX/GNU) and is impractical | |
29 | * to use anyway. | |
30 | * | |
31 | * @param errnum error code (i.e. errno) | |
32 | * @return error message | |
33 | */ | |
34 | const char *strerror_safe(int errnum); | |
35 | ||
eb94f585 MW |
36 | /** |
37 | * Initialize strerror_safe() | |
38 | */ | |
39 | void strerror_init(); | |
40 | ||
41 | /** | |
42 | * Deinitialize strerror_safe() | |
43 | */ | |
44 | void strerror_deinit(); | |
45 | ||
ba10cd3c TB |
46 | /** |
47 | * Replace usages of strerror(3) with thread-safe variant. | |
48 | */ | |
49 | #define strerror(errnum) strerror_safe(errnum) | |
50 | ||
51 | #endif /** STRERROR_H_ @}*/ |