error: bootstrap errno like error code approach

pull/8304/head
Victor Julien 4 years ago
parent cdd52dc8cd
commit e621416d80

@ -27,6 +27,8 @@
#ifndef __THREADS_H__
#define __THREADS_H__
#include "suricata-common.h"
#ifndef THREAD_NAME_LEN
#define THREAD_NAME_LEN 16
#endif

@ -28,6 +28,7 @@
#include "util-error.h"
thread_local SCError sc_errno = SC_OK;
#define CASE_CODE(E) case E: return #E
/**
@ -41,6 +42,10 @@ const char * SCErrorToString(SCError err)
{
switch (err) {
CASE_CODE (SC_OK);
CASE_CODE(SC_ENOMEM);
CASE_CODE(SC_EINVAL);
CASE_CODE (SC_ERR_MEM_ALLOC);
CASE_CODE (SC_ERR_ACTION_ORDER);
CASE_CODE (SC_ERR_PCRE_MATCH);

@ -24,10 +24,13 @@
#ifndef __ERROR_H__
#define __ERROR_H__
/* different error types */
typedef enum {
SC_OK,
SC_ENOMEM,
SC_EINVAL,
SC_ERR_MEM_ALLOC,
SC_ERR_PCRE_MATCH,
SC_ERR_ACTION_ORDER,
@ -391,5 +394,8 @@ typedef enum {
const char *SCErrorToString(SCError);
#include "threads.h"
extern thread_local SCError sc_errno;
#endif /* __ERROR_H__ */

Loading…
Cancel
Save