libexplain 1.4

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

", 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

no-such-dir/some-file

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

The LCA 2010 talk, “ No medium found: when it's time to stop trying to read strerror's mind ” is a available as PDF, and the slides are available as HTML.

” is a available as PDF, and the slides are available as HTML. There is full documentation of all API functions. This is the interface users of the library may use.

There is full documentation of all internal functions. This includes all of the functions internal to the library, for libexplain developers to use.

The above documentation is generated from the source files, via Doxygen.

Want to help? Here is a list of places in the source code marked “FIXME”.

Download

“pmiller read the kernel source so you don't have to” — Rob Weir

Services provided by SourceForge

Services provided by Debian