Main Page   Compound List   File List   Compound Members   File Members  

error.h File Reference

#include <sys/types.h>
#include <errno.h>
#include <glib.h>

Go to the source code of this file.

Compounds

struct  lu_error

Defines

#define LU_ERROR_CHECK(err_p_p)

Typedefs

typedef struct lu_error  lu_error_t

Enumerations

enum  lu_error_code {
  lu_error_success = 0, lu_error_config_disabled, lu_error_generic, lu_error_privilege,
  lu_error_access_denied, lu_error_name_bad, lu_error_id_bad, lu_error_name_used,
  lu_error_id_used, lu_error_terminal, lu_error_open, lu_error_lock,
  lu_error_stat, lu_error_read, lu_error_write, lu_error_search,
  lu_error_init, lu_error_module_load, lu_error_module_sym, lu_error_version
}

Functions

void lu_error_new (struct lu_error **error, enum lu_error_code code, const char *fmt,...)
void lu_error_free (struct lu_error **error)


Detailed Description


Define Documentation

#define LU_ERROR_CHECK( err_p_p )
 

Value:

do { \
        struct lu_error **__err = (err_p_p); \
        if ((__err == NULL) || (*__err != NULL)) { \
                int i; \
                if(__err == NULL) { \
                        fprintf(stderr, "libuser fatal error: %s() called with NULL " #err_p_p "\n", __FUNCTION__); \
                } else \
                if(*__err != NULL) { \
                        fprintf(stderr, "libuser fatal error: %s() called with non-NULL *" #err_p_p "\nstack:\n", __FUNCTION__); \
                        for(i = 0; (*__err)->stack && (*__err)->stack[i]; i++) { \
                                fprintf(stderr, "\t%s\n", (*__err)->stack[i]); \
                        } \
                } \
                abort(); \
        } \
} while(0)
Checks that a passed-in error pointer is not already populated, and calls abort() if it is.


Enumeration Type Documentation

enum lu_error_code
 

An error type.

Enumeration values:
lu_error_config_disabled   No error.
lu_error_generic   Disabled in configuration -- non-fatal.
lu_error_privilege   Generic error.
lu_error_access_denied   We know we don't have enough privileges.
lu_error_name_bad   Denied access.
lu_error_id_bad   Name bad.
lu_error_name_used   ID bad.
lu_error_id_used   Name is in use.
lu_error_terminal   ID is in use.
lu_error_open   Error manipulating terminal attributes.
lu_error_lock   Error opening file.
lu_error_stat   Error locking file.
lu_error_read   Error getting information about file.
lu_error_write   Error reading from file.
lu_error_search   Error writing to file.
lu_error_init   Data not found in file.
lu_error_module_load   Internal initialization error.
lu_error_module_sym   Error loading module.
lu_error_version   Error finding address of symbol in module.


Function Documentation

void lu_error_free ( struct lu_error ** error )
 

lu_error_free:

Parameters:
error   A pointer to a pointer to a lu_error_t which must be cleared.

This function clears an lu_error_t pointer.

Returns:
nothing.

void lu_error_new ( struct lu_error ** error,
enum lu_error_code code,
const char * desc,
... )
 

lu_error_new:

Parameters:
error   A pointer to a pointer to a lu_error_t which will be used to hold information about this error.
code   An lu_error_code describing the error.
desc   A format string (followed by arguments) giving a more detailed description of the error. May be NULL.

This function sets an lu_error_t pointer to a value which can be passed up to a calling function.

Returns:
nothing.


Generated at Wed Aug 29 13:13:21 2001 for libuser by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001