Note that there are some explanatory texts on larger screens.

plurals
  1. POstrerror-like functionality in the kernel?
    primarykey
    data
    text
    <p>Is there any <code>strerror</code>-like functionality currently in the kernel? I haven't been able to find one so my thought is no, but more importantly, has their been any discussion about this? I would think it could reduce troubleshooting time, since you wont have to look up error codes (which not everybody has memorized) and possibly make things a bit easier for system administrators and normal ever-day users (via <code>dmesg</code>).</p> <p>I wanted to ask here before mailing the LKML. My thoughts were for a dual mechanism, one for the error name (e.g., <code>EINVAL</code>) and another for the description. Further, the <code>%m</code> glibc extension could be added to printk, except that it would have to read a error code since the glibc extension reads <code>errno</code>. Perhaps <code>%m</code> could print the error name while <code>%M</code> could print the error description?</p> <p>Anyway, if it is added, it should be a .config option since it will bloat the text size. The size can be shrunk by just storing the error names (1 through 133 currently) in a single string with a null terminator between each string and just a slow <code>strerror</code> (forced to iterate through the string and count null-terminators), since the speed of this shouldn't matter. Internal errors 512-529 would have to be in a separate string. Then, a direct pointer to the null-terminated string could be returned with no need to copy anything. By my calculations, this would take roughly 1322 bytes for the error names and 3540 bytes for the descriptions (based upon what are now in comments after each error's #define and adding "no description" for those that are currently missing one).</p> <p>Then, when config-disabled, the printk <code>%m</code> could just be interpreted as <code>%d</code> and <code>%M</code> could just print nothing (or some such).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload