Blame include/error.h

Packit Service db8eaa
/**
Packit Service db8eaa
 * \file include/error.h
Packit Service db8eaa
 * \brief Application interface library for the ALSA driver
Packit Service db8eaa
 * \author Jaroslav Kysela <perex@perex.cz>
Packit Service db8eaa
 * \author Abramo Bagnara <abramo@alsa-project.org>
Packit Service db8eaa
 * \author Takashi Iwai <tiwai@suse.de>
Packit Service db8eaa
 * \date 1998-2001
Packit Service db8eaa
 *
Packit Service db8eaa
 * Application interface library for the ALSA driver
Packit Service db8eaa
 */
Packit Service db8eaa
/*
Packit Service db8eaa
 *   This library is free software; you can redistribute it and/or modify
Packit Service db8eaa
 *   it under the terms of the GNU Lesser General Public License as
Packit Service db8eaa
 *   published by the Free Software Foundation; either version 2.1 of
Packit Service db8eaa
 *   the License, or (at your option) any later version.
Packit Service db8eaa
 *
Packit Service db8eaa
 *   This program is distributed in the hope that it will be useful,
Packit Service db8eaa
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service db8eaa
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service db8eaa
 *   GNU Lesser General Public License for more details.
Packit Service db8eaa
 *
Packit Service db8eaa
 *   You should have received a copy of the GNU Lesser General Public
Packit Service db8eaa
 *   License along with this library; if not, write to the Free Software
Packit Service db8eaa
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit Service db8eaa
 *
Packit Service db8eaa
 */
Packit Service db8eaa
Packit Service db8eaa
#ifndef __ALSA_ERROR_H
Packit Service db8eaa
#define __ALSA_ERROR_H
Packit Service db8eaa
Packit Service db8eaa
#ifdef __cplusplus
Packit Service db8eaa
extern "C" {
Packit Service db8eaa
#endif
Packit Service db8eaa
Packit Service db8eaa
/**
Packit Service db8eaa
 *  \defgroup Error Error handling
Packit Service db8eaa
 *  Error handling macros and functions.
Packit Service db8eaa
 *  \{
Packit Service db8eaa
 */
Packit Service db8eaa
Packit Service db8eaa
#define SND_ERROR_BEGIN				500000			/**< Lower boundary of sound error codes. */
Packit Service db8eaa
#define SND_ERROR_INCOMPATIBLE_VERSION		(SND_ERROR_BEGIN+0)	/**< Kernel/library protocols are not compatible. */
Packit Service db8eaa
#define SND_ERROR_ALISP_NIL			(SND_ERROR_BEGIN+1)	/**< Lisp encountered an error during acall. */
Packit Service db8eaa
Packit Service db8eaa
const char *snd_strerror(int errnum);
Packit Service db8eaa
Packit Service db8eaa
/**
Packit Service db8eaa
 * \brief Error handler callback.
Packit Service db8eaa
 * \param file Source file name.
Packit Service db8eaa
 * \param line Line number.
Packit Service db8eaa
 * \param function Function name.
Packit Service db8eaa
 * \param err Value of \c errno, or 0 if not relevant.
Packit Service db8eaa
 * \param fmt \c printf(3) format.
Packit Service db8eaa
 * \param ... \c printf(3) arguments.
Packit Service db8eaa
 *
Packit Service db8eaa
 * A function of this type is called by the ALSA library when an error occurs.
Packit Service db8eaa
 * This function usually shows the message on the screen, and/or logs it.
Packit Service db8eaa
 */
Packit Service db8eaa
typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
Packit Service db8eaa
extern snd_lib_error_handler_t snd_lib_error;
Packit Service db8eaa
extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
Packit Service db8eaa
Packit Service db8eaa
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
Packit Service db8eaa
#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows a sound error message. */
Packit Service db8eaa
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
Packit Service db8eaa
#else
Packit Service db8eaa
#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, 0, ##args) /**< Shows a sound error message. */
Packit Service db8eaa
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, errno, ##args) /**< Shows a system error message (related to \c errno). */
Packit Service db8eaa
#endif
Packit Service db8eaa
Packit Service db8eaa
/** \} */
Packit Service db8eaa
Packit Service db8eaa
#ifdef __cplusplus
Packit Service db8eaa
}
Packit Service db8eaa
#endif
Packit Service db8eaa
Packit Service db8eaa
/** Local error handler function type */
Packit Service db8eaa
typedef void (*snd_local_error_handler_t)(const char *file, int line,
Packit Service db8eaa
					  const char *func, int err,
Packit Service db8eaa
					  const char *fmt, va_list arg);
Packit Service db8eaa
Packit Service db8eaa
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
Packit Service db8eaa
Packit Service db8eaa
#endif /* __ALSA_ERROR_H */
Packit Service db8eaa