Path: blob/master/thirdparty/linuxbsd_headers/alsa/error.h
9903 views
/**1* \file include/error.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*8* Application interface library for the ALSA driver9*/10/*11* This library is free software; you can redistribute it and/or modify12* it under the terms of the GNU Lesser General Public License as13* published by the Free Software Foundation; either version 2.1 of14* the License, or (at your option) any later version.15*16* This program is distributed in the hope that it will be useful,17* but WITHOUT ANY WARRANTY; without even the implied warranty of18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19* GNU Lesser General Public License for more details.20*21* You should have received a copy of the GNU Lesser General Public22* License along with this library; if not, write to the Free Software23* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24*25*/2627#ifndef __ALSA_ERROR_H28#define __ALSA_ERROR_H2930#ifdef __cplusplus31extern "C" {32#endif3334/**35* \defgroup Error Error handling36* Error handling macros and functions.37* \{38*/3940#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */41#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */42#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */4344const char *snd_strerror(int errnum);4546/**47* \brief Error handler callback.48* \param file Source file name.49* \param line Line number.50* \param function Function name.51* \param err Value of \c errno, or 0 if not relevant.52* \param fmt \c printf(3) format.53* \param ... \c printf(3) arguments.54*55* A function of this type is called by the ALSA library when an error occurs.56* This function usually shows the message on the screen, and/or logs it.57*/58typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;59extern snd_lib_error_handler_t snd_lib_error;60extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);6162#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)63#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */64#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */65#else66#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, ##args) /**< Shows a sound error message. */67#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args) /**< Shows a system error message (related to \c errno). */68#endif6970/** \} */7172#ifdef __cplusplus73}74#endif7576/** Local error handler function type */77typedef void (*snd_local_error_handler_t)(const char *file, int line,78const char *func, int err,79const char *fmt, va_list arg);8081snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);8283#endif /* __ALSA_ERROR_H */84858687