ELF Library Functions elf_errmsg(3ELF)
NAME
elf_errmsg, elf_errno - error handling
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include
const char *elf_errmsg(int err);
int elf_errno(void);
DESCRIPTION
If an ELF library function fails, a program can callelf_errno() to retrieve the library's internal error number.
As a side effect, this function resets the internal error number to 0, which indicates no error.The elf_errmsg() function takes an error number, err, and
returns a null-terminated error message (with no trailing
new-line) that describes the problem. A zero err retrieves a
message for the most recent error. If no error has occurred, the return value is a null pointer (not a pointer to thenull string). Using err of -1 also retrieves the most recent
error, except it guarantees a non-null return value, even
when no error has occurred. If no message is available forthe given number, elf_errmsg() returns a pointer to an
appropriate message. This function does not have the side effect of clearing the internal error number.EXAMPLES
Example 1 A sample program of calling the elf_errmsg() func-
tion. The following fragment clears the internal error number and checks it later for errors. Unless an error occurs after thefirst call to elf_errno(), the next call will return 0.
(void)elf_errno();
/* processing ... */while (more_to_do)
{if ((err = elf_errno()) != 0)
{ /* print msg */msg = elf_errmsg(err);
} }SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elf_errmsg(3ELF)
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
elf(3ELF), libelf(3LIB), attributes(5)SunOS 5.11 Last change: 11 Jul 2001 2