Error handling(3)

NAME
Error handling - how to handle errors which might very well happen More...

  Defines
#define BRLERR_SUCCESS 0
#define BRLERR_NOMEM 1
#define BRLERR_TTYBUSY 2
#define BRLERR_UNKNOWN_INSTRUCTION 3
#define BRLERR_ILLEGAL_INSTRUCTION 4
#define BRLERR_INVALID_PARAMETER 5
#define BRLERR_INVALID_PACKET 6
#define BRLERR_RAWNOTSUPP 7
#define BRLERR_KEYSNOTSUPP 8
#define BRLERR_CONNREFUSED 9
#define BRLERR_OPNOTSUPP 10
#define BRLERR_GAIERR 11
#define BRLERR_LIBCERR 12
#define BRLERR_UNKNOWNTTY 13
#define BRLERR_PROTOCOL_VERSION 14
#define BRLERR_EOF 15

  Functions
void brlapi_perror (const char *s)
int * brlapi_errno_location (void)
const char * brlapi_strerror (void)

  Variables
const char * brlapi_errlist []
const int brlapi_nerr
int brlapi_errno

DETAILED DESCRIPTION

DEFINE DOCUMENTATION

  #define BRLERR_CONNREFUSED 9

Connection refused

  #define BRLERR_EOF 15

Unexpected end of file

  #define BRLERR_GAIERR 11

Getaddrinfo error

  #define BRLERR_ILLEGAL_INSTRUCTION 4

Forbiden in current mode

  #define BRLERR_INVALID_PACKET 6

Invalid size

  #define BRLERR_INVALID_PARAMETER 5

Out of range or have no sense

  #define BRLERR_KEYSNOTSUPP 8

Reading of key codes not supported by loaded driver

  #define BRLERR_LIBCERR 12

Libc error

  #define BRLERR_NOMEM 1

Not enough memory

  #define BRLERR_OPNOTSUPP 10

Operation not supported

  #define BRLERR_PROTOCOL_VERSION 14

Bad protocol version

  #define BRLERR_RAWNOTSUPP 7

Raw mode not supported by loaded driver

  #define BRLERR_SUCCESS 0

Success

  #define BRLERR_TTYBUSY 2

Already a connection running in this tty

  #define BRLERR_UNKNOWN_INSTRUCTION 3

Not implemented in protocol

  #define BRLERR_UNKNOWNTTY 13

Couldn't find out the tty number

FUNCTION DOCUMENTATION

  int* brlapi_errno_location (void)

Get per-thread errno location

In multithreaded software, brlapi_errno is thread specific, so api.h cheats about the brlapi_errno token and actually calls brlapi_errno_location()

This gets the thread specific location of global variable brlapi_errno

  void brlapi_perror (const char * s)

Print a BrlAPI error message

brlapi_perror() reads brlapi_errno, and acts just like perror()

  const char* brlapi_strerror (void)

Get plain error message

brlapi_strerror reads brlapi_errno, and returns the corresponding plain error message.

VARIABLE DOCUMENTATION

  const char* brlapi_errlist[]

Error message list

These are the string constants used by brlapi_perror()

  int brlapi_errno

Global variable brlapi_errno

brlapi_errno is a global left-value containing the last error code. It is not reset to BRLERR_SUCCESS on success.

  const int brlapi_nerr

Number of error messages