GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ELF_ERRMSG(3) FreeBSD Library Functions Manual ELF_ERRMSG(3)

elf_errmsg, elf_errno
ELF library error message handling

ELF Access Library (libelf, -lelf)

#include <libelf.h>

int
elf_errno(void);

const char *
elf_errmsg(int error);

When an error occurs during an ELF library API call, the library encodes the error using an error number and stores the error number internally for retrieval by the application at a later point of time. Error numbers may contain an OS supplied error code in addition to an ELF API specific error code. An error number value of zero indicates no error.

Function elf_errno() is used to retrieve the last error recorded by the ELF library. Invoking this function has the side-effect of resetting the ELF library's recorded error number to zero.

The function elf_errmsg() returns a null-terminated string with a human readable description of the error specified in argument error. A zero value for argument error retrieves the most recent error encountered by the ELF library. An argument value of -1 behaves identically, except that it guarantees a non-NULL return from elf_errmsg().

Function elf_errno() returns a non-zero value encoding the last error encountered by the ELF library, or zero if no error was encountered.

Function elf_errmsg() returns a pointer to library local storage for non-zero values of argument error. With a zero argument, the function will return a NULL pointer if no error had been encountered by the library, or will return a pointer to library local storage containing an appropriate message otherwise.

Clearing the ELF library's recorded error number can be accomplished by invoking elf_errno() and discarding its return value.
/* clear error */
(void) elf_errno();

Retrieving a human-readable description of the current error number can be done with the following snippet:

int err;
const char *errmsg;
...
err = elf_errno();
if (err != 0)
	errmsg = elf_errmsg(err);

elf(3), gelf(3)

Function elf_errmsg() is not localized.
June 11, 2006 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.