orbea / cross / slibtool

Forked from cross/slibtool 3 years ago
Clone

Blame src/internal/slibtool_errinfo_impl.h

5bf1b0
/*******************************************************************/
5bf1b0
/*  slibtool: a skinny libtool implementation, written in C        */
5bf1b0
/*  Copyright (C) 2016  Z. Gilboa                                  */
5bf1b0
/*  Released under the Standard MIT License; see COPYING.SLIBTOOL. */
5bf1b0
/*******************************************************************/
5bf1b0
5bf1b0
#include <errno.h>
5bf1b0
#include <slibtool/slibtool.h>
5bf1b0
5bf1b0
int slbt_record_error(
5bf1b0
	const struct slbt_driver_ctx *,
5bf1b0
	int		syserror,
5bf1b0
	int		liberror,
5bf1b0
	const char *	function,
5bf1b0
	int		line,
5bf1b0
	unsigned	flags,
5bf1b0
	void *		ctx);
5bf1b0
5bf1b0
#define SLBT_SYSTEM_ERROR(dctx)           \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		errno,                    \
5bf1b0
		0,                        \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_TOP_LEVEL,     \
5bf1b0
		0)
5bf1b0
5bf1b0
#define SLBT_BUFFER_ERROR(dctx)           \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		ENOBUFS,                  \
5bf1b0
		0,                        \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_TOP_LEVEL,     \
5bf1b0
		0)
5bf1b0
5bf1b0
#define SLBT_SPAWN_ERROR(dctx)            \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		errno,                    \
5bf1b0
		0,                        \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_TOP_LEVEL      \
5bf1b0
		| (errno ? 0              \
5bf1b0
		   : SLBT_ERROR_CHILD),   \
5bf1b0
		0)
5bf1b0
5bf1b0
#define SLBT_FILE_ERROR(dctx)             \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		EIO,                      \
5bf1b0
		0,                        \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_TOP_LEVEL,     \
5bf1b0
		0)
5bf1b0
5bf1b0
#define SLBT_CUSTOM_ERROR(dctx,liberror)  \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		0,                        \
5bf1b0
		liberror,                 \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_TOP_LEVEL      \
5bf1b0
		| SLBT_ERROR_CUSTOM,      \
5bf1b0
		0)
5bf1b0
5bf1b0
#define SLBT_NESTED_ERROR(dctx)           \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		0,                        \
5bf1b0
		0,                        \
5bf1b0
		__func__,                 \
5bf1b0
		__LINE__,                 \
5bf1b0
		SLBT_ERROR_NESTED,        \
5bf1b0
		0)