Blame src/internal/slibtool_errinfo_impl.h

5bf1b0
/*******************************************************************/
5bf1b0
/*  slibtool: a skinny libtool implementation, written in C        */
6803d8
/*  Copyright (C) 2016--2018  Z. Gilboa                            */
5bf1b0
/*  Released under the Standard MIT License; see COPYING.SLIBTOOL. */
5bf1b0
/*******************************************************************/
5bf1b0
089c8b
#ifndef SLIBTOOL_ERRINFO_IMPL_H
089c8b
#define SLIBTOOL_ERRINFO_IMPL_H
089c8b
5bf1b0
#include <errno.h>
5bf1b0
#include <slibtool/slibtool.h>
5bf1b0
5bf1b0
int slbt_record_error(
5bf1b0
	const struct slbt_driver_ctx *,
cacd3e
	int		esyscode,
cacd3e
	int		elibcode,
cacd3e
	const char *	efunction,
cacd3e
	int		eline,
cacd3e
	unsigned	eflags,
cacd3e
	void *		eany);
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
cacd3e
#define SLBT_CUSTOM_ERROR(dctx,elibcode)  \
5bf1b0
	slbt_record_error(                \
5bf1b0
		dctx,                     \
5bf1b0
		0,                        \
cacd3e
		elibcode,                 \
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)
089c8b
089c8b
#endif