Blame src/internal/tpax_errinfo_impl.c

88751e
/******************************************************/
88751e
/*  tpax: a topological pax implementation            */
88751e
/*  Copyright (C) 2020  Z. Gilboa                     */
88751e
/*  Released under GPLv2 and GPLv3; see COPYING.TPAX. */
88751e
/******************************************************/
88751e
88751e
#include <tpax/tpax.h>
88751e
#include "tpax_driver_impl.h"
88751e
#include "tpax_errinfo_impl.h"
88751e
88751e
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
}