src/lib/error.h
author Tero Marttila <terom@fixme.fi>
Tue, 18 Nov 2008 01:55:13 +0200
changeset 41 6abda2fa4579
parent 36 56427f22e969
child 44 9e76ee9729b6
permissions -rw-r--r--
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
#ifndef LIB_ERROR_H
#define LIB_ERROR_H

#include "log.h"

/*
 * err_t is always positive
 */
typedef unsigned int err_t;

#define ERROR(...) do { err_func(__func__, __VA_ARGS__); goto error; } while (0)
#define PERROR(...) do { perr_func(__func__, __VA_ARGS__); goto error; } while (0)
#define EERROR(_err, ...) do { eerr_func(__func__, (_err), __VA_ARGS__); goto error; } while (0)
#define NERROR(...) do { err_func_nonl(__func__, __VA_ARGS__); goto error; } while (0)
#define SERROR(_err) do { (_err); goto error; } while (0)
#define XERROR(_err, ...) do { (_err); err_func(__func__, __VA_ARGS__); goto error; } while (0)
#define NXERROR(_err, ...) do { (_err); err_func_nonl(__func__, __VA_ARGS__); goto error; } while (0)

// XXX: replace with *err_func(...) + exit(EXIT_FAILURE)
#define FATAL(...) err_func_exit(__func__, __VA_ARGS__)
#define PFATAL(...) perr_func_exit(__func__, __VA_ARGS__)
#define EFATAL(_err, ...) eerr_func_exit(__func__, (_err), __VA_ARGS__)

#endif /* LIB_ERROR_H */