Blame src/internal/mdso_errinfo_impl.c

4ecd08
/****************************************************************/
4ecd08
/*  mdso: midipix dso scavenger                                 */
78ab3c
/*  Copyright (C) 2015--2017  Z. Gilboa                         */
4ecd08
/*  Released under GPLv2 and GPLv3; see COPYING.MDSO.           */
4ecd08
/****************************************************************/
4ecd08
4ecd08
#include <mdso/mdso.h>
4ecd08
#include "mdso_driver_impl.h"
4ecd08
#include "mdso_errinfo_impl.h"
4ecd08
4ecd08
int mdso_record_error(
4ecd08
	const struct mdso_driver_ctx *	dctx,
1d4a9e
	int				esyscode,
1d4a9e
	int				elibcode,
1d4a9e
	const char *			efunction,
1d4a9e
	int				eline,
1d4a9e
	unsigned			eflags,
1d4a9e
	void *				eany)
4ecd08
{
4ecd08
	struct mdso_driver_ctx_impl *	ictx;
4ecd08
	struct mdso_error_info *	erri;
4ecd08
4ecd08
	ictx = mdso_get_driver_ictx(dctx);
4ecd08
4ecd08
	if (ictx->errinfp == ictx->erricap)
4ecd08
		return -1;
4ecd08
4ecd08
	*ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
4ecd08
	erri = *ictx->errinfp;
4ecd08
5f2fd6
	erri->euctx     = ictx->euctx;
5f2fd6
	erri->eunit     = ictx->eunit;
5f2fd6
1d4a9e
	erri->edctx     = dctx;
1d4a9e
	erri->esyscode  = esyscode;
1d4a9e
	erri->elibcode  = elibcode;
1d4a9e
	erri->efunction = efunction;
1d4a9e
	erri->eline     = eline;
1d4a9e
	erri->eflags    = eflags;
1d4a9e
	erri->eany      = eany;
4ecd08
4ecd08
	ictx->errinfp++;
4ecd08
4ecd08
	return -1;
4ecd08
}