[K42-discussion] Small Error Code script (was: Allocating error codes)
Robert Wisniewski
bob at watson.ibm.com
Sun Sep 17 01:22:58 EST 2006
I used to occasionally go through and fix repeated error codes and make
sure they were all unique, but I didn't defragment. I guess it's been a
while since I've done this. But anyone who feels so inclined should feel
free, especially if you wind up stumbling across one in debugging.
-bob
Robert Wisniewski
K42 MP OS, CPO, and CSO Projects
Advanced Operating Systems
IBM T.J. Watson Research Center
914-945-3181
http://www.research.ibm.com/K42/
bob at watson.ibm.com
----
Livio Soares writes:
> Hi Patrick,
>
> In actuality, there are tons of error code numbers to choose from, without
> needing the IBM allocator. The trick is: take of advantage of the fact that K42
> sometimes leaks ;-P
>
> The following script might be of some interest to people on the list. It uses
> some GNU tools such as bash, grep, cut, sort; hopefully will work for everyone.
>
> Usage:
>
> k42_error_codes.sh kitchsrc-directory
>
> Output:
>
> STDOUT: A list of code numbers which have leaked and should be currently
> available for use
>
> STDERR: Tags of two forms:
>
> 1) "Strange error code: " + code number
> These are code numbers outside the [1000 - 10000] range.
>
> 2) "REPEAT: " + code number
> These are code numbers which show up more than once.
>
>
> Caveat: This script does not distinguish uncommented from commented code,
> hence:
> a) There might be _more_ unused codes than it detects (but it
> should never report a used error code)
> b) The "REPEAT:" and "Strange error code:" tags could be reporting
> invalid information.
>
>
> Some useful numbers from the git tree:
>
> $ ./k42_error_codes.sh ./kitchsrc/ 2> /dev/null | wc
> 966 966 4830
>
> So; there are 966 unused/leaked error code to choose from.
>
> $ ./k42_error_codes.sh ./kitchsrc/ 2>&1 | grep ^REPEAT | wc
> 99 198 1287
>
> There are 99 occurrences of repeated error codes! :-(
>
>
> I hope this is useful,
>
> Livio
> _______________________________________________
> K42-discussion mailing list
> K42-discussion at ozlabs.org
> https://ozlabs.org/mailman/listinfo/k42-discussion
More information about the K42-discussion
mailing list