Error Codes

This page describes the error codes used in the various Shore Storage Manager modules.

These numbers are generated by the Perl script

 tools/errors.pl

This page is of interest to those who wish to use this tool to generate their own sets of error codes.

Error Codes and Modules

Error codes are unsigned integers. Each error code has associated metadata, which consists of a descriptive string and a name (either by way of an enumeration, or by a C-preprocessor-defined name).

The integer values associated with error code names, the descriptive strings, the enumerations, and the C Preprocessor macros are generated by the Perl script. Error codes are grouped into modules, so that all the error codes for a software module and their metadata are kept together. Each module is given a mask, which is folded into the values assigned to the errorcodes. This keeps the error codes for different software modules distinct. The software that manages error codes keeps a (global) list of all the modules of error codes. Each software layer that uses the error codes must invoke a method to `install' its module in the global list, preferably at server start-up time, in the main thread, using w_error_t::insert, which is called by a Perl-generated method <class>init_errorcodes();-

Generating Sets of Error Codes

Generating the codes is best described by way of an example. The following example is taken from the Shore Storage Manager.

The script takes one of two mutually exclusive options, and a file name. One or the other of the options (-d, -e) is required:

 $(SHORE_SOURCES)/tools/errors.pl -d <input-file>
    or
 $(SHORE_SOURCES)/tools/errors.pl -e <input-file>

In the first case (-d) the named constants are generated as C preprocessor defined constants. The prefix of the generated names is capitalized and separated from the rest of the name by an underscore character.

In the second case (-e) the named constants are generated as members of an anonymous enumeration. The prefix of the generated names is taken, case unchanged, from the input file.

 e = 0x00080000 "Storage Manager" smlevel_0 {
 
 ASSERT          Assertion failed
 USERABORT       User initiated abort
 ... and so on ...
 }

The input is parsed as follows. On the first line:

Blank lines may appear anywhere. Lines beginning with # are comments.

Generated Files

The names of the files generated contain the prefix given on the first line of the module's input. In the above example, that prefix is e.

The set of files generated is determined by the arguments with which the script is invoked:

errors.pl -d <file> :

errors.pl -e <file> :


Generated on Wed Jul 7 17:22:33 2010 for Shore Storage Manager by  doxygen 1.4.7