Home > Software engineering >  Number of all system errors
Number of all system errors

Time:10-07

How can I, using e.g. errno, in C, obtain the number of all system errors (about 130)? I have no idea at all how I can do this...

I searched for information in man, but it did not give anything

CodePudding user response:

Theoretically, you've got all of them in the links below (errno sources):

https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/errno-base.h https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/errno.h AFAIK there is no array that contains all of them that you could take the length of.

CodePudding user response:

Perl works:

perl -e 'for $i (1..150) {$!=$i; print $i." ".$!."\n";}'  |grep -cv 'Unknown [eE]rror'
131

Seems to be about 131 on Linux, and 187 on Cygwin.

  •  Tags:  
  • c
  • Related