Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf_errmsg(3E) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



ELFERROR(3E)                                                    ELFERROR(3E)



NAME
     elferrmsg, elferrno - error handling

SYNOPSIS
     cc [flag ...] file ...  -lelf [library ...]

     #include <libelf.h>

const char *elferrmsg(int err);
int elferrno(void);
DESCRIPTION
If an ELF library function fails, a program may call elferrno to
retrieve the library's internal error number. As a side effect, this
function resets the internal error number to zero, which indicates no
error.
elferrmsg 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 the null
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 for the given number, elferrmsg returns a
pointer to an appropriate message. This function does not have the side
effect of clearing the internal error number.
EXAMPLE
The following fragment clears the internal error number and checks it
later for errors. Unless an error occurs after the first call to
elferrno, the next call will return zero.
(void)elferrno();
while (moretodo)
{
/* processing ... */
if ((err = elferrno()) != 0)
{
msg = elferrmsg(err);
/* print msg */
}
}
SEE ALSO
elf(3E), elfversion(3E).
Page 1

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026