1 /* Output of mkheader.awk.  DO NOT EDIT.  */
2 
3 /*****
4 *
5 * Copyright (C) 2004-2015 CS-SI. All Rights Reserved.
6 * Author: Yoann Vandoorselaere <yoann.v@prelude-ids.com>
7 *
8 * This file is part of the Prelude library.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; see the file COPYING.  If not, write to
22 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *****/
25 
26 #ifndef _LIBPRELUDE_PRELUDE_ERROR_H
27 #define _LIBPRELUDE_PRELUDE_ERROR_H
28 
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32 
33 #include <stdio.h>
34 #include <unistd.h>
35 #include <stdarg.h>
36 #include <errno.h>
37 
38 #include "prelude-macros.h"
39 #include "prelude-thread.h"
40 #include "prelude-string.h"
41 
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45 
46 /*
47  * This is inspired from the GPG error interface.
48  *
49  * Bit 1 of prelude_error_t remain set (negative value).
50  * Bit 2 to 9 are set to the source of the error.
51  * Bit 10 specify whether there is a verbose error available.
52  * Bit 11 to 15 are unspecified.
53  * Bit 16 to 32 are set to the code of the error.
54  */
55 
56 
57 #define PRELUDE_ERROR_SYSTEM_ERROR    (1 << 15)
58 
59 typedef enum {
60     PRELUDE_ERROR_SOURCE_UNKNOWN = 0,
61     PRELUDE_ERROR_SOURCE_IO = 1,
62     PRELUDE_ERROR_SOURCE_MESSAGE = 2,
63     PRELUDE_ERROR_SOURCE_FAILOVER = 3,
64     PRELUDE_ERROR_SOURCE_CLIENT = 4,
65     PRELUDE_ERROR_SOURCE_CLIENT_PROFILE = 5,
66     PRELUDE_ERROR_SOURCE_EXTRACT = 6,
67     PRELUDE_ERROR_SOURCE_CONNECTION = 7,
68     PRELUDE_ERROR_SOURCE_CONNECTION_POOL = 8,
69     PRELUDE_ERROR_SOURCE_CONFIG_ENGINE = 9,
70     PRELUDE_ERROR_SOURCE_STRING = 10,
71     PRELUDE_ERROR_SOURCE_IDMEF_TREE_WRAP = 11,
72     PRELUDE_ERROR_SOURCE_IDMEF_PATH = 12,
73     PRELUDE_ERROR_SOURCE_IDMEF_TYPE = 13,
74     PRELUDE_ERROR_SOURCE_IDMEF_MESSAGE_READ = 14,
75     PRELUDE_ERROR_SOURCE_IDMEF_CRITERIA = 15,
76     PRELUDE_ERROR_SOURCE_IDMEF_VALUE_TYPE = 16,
77     PRELUDE_ERROR_SOURCE_PRELUDEDB = 255,
78 } prelude_error_source_t;
79 
80 typedef enum {
81     PRELUDE_ERROR_NO_ERROR = 0,
82     PRELUDE_ERROR_GENERIC = 1,
83     PRELUDE_ERROR_TLS = 2,
84     PRELUDE_ERROR_INVAL_LENGTH = 3,
85     PRELUDE_ERROR_INVAL_MESSAGE = 4,
86     PRELUDE_ERROR_PROTOCOL_VERSION = 5,
87     PRELUDE_ERROR_EOF = 6,
88     PRELUDE_ERROR_PROFILE = 8,
89     PRELUDE_ERROR_TLS_AUTH_REJECTED = 16,
90     PRELUDE_ERROR_INVAL_INT8 = 17,
91     PRELUDE_ERROR_INVAL_INT16 = 18,
92     PRELUDE_ERROR_INVAL_INT32 = 19,
93     PRELUDE_ERROR_INVAL_INT64 = 20,
94     PRELUDE_ERROR_INVAL_FLOAT = 21,
95     PRELUDE_ERROR_INVAL_CHAR = 22,
96     PRELUDE_ERROR_INVAL_IDMEF_TIME = 23,
97     PRELUDE_ERROR_CONNECTION_STRING = 24,
98     PRELUDE_ERROR_IDMEF_VALUE_TYPE_UNKNOWN = 25,
99     PRELUDE_ERROR_IDMEF_VALUE_TYPE_COPY_UNAVAILABLE = 26,
100     PRELUDE_ERROR_IDMEF_VALUE_TYPE_CLONE_UNAVAILABLE = 27,
101     PRELUDE_ERROR_IDMEF_VALUE_TYPE_COMPARE_UNAVAILABLE = 28,
102     PRELUDE_ERROR_IDMEF_VALUE_TYPE_READ_UNAVAILABLE = 29,
103     PRELUDE_ERROR_IDMEF_VALUE_TYPE_WRITE_UNAVAILABLE = 30,
104     PRELUDE_ERROR_IDMEF_VALUE_TYPE_COMPARE_MISMATCH = 31,
105     PRELUDE_ERROR_IDMEF_VALUE_TYPE_PARSE = 32,
106     PRELUDE_ERROR_IDMEF_CLASS_UNKNOWN = 33,
107     PRELUDE_ERROR_IDMEF_CLASS_UNKNOWN_CHILD = 34,
108     PRELUDE_ERROR_IDMEF_CLASS_UNKNOWN_NAME = 35,
109     PRELUDE_ERROR_IDMEF_PATH_LENGTH = 36,
110     PRELUDE_ERROR_IDMEF_PATH_DEPTH = 37,
111     PRELUDE_ERROR_IDMEF_PATH_PARENT_ROOT = 38,
112     PRELUDE_ERROR_IDMEF_PATH_NTH = 39,
113     PRELUDE_ERROR_IDMEF_PATH_MISS_INDEX = 40,
114     PRELUDE_ERROR_IDMEF_PATH_INTEGRITY = 41,
115     PRELUDE_ERROR_IDMEF_PATH_INDEX_RESERVED = 42,
116     PRELUDE_ERROR_IDMEF_PATH_INDEX_FORBIDDEN = 43,
117     PRELUDE_ERROR_IDMEF_PATH_INDEX_UNDEFINED = 44,
118     PRELUDE_ERROR_IDMEF_TREE_INDEX_UNDEFINED = 45,
119     PRELUDE_ERROR_IDMEF_UNKNOWN_ENUM_STRING = 46,
120     PRELUDE_ERROR_IDMEF_UNKNOWN_TAG = 47,
121     PRELUDE_ERROR_DAEMONIZE_LOCK_HELD = 48,
122     PRELUDE_ERROR_PLUGIN_LTDL_INIT = 49,
123     PRELUDE_ERROR_STRING_NOT_NULL_TERMINATED = 50,
124     PRELUDE_ERROR_CANT_RESOLVE = 51,
125     PRELUDE_ERROR_UNKNOWN_PERMISSION_TYPE = 52,
126     PRELUDE_ERROR_UNKNOWN_PERMISSION_BIT = 53,
127     PRELUDE_ERROR_IDMEF_CRITERIA_PARSE = 55,
128     PRELUDE_ERROR_IDMEF_CRITERION_UNSUPPORTED_OPERATOR = 56,
129     PRELUDE_ERROR_IDMEF_CRITERION_INVALID_REGEX = 57,
130     PRELUDE_ERROR_TLS_WARNING_ALERT = 58,
131     PRELUDE_ERROR_TLS_FATAL_ALERT = 59,
132     PRELUDE_ERROR_IDMEF_CLASS_CHILD_NOT_CLASS = 60,
133     PRELUDE_ERROR_ASSERTION = 61,
134     PRELUDE_ERROR_IDMEF_VALUE_TYPE_REF_UNAVAILABLE = 62,
135     PRELUDE_ERROR_UNKNOWN_ERRNO = 16382,
136     PRELUDE_ERROR_E2BIG = PRELUDE_ERROR_SYSTEM_ERROR | 0,
137     PRELUDE_ERROR_EACCES = PRELUDE_ERROR_SYSTEM_ERROR | 1,
138     PRELUDE_ERROR_EADDRINUSE = PRELUDE_ERROR_SYSTEM_ERROR | 2,
139     PRELUDE_ERROR_EADDRNOTAVAIL = PRELUDE_ERROR_SYSTEM_ERROR | 3,
140     PRELUDE_ERROR_EADV = PRELUDE_ERROR_SYSTEM_ERROR | 4,
141     PRELUDE_ERROR_EAFNOSUPPORT = PRELUDE_ERROR_SYSTEM_ERROR | 5,
142     PRELUDE_ERROR_EAGAIN = PRELUDE_ERROR_SYSTEM_ERROR | 6,
143     PRELUDE_ERROR_EALREADY = PRELUDE_ERROR_SYSTEM_ERROR | 7,
144     PRELUDE_ERROR_EAUTH = PRELUDE_ERROR_SYSTEM_ERROR | 8,
145     PRELUDE_ERROR_EBACKGROUND = PRELUDE_ERROR_SYSTEM_ERROR | 9,
146     PRELUDE_ERROR_EBADE = PRELUDE_ERROR_SYSTEM_ERROR | 10,
147     PRELUDE_ERROR_EBADF = PRELUDE_ERROR_SYSTEM_ERROR | 11,
148     PRELUDE_ERROR_EBADFD = PRELUDE_ERROR_SYSTEM_ERROR | 12,
149     PRELUDE_ERROR_EBADMSG = PRELUDE_ERROR_SYSTEM_ERROR | 13,
150     PRELUDE_ERROR_EBADR = PRELUDE_ERROR_SYSTEM_ERROR | 14,
151     PRELUDE_ERROR_EBADRPC = PRELUDE_ERROR_SYSTEM_ERROR | 15,
152     PRELUDE_ERROR_EBADRQC = PRELUDE_ERROR_SYSTEM_ERROR | 16,
153     PRELUDE_ERROR_EBADSLT = PRELUDE_ERROR_SYSTEM_ERROR | 17,
154     PRELUDE_ERROR_EBFONT = PRELUDE_ERROR_SYSTEM_ERROR | 18,
155     PRELUDE_ERROR_EBUSY = PRELUDE_ERROR_SYSTEM_ERROR | 19,
156     PRELUDE_ERROR_ECANCELED = PRELUDE_ERROR_SYSTEM_ERROR | 20,
157     PRELUDE_ERROR_ECHILD = PRELUDE_ERROR_SYSTEM_ERROR | 21,
158     PRELUDE_ERROR_ECHRNG = PRELUDE_ERROR_SYSTEM_ERROR | 22,
159     PRELUDE_ERROR_ECOMM = PRELUDE_ERROR_SYSTEM_ERROR | 23,
160     PRELUDE_ERROR_ECONNABORTED = PRELUDE_ERROR_SYSTEM_ERROR | 24,
161     PRELUDE_ERROR_ECONNREFUSED = PRELUDE_ERROR_SYSTEM_ERROR | 25,
162     PRELUDE_ERROR_ECONNRESET = PRELUDE_ERROR_SYSTEM_ERROR | 26,
163     PRELUDE_ERROR_ED = PRELUDE_ERROR_SYSTEM_ERROR | 27,
164     PRELUDE_ERROR_EDEADLK = PRELUDE_ERROR_SYSTEM_ERROR | 28,
165     PRELUDE_ERROR_EDEADLOCK = PRELUDE_ERROR_SYSTEM_ERROR | 29,
166     PRELUDE_ERROR_EDESTADDRREQ = PRELUDE_ERROR_SYSTEM_ERROR | 30,
167     PRELUDE_ERROR_EDIED = PRELUDE_ERROR_SYSTEM_ERROR | 31,
168     PRELUDE_ERROR_EDOM = PRELUDE_ERROR_SYSTEM_ERROR | 32,
169     PRELUDE_ERROR_EDOTDOT = PRELUDE_ERROR_SYSTEM_ERROR | 33,
170     PRELUDE_ERROR_EDQUOT = PRELUDE_ERROR_SYSTEM_ERROR | 34,
171     PRELUDE_ERROR_EEXIST = PRELUDE_ERROR_SYSTEM_ERROR | 35,
172     PRELUDE_ERROR_EFAULT = PRELUDE_ERROR_SYSTEM_ERROR | 36,
173     PRELUDE_ERROR_EFBIG = PRELUDE_ERROR_SYSTEM_ERROR | 37,
174     PRELUDE_ERROR_EFTYPE = PRELUDE_ERROR_SYSTEM_ERROR | 38,
175     PRELUDE_ERROR_EGRATUITOUS = PRELUDE_ERROR_SYSTEM_ERROR | 39,
176     PRELUDE_ERROR_EGREGIOUS = PRELUDE_ERROR_SYSTEM_ERROR | 40,
177     PRELUDE_ERROR_EHOSTDOWN = PRELUDE_ERROR_SYSTEM_ERROR | 41,
178     PRELUDE_ERROR_EHOSTUNREACH = PRELUDE_ERROR_SYSTEM_ERROR | 42,
179     PRELUDE_ERROR_EIDRM = PRELUDE_ERROR_SYSTEM_ERROR | 43,
180     PRELUDE_ERROR_EIEIO = PRELUDE_ERROR_SYSTEM_ERROR | 44,
181     PRELUDE_ERROR_EILSEQ = PRELUDE_ERROR_SYSTEM_ERROR | 45,
182     PRELUDE_ERROR_EINPROGRESS = PRELUDE_ERROR_SYSTEM_ERROR | 46,
183     PRELUDE_ERROR_EINTR = PRELUDE_ERROR_SYSTEM_ERROR | 47,
184     PRELUDE_ERROR_EINVAL = PRELUDE_ERROR_SYSTEM_ERROR | 48,
185     PRELUDE_ERROR_EIO = PRELUDE_ERROR_SYSTEM_ERROR | 49,
186     PRELUDE_ERROR_EISCONN = PRELUDE_ERROR_SYSTEM_ERROR | 50,
187     PRELUDE_ERROR_EISDIR = PRELUDE_ERROR_SYSTEM_ERROR | 51,
188     PRELUDE_ERROR_EISNAM = PRELUDE_ERROR_SYSTEM_ERROR | 52,
189     PRELUDE_ERROR_EL2HLT = PRELUDE_ERROR_SYSTEM_ERROR | 53,
190     PRELUDE_ERROR_EL2NSYNC = PRELUDE_ERROR_SYSTEM_ERROR | 54,
191     PRELUDE_ERROR_EL3HLT = PRELUDE_ERROR_SYSTEM_ERROR | 55,
192     PRELUDE_ERROR_EL3RST = PRELUDE_ERROR_SYSTEM_ERROR | 56,
193     PRELUDE_ERROR_ELIBACC = PRELUDE_ERROR_SYSTEM_ERROR | 57,
194     PRELUDE_ERROR_ELIBBAD = PRELUDE_ERROR_SYSTEM_ERROR | 58,
195     PRELUDE_ERROR_ELIBEXEC = PRELUDE_ERROR_SYSTEM_ERROR | 59,
196     PRELUDE_ERROR_ELIBMAX = PRELUDE_ERROR_SYSTEM_ERROR | 60,
197     PRELUDE_ERROR_ELIBSCN = PRELUDE_ERROR_SYSTEM_ERROR | 61,
198     PRELUDE_ERROR_ELNRNG = PRELUDE_ERROR_SYSTEM_ERROR | 62,
199     PRELUDE_ERROR_ELOOP = PRELUDE_ERROR_SYSTEM_ERROR | 63,
200     PRELUDE_ERROR_EMEDIUMTYPE = PRELUDE_ERROR_SYSTEM_ERROR | 64,
201     PRELUDE_ERROR_EMFILE = PRELUDE_ERROR_SYSTEM_ERROR | 65,
202     PRELUDE_ERROR_EMLINK = PRELUDE_ERROR_SYSTEM_ERROR | 66,
203     PRELUDE_ERROR_EMSGSIZE = PRELUDE_ERROR_SYSTEM_ERROR | 67,
204     PRELUDE_ERROR_EMULTIHOP = PRELUDE_ERROR_SYSTEM_ERROR | 68,
205     PRELUDE_ERROR_ENAMETOOLONG = PRELUDE_ERROR_SYSTEM_ERROR | 69,
206     PRELUDE_ERROR_ENAVAIL = PRELUDE_ERROR_SYSTEM_ERROR | 70,
207     PRELUDE_ERROR_ENEEDAUTH = PRELUDE_ERROR_SYSTEM_ERROR | 71,
208     PRELUDE_ERROR_ENETDOWN = PRELUDE_ERROR_SYSTEM_ERROR | 72,
209     PRELUDE_ERROR_ENETRESET = PRELUDE_ERROR_SYSTEM_ERROR | 73,
210     PRELUDE_ERROR_ENETUNREACH = PRELUDE_ERROR_SYSTEM_ERROR | 74,
211     PRELUDE_ERROR_ENFILE = PRELUDE_ERROR_SYSTEM_ERROR | 75,
212     PRELUDE_ERROR_ENOANO = PRELUDE_ERROR_SYSTEM_ERROR | 76,
213     PRELUDE_ERROR_ENOBUFS = PRELUDE_ERROR_SYSTEM_ERROR | 77,
214     PRELUDE_ERROR_ENOCSI = PRELUDE_ERROR_SYSTEM_ERROR | 78,
215     PRELUDE_ERROR_ENODATA = PRELUDE_ERROR_SYSTEM_ERROR | 79,
216     PRELUDE_ERROR_ENODEV = PRELUDE_ERROR_SYSTEM_ERROR | 80,
217     PRELUDE_ERROR_ENOENT = PRELUDE_ERROR_SYSTEM_ERROR | 81,
218     PRELUDE_ERROR_ENOEXEC = PRELUDE_ERROR_SYSTEM_ERROR | 82,
219     PRELUDE_ERROR_ENOLCK = PRELUDE_ERROR_SYSTEM_ERROR | 83,
220     PRELUDE_ERROR_ENOLINK = PRELUDE_ERROR_SYSTEM_ERROR | 84,
221     PRELUDE_ERROR_ENOMEDIUM = PRELUDE_ERROR_SYSTEM_ERROR | 85,
222     PRELUDE_ERROR_ENOMEM = PRELUDE_ERROR_SYSTEM_ERROR | 86,
223     PRELUDE_ERROR_ENOMSG = PRELUDE_ERROR_SYSTEM_ERROR | 87,
224     PRELUDE_ERROR_ENONET = PRELUDE_ERROR_SYSTEM_ERROR | 88,
225     PRELUDE_ERROR_ENOPKG = PRELUDE_ERROR_SYSTEM_ERROR | 89,
226     PRELUDE_ERROR_ENOPROTOOPT = PRELUDE_ERROR_SYSTEM_ERROR | 90,
227     PRELUDE_ERROR_ENOSPC = PRELUDE_ERROR_SYSTEM_ERROR | 91,
228     PRELUDE_ERROR_ENOSR = PRELUDE_ERROR_SYSTEM_ERROR | 92,
229     PRELUDE_ERROR_ENOSTR = PRELUDE_ERROR_SYSTEM_ERROR | 93,
230     PRELUDE_ERROR_ENOSYS = PRELUDE_ERROR_SYSTEM_ERROR | 94,
231     PRELUDE_ERROR_ENOTBLK = PRELUDE_ERROR_SYSTEM_ERROR | 95,
232     PRELUDE_ERROR_ENOTCONN = PRELUDE_ERROR_SYSTEM_ERROR | 96,
233     PRELUDE_ERROR_ENOTDIR = PRELUDE_ERROR_SYSTEM_ERROR | 97,
234     PRELUDE_ERROR_ENOTEMPTY = PRELUDE_ERROR_SYSTEM_ERROR | 98,
235     PRELUDE_ERROR_ENOTNAM = PRELUDE_ERROR_SYSTEM_ERROR | 99,
236     PRELUDE_ERROR_ENOTSOCK = PRELUDE_ERROR_SYSTEM_ERROR | 100,
237     PRELUDE_ERROR_ENOTSUP = PRELUDE_ERROR_SYSTEM_ERROR | 101,
238     PRELUDE_ERROR_ENOTTY = PRELUDE_ERROR_SYSTEM_ERROR | 102,
239     PRELUDE_ERROR_ENOTUNIQ = PRELUDE_ERROR_SYSTEM_ERROR | 103,
240     PRELUDE_ERROR_ENXIO = PRELUDE_ERROR_SYSTEM_ERROR | 104,
241     PRELUDE_ERROR_EOPNOTSUPP = PRELUDE_ERROR_SYSTEM_ERROR | 105,
242     PRELUDE_ERROR_EOVERFLOW = PRELUDE_ERROR_SYSTEM_ERROR | 106,
243     PRELUDE_ERROR_EPERM = PRELUDE_ERROR_SYSTEM_ERROR | 107,
244     PRELUDE_ERROR_EPFNOSUPPORT = PRELUDE_ERROR_SYSTEM_ERROR | 108,
245     PRELUDE_ERROR_EPIPE = PRELUDE_ERROR_SYSTEM_ERROR | 109,
246     PRELUDE_ERROR_EPROCLIM = PRELUDE_ERROR_SYSTEM_ERROR | 110,
247     PRELUDE_ERROR_EPROCUNAVAIL = PRELUDE_ERROR_SYSTEM_ERROR | 111,
248     PRELUDE_ERROR_EPROGMISMATCH = PRELUDE_ERROR_SYSTEM_ERROR | 112,
249     PRELUDE_ERROR_EPROGUNAVAIL = PRELUDE_ERROR_SYSTEM_ERROR | 113,
250     PRELUDE_ERROR_EPROTO = PRELUDE_ERROR_SYSTEM_ERROR | 114,
251     PRELUDE_ERROR_EPROTONOSUPPORT = PRELUDE_ERROR_SYSTEM_ERROR | 115,
252     PRELUDE_ERROR_EPROTOTYPE = PRELUDE_ERROR_SYSTEM_ERROR | 116,
253     PRELUDE_ERROR_ERANGE = PRELUDE_ERROR_SYSTEM_ERROR | 117,
254     PRELUDE_ERROR_EREMCHG = PRELUDE_ERROR_SYSTEM_ERROR | 118,
255     PRELUDE_ERROR_EREMOTE = PRELUDE_ERROR_SYSTEM_ERROR | 119,
256     PRELUDE_ERROR_EREMOTEIO = PRELUDE_ERROR_SYSTEM_ERROR | 120,
257     PRELUDE_ERROR_ERESTART = PRELUDE_ERROR_SYSTEM_ERROR | 121,
258     PRELUDE_ERROR_EROFS = PRELUDE_ERROR_SYSTEM_ERROR | 122,
259     PRELUDE_ERROR_ERPCMISMATCH = PRELUDE_ERROR_SYSTEM_ERROR | 123,
260     PRELUDE_ERROR_ESHUTDOWN = PRELUDE_ERROR_SYSTEM_ERROR | 124,
261     PRELUDE_ERROR_ESOCKTNOSUPPORT = PRELUDE_ERROR_SYSTEM_ERROR | 125,
262     PRELUDE_ERROR_ESPIPE = PRELUDE_ERROR_SYSTEM_ERROR | 126,
263     PRELUDE_ERROR_ESRCH = PRELUDE_ERROR_SYSTEM_ERROR | 127,
264     PRELUDE_ERROR_ESRMNT = PRELUDE_ERROR_SYSTEM_ERROR | 128,
265     PRELUDE_ERROR_ESTALE = PRELUDE_ERROR_SYSTEM_ERROR | 129,
266     PRELUDE_ERROR_ESTRPIPE = PRELUDE_ERROR_SYSTEM_ERROR | 130,
267     PRELUDE_ERROR_ETIME = PRELUDE_ERROR_SYSTEM_ERROR | 131,
268     PRELUDE_ERROR_ETIMEDOUT = PRELUDE_ERROR_SYSTEM_ERROR | 132,
269     PRELUDE_ERROR_ETOOMANYREFS = PRELUDE_ERROR_SYSTEM_ERROR | 133,
270     PRELUDE_ERROR_ETXTBSY = PRELUDE_ERROR_SYSTEM_ERROR | 134,
271     PRELUDE_ERROR_EUCLEAN = PRELUDE_ERROR_SYSTEM_ERROR | 135,
272     PRELUDE_ERROR_EUNATCH = PRELUDE_ERROR_SYSTEM_ERROR | 136,
273     PRELUDE_ERROR_EUSERS = PRELUDE_ERROR_SYSTEM_ERROR | 137,
274     PRELUDE_ERROR_EWOULDBLOCK = PRELUDE_ERROR_SYSTEM_ERROR | 138,
275     PRELUDE_ERROR_EXDEV = PRELUDE_ERROR_SYSTEM_ERROR | 139,
276     PRELUDE_ERROR_EXFULL = PRELUDE_ERROR_SYSTEM_ERROR | 140,
277 } prelude_error_code_t;
278 
279 
280 #ifndef PRELUDE_ERROR_SOURCE_DEFAULT
281  #define PRELUDE_ERROR_SOURCE_DEFAULT  PRELUDE_ERROR_SOURCE_UNKNOWN
282 #endif
283 
284 typedef signed int prelude_error_t;
285 
286 prelude_bool_t prelude_error_is_verbose(prelude_error_t error);
287 
288 prelude_error_code_t prelude_error_get_code(prelude_error_t error);
289 
290 prelude_error_source_t prelude_error_get_source(prelude_error_t error);
291 
292 prelude_error_code_t prelude_error_code_from_errno(int err);
293 
294 prelude_error_t prelude_error_make(prelude_error_source_t source, prelude_error_code_t code);
295 
296 prelude_error_t prelude_error_make_from_errno(prelude_error_source_t source, int err);
297 
298 void prelude_perror(prelude_error_t error, const char *fmt, ...)
299                    PRELUDE_FMT_PRINTF(2, 3);
300 
301 const char *prelude_strerror(prelude_error_t err);
302 
303 const char *prelude_strsource(prelude_error_t err);
304 
305 int prelude_error_code_to_errno(prelude_error_code_t code);
306 
307 prelude_error_t prelude_error_verbose_make_v(prelude_error_source_t source,
308                                              prelude_error_code_t code, const char *fmt, va_list ap)
309                                              PRELUDE_FMT_PRINTF(3, 0);
310 
311 prelude_error_t prelude_error_verbose_make(prelude_error_source_t source,
312                                            prelude_error_code_t code, const char *fmt, ...)
313                                            PRELUDE_FMT_PRINTF(3, 4);
314 
315 
prelude_error(prelude_error_code_t code)316 static inline prelude_error_t prelude_error(prelude_error_code_t code)
317 {
318         return prelude_error_make(PRELUDE_ERROR_SOURCE_DEFAULT, code);
319 }
320 
321 
322 static inline prelude_error_t prelude_error_verbose(prelude_error_code_t code, const char *fmt, ...)
323                                                     PRELUDE_FMT_PRINTF(2, 3);
324 
prelude_error_verbose(prelude_error_code_t code,const char * fmt,...)325 static inline prelude_error_t prelude_error_verbose(prelude_error_code_t code, const char *fmt, ...)
326 {
327         int ret;
328         va_list ap;
329 
330         va_start(ap, fmt);
331         ret = prelude_error_verbose_make_v(PRELUDE_ERROR_SOURCE_DEFAULT, code, fmt, ap);
332         va_end(ap);
333 
334         return ret;
335 }
336 
337 
338 
prelude_error_from_errno(int err)339 static inline prelude_error_t prelude_error_from_errno(int err)
340 {
341         return prelude_error_make(PRELUDE_ERROR_SOURCE_DEFAULT, prelude_error_code_from_errno(err));
342 }
343 
344 
345 #ifdef __cplusplus
346  }
347 #endif
348 
349 
350 #endif
351