GNU C Library
In C one can use the error(3) function, provided in GNU by the GNU C Library.