File: err.h

package info (click to toggle)
siridb-server 2.0.53-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,612 kB
  • sloc: ansic: 47,501; python: 6,263; sh: 254; makefile: 149
file content (37 lines) | stat: -rw-r--r-- 1,165 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * err.h - SiriDB Error.
 */
#ifndef SIRI_ERR_H_
#define SIRI_ERR_H_

#include <logger/logger.h>
#include <signal.h>


/* value should be 0,
 * any other value indicates a critical error has occurred */
extern int siri_err;

#define ERR_CLOSE_ENFORCED -3
#define ERR_CLOSE_TIMEOUT_REACHED -2
#define ERR_STARTUP -1

#define ERR_ALLOC                                           \
log_critical("Memory allocation error at: %s:%d (%s)",      \
        __FILE__, __LINE__, __func__);                      \
raise(SIGSEGV);                                             \
if (!siri_err) siri_err = SIGSEGV;

#define ERR_FILE                                            \
log_critical("Critical file error at: %s:%d (%s)",          \
        __FILE__, __LINE__, __func__);                      \
raise(SIGABRT);                                             \
if (!siri_err) siri_err = SIGABRT;

#define ERR_C                                       \
log_critical("Critical error at: %s:%d (%s)",       \
        __FILE__, __LINE__, __func__);              \
raise(SIGABRT);                                     \
if (!siri_err) siri_err = SIGABRT;

#endif  /* SIRI_ERR_H_ */