Error handling

Overview

Error handling macros and functions. More…

// typedefs

typedef void (*snd_lib_error_handler_t)(
    const char *file,
    int line,
    const char *function,
    int err,
    const char *fmt,
    ...
    );

// global variables

snd_lib_error_handler_t snd_lib_error;

// global functions

const char*
snd_strerror(int errnum);

int
snd_lib_error_set_handler(snd_lib_error_handler_t handler);

// macros

#define SNDERR(args...)
#define SND_ERROR_ALISP_NIL
#define SND_ERROR_BEGIN
#define SND_ERROR_INCOMPATIBLE_VERSION
#define SYSERR(args...)

Detailed Documentation

Error handling macros and functions.

Typedefs

typedef void (*snd_lib_error_handler_t)(
    const char *file,
    int line,
    const char *function,
    int err,
    const char *fmt,
    ...
    )

Error handler callback.

A function of this type is called by the ALSA library when an error occurs. This function usually shows the message on the screen, and/or logs it.

Parameters:

file

Source file name.

line

Line number.

function

Function name.

err

Value of errno, or 0 if not relevant.

fmt

printf(3) format.

printf(3) arguments.

Global Variables

snd_lib_error_handler_t snd_lib_error

Pointer to the error handler function. For internal use only.

Global Functions

const char*
snd_strerror(int errnum)

Returns the message for an error code.

Parameters:

errnum

The error code number, which must be a system error code or an ALSA error code.

Returns:

The ASCII description of the given numeric error code.

int
snd_lib_error_set_handler(snd_lib_error_handler_t handler)

Sets the error handler.

This function sets a new error handler, or (if handler is NULL) the default one which prints the error messages to stderr.

Parameters:

handler

The pointer to the new error handler function.

Macros

#define SNDERR(args...)

Shows a sound error message.

#define SND_ERROR_ALISP_NIL

Lisp encountered an error during acall.

#define SND_ERROR_BEGIN

Lower boundary of sound error codes.

#define SND_ERROR_INCOMPATIBLE_VERSION

Kernel/library protocols are not compatible.

#define SYSERR(args...)

Shows a system error message (related to errno).