libexplain 1.4

The libexplain project provides a library which may be used to explain Unix and Linux system call errors. This will make your application's error messages much more informative to your users.

The library is not quite a drop-in replacement for strerror, but it comes close. Each system call has a dedicated libexplain function, for example

fd = open(path, flags, mode);
if (fd < 0)
{
    fprintf(stderr, "%s\n", explain_open(path, flags, mode));
    exit(EXIT_FAILURE);
}

‘I think it's totally awesome, in the category of “why hasn't this existed for n years” awesome.’ — Parker san
If, for example, you were to try to open no-such-dir/some-file, you would see a message like
open(pathname = "no-such-dir/some-file", flags = O_RDONLY) failed, No such file or directory (2, ENOENT) because there is no "no-such-dir" directory in the current directory

The good news is that for each of these functions there is a wrapper function, in this case explain_open_or_die(3), that includes the above code fragment. Adding good error reporting is as simple as using a different, but similarly named, function. The library also provides thread safe variants of each explanation function.

The coverage for system calls is being improved all the time, as you can see from this documentation page generated from the source code. Coverage includes 221 system calls and 547 ioctl requests.

Documentation


Download

“pmiller read the kernel source so you don't have to” — Rob Weir
There are several ways you can obtain the software, as either source code or pre-compiled binaries.

[*] Master Sources

The following files are available for download from this web site:

File Description
libexplain-1.4.D001.README The README file form the tarball.
libexplain-1.4.D001.tar.gz The complete source.
libexplain-1.4.D001.pdf The reference manual, in PDF format.


[*] Sourceforge Downloads


[*] Ubuntu Packages

If you use Ubuntu Linux, there are pre-built packages available for installation using the normal sudo apt-get install method, from this package archive (PPA).

Instructions are available there for how to manually add the PPA to your /etc/apt/sources.list file, but the following commands are sufficient on recent versions of Ubuntu:

sudo add-apt-repository ppa:pmiller-opensource/ppa
sudo apt-get update
sudo apt-get install libexplain-dev


[*] Debian Packages


[*] Aegis
  • Libexplain is developed using Aegis DVCS
  • The Aegis repository for this project is available.
  • The complete source is available in aedist(1) format.

Services provided by SourceForge

Services provided by Debian


Libexplain is written and owned by Peter Miller <pmiller@opensource.org.au> and is freely distributable under the terms and conditions of the GNU LGPL, so you may use libexplain with proprietary programs. There is more Software by Peter Miller at his home page.

SourceForge.net Logo This page is hosted by SourceForge.
This page has been accessed approximately number times since 3-Mar-2014.