summaryrefslogtreecommitdiff
path: root/src/internal/tpax_errinfo_impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/tpax_errinfo_impl.c')
-rw-r--r--src/internal/tpax_errinfo_impl.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/internal/tpax_errinfo_impl.c b/src/internal/tpax_errinfo_impl.c
new file mode 100644
index 0000000..b610869
--- /dev/null
+++ b/src/internal/tpax_errinfo_impl.c
@@ -0,0 +1,45 @@
+/******************************************************/
+/* tpax: a topological pax implementation */
+/* Copyright (C) 2020 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
+/******************************************************/
+
+#include <tpax/tpax.h>
+#include "tpax_driver_impl.h"
+#include "tpax_errinfo_impl.h"
+
+int tpax_record_error(
+ const struct tpax_driver_ctx * dctx,
+ int esyscode,
+ int elibcode,
+ const char * efunction,
+ int eline,
+ unsigned eflags,
+ void * eany)
+{
+ struct tpax_driver_ctx_impl * ictx;
+ struct tpax_error_info * erri;
+
+ ictx = tpax_get_driver_ictx(dctx);
+
+ if (ictx->errinfp == ictx->erricap)
+ return -1;
+
+ *ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
+ erri = *ictx->errinfp;
+
+ erri->euctx = ictx->euctx;
+ erri->eunit = ictx->eunit;
+
+ erri->edctx = dctx;
+ erri->esyscode = esyscode;
+ erri->elibcode = elibcode;
+ erri->efunction = efunction;
+ erri->eline = eline;
+ erri->eflags = eflags;
+ erri->eany = eany;
+
+ ictx->errinfp++;
+
+ return -1;
+}