Blame src/internal/tpax_errinfo_impl.c

5874a9
/**************************************************************/
5874a9
/*  tpax: a topological pax implementation                    */
bef28d
/*  Copyright (C) 2020--2024  SysDeer Technologies, LLC       */
5874a9
/*  Released under GPLv2 and GPLv3; see COPYING.TPAX.         */
5874a9
/**************************************************************/
88751e
88751e
#include <tpax/tpax.h>
88751e
#include "tpax_driver_impl.h"
88751e
#include "tpax_errinfo_impl.h"
538329
#include "tpax_visibility_impl.h"
88751e
538329
tpax_hidden int tpax_record_error(
88751e
	const struct tpax_driver_ctx *	dctx,
88751e
	int				esyscode,
88751e
	int				elibcode,
88751e
	const char *			efunction,
88751e
	int				eline,
88751e
	unsigned			eflags,
88751e
	void *				eany)
88751e
{
88751e
	struct tpax_driver_ctx_impl *	ictx;
88751e
	struct tpax_error_info *		erri;
88751e
88751e
	ictx = tpax_get_driver_ictx(dctx);
88751e
88751e
	if (ictx->errinfp == ictx->erricap)
88751e
		return -1;
88751e
88751e
	*ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
88751e
	erri = *ictx->errinfp;
88751e
88751e
	erri->euctx     = ictx->euctx;
88751e
	erri->eunit     = ictx->eunit;
88751e
88751e
	erri->edctx     = dctx;
88751e
	erri->esyscode  = esyscode;
88751e
	erri->elibcode  = elibcode;
88751e
	erri->efunction = efunction;
88751e
	erri->eline     = eline;
88751e
	erri->eflags    = eflags;
88751e
	erri->eany      = eany;
88751e
88751e
	ictx->errinfp++;
88751e
88751e
	return -1;
88751e
}