BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Reference   |   Topic List   |   Previous   |   Next   |   Contents

   BEA Tuxedo C Function Reference

Uunix_err(3c)

Name

Uunix_err() - print UNIX system call error

Synopsis

#include Uunix.h 

void Uunix_err(s)
char *s;

Description

When a BEA Tuxedo system function calls a UNIX system call that detects an error, an error is returned. The external integer Uunixerr() is set to a value (as defined in Uunix.h) that identifies the system call that returned the error. In addition, the system call sets errno() to a value (as defined in errno.h) that tells why the system call failed.

The Uunix_err() function is provided to produce a message on the standard error output, describing the last system call error encountered during a call to a BEA Tuxedo system function. It takes one argument, a string. The function prints the argument string, then a colon and a blank, followed by the name of the system call that failed, the reason for failure, and a newline. To be of most use, the argument string should include the name of the program that incurred the error. The system call error number is taken from the external variable Uunixerr(), the reason is taken from errno(). Both variables are set when errors occur. They are not cleared when non-erroneous calls are made.

To simplify variant formatting of messages, the array of message strings

extern char *Uunixmsg[]; 

is provided; Uunixerr() can be used as an index into this table to get the name of the system call that failed (without the newline).

A thread in a multithreaded application may issue a call to Uunix_err() while running in any context state, including TPINVALIDCONTEXT.

Examples

#include Uunix.h 
extern int Uunixerr, errno;

..........
if((fd=open("myfile", 3, 0660)) == -1)
{
Uunixerr = UOPEN;
Uunix_err("myprog");
exit(1);
}