1 # Updating Error Number Translations
   2 
   3 To create an updated error number translation table, you can use the
   4 `gen_errno` tool.  This tool requires, as input:
   5 
   6 * the illumos native `errno.h` file
   7 * a set of foreign operating system `errno.h` files
   8 
   9 The output is a set of translation table entries suitable for inclusion in a
  10 cstyled C array.  The index of the array is the native error number and the
  11 value at each index is the translated error number for use with the foreign
  12 operating system.
  13 
  14 ## Example
  15 
  16 To generate a translation table for the LX Brand, you will require two files
  17 from the current Linux source:
  18 
  19 * `include/uapi/asm-generic/errno-base.h` (low-valued, or base, error numbers)
  20 * `include/uapi/asm-generic/errno.h` (extended error numbers)
  21 
  22 Assuming the files are in the current directory, you should run the tool as
  23 follows:
  24 
  25     $ dmake
  26     ...
  27     $ ./gen_errno -F errno-base.h -F errno.h \
  28                   -N $SRC/uts/common/sys/errno.h
  29     0, /*  0: No Error                            */
  30     1, /*  1: EPERM       -->   1: EPERM          */
  31     2, /*  2: ENOENT      -->   2: ENOENT         */
  32     3, /*  3: ESRCH       -->   3: ESRCH          */
  33     4, /*  4: EINTR       -->   4: EINTR          */
  34     5, /*  5: EIO         -->   5: EIO            */
  35     6, /*  6: ENXIO       -->   6: ENXIO          */
  36     7, /*  7: E2BIG       -->   7: E2BIG          */
  37     ...
  38 
  39 The output may be used in the `$SRC/common/brand/lx/lx_errno.c` file.