Ver Fonte

[err] Adding errno and errcode

Vinicius Teshima há 2 anos atrás
pai
commit
004e56e367
3 ficheiros alterados com 26 adições e 0 exclusões
  1. 13 0
      include/toolbox/errcode.h
  2. 10 0
      include/toolbox/errno.h
  3. 3 0
      src/toolbox/errno.c

+ 13 - 0
include/toolbox/errcode.h

@@ -0,0 +1,13 @@
+#ifndef TOOLBOX_ERRCODE_H
+#define TOOLBOX_ERRCODE_H
+
+#define RET_TYPE unsigned char
+
+#define RET_OK    ((RET_TYPE) 0L)		/* No Error */
+#define RET_EFM   ((RET_TYPE) 1L)		/* Failed to Malloc */
+#define RET_EIDNE ((RET_TYPE) 2L)		/* Item Does Not Exist */
+#define RET_EVBTS ((RET_TYPE) 3L)		/* Value Bigger Than Size */
+#define RET_EVN   ((RET_TYPE) 4L)		/* Value is Null */
+#define RET_EIAE  ((RET_TYPE) 5L)		/* Item Already Exist */
+
+#endif

+ 10 - 0
include/toolbox/errno.h

@@ -0,0 +1,10 @@
+#ifndef TOOLBOX_ERRNO_H
+#define TOOLBOX_ERRNO_H
+
+#include "toolbox/errcode.h"
+
+#include <errno.h>
+
+extern __thread RET_TYPE toolbox_errno;
+
+#endif

+ 3 - 0
src/toolbox/errno.c

@@ -0,0 +1,3 @@
+#include "toolbox/errno.h"
+
+__thread RET_TYPE toolbox_errno;