next up previous contents
Next: WARNING Up: PFS Library Previous: Multi-threading

Error Reporting

Most functions in this library return a numeric error code (defined in perrno.h). The functions in this library which return pointers to structures will return a null pointer in case of an error. They will indicate which error occurred by setting the global variable perrno (defined in the include file perrno.h) to one of the constants defined in that file. Note: Functions that return an explicit numeric error code are not guaranteed to set perrno.

Most functions that set perrno or return an error code will also set an explanatory message in the global variable p_err_string (also defined in that file). Even if they have no additional information, they are supposed to set p_err_string to the empty string so that the user isn't misled by an old error message.

The Prospero library guarantees that p_err_string will always be a pointer to a string of some sort, frequently empty. You don't have to worry about it being a NULL pointer. p_err_string and p_warn_string may change in value during the program's execution. If you are operating in multi-threaded mode, their values will be different in different threads.

The error indicators in perrno and p_err_string are persistent across library calls. To clear them before making a library call, use the function p_clear_errors():

extern void p_clear_errors(void);

Padma Indraganti
Wed Jun 19 18:04:04 PDT 1996