From d413d68bcd714151b5bd064896e4ea61707b9833 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 25 Oct 2016 22:43:49 -0400 Subject: internals: error trace implementation: added sfrt_record_error(). --- src/internal/sofort_errinfo_impl.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/internal/sofort_errinfo_impl.c (limited to 'src/internal/sofort_errinfo_impl.c') diff --git a/src/internal/sofort_errinfo_impl.c b/src/internal/sofort_errinfo_impl.c new file mode 100644 index 0000000..31b008a --- /dev/null +++ b/src/internal/sofort_errinfo_impl.c @@ -0,0 +1,39 @@ +#include +#include "sofort_driver_impl.h" +#include "sofort_errinfo_impl.h" + +int sfrt_record_error( + const struct sfrt_driver_ctx * dctx, + int esyscode, + int elibcode, + const char * efunction, + int eline, + unsigned eflags, + void * eany) +{ + struct sfrt_driver_ctx_impl * ictx; + struct sfrt_error_info * erri; + + ictx = sfrt_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; +} -- cgit v1.2.3