From a7e40a99318c46ec57a9c0a64c622b6ec0ed89ff Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 6 Jul 2021 22:10:53 -0400 Subject: [PATCH] sim: nltvals: pull target errno out into a dedicated source file The current system maintains a list of target errno constants in the nltvals.def file, then runs a build-time tool to turn that into a C file. This list of errno values is the same for all arches, so we don't need the arch-specific flexibility. Further, these are only for newlib/libgloss environments, which makes it confusing to support other userland runtimes (like Linux). Let's simplify to make this easier to understand & build. We don't namespace the variables yet, but sets up the framework for it. Create a new target-newlib-errno.c template file. The template file is hand written, but the inline map is still automatically generated. This allows us to move it to the common set of objects so it's only built once in a multi-target build. Now we can remove the output from the gentmap build-time tool since it's checked into the tree. Then we stop including the errno lists in nltvals.def since nothing uses it. --- sim/Makefile.in | 19 ++ sim/common/Make-common.in | 1 + sim/common/gennltvals.py | 109 ++++++++---- sim/common/gentmap.c | 20 --- sim/common/local.mk | 1 + sim/common/nltvals.def | 92 ---------- sim/common/target-newlib-errno.c | 289 +++++++++++++++++++++++++++++++ 7 files changed, 384 insertions(+), 147 deletions(-) create mode 100644 sim/common/target-newlib-errno.c diff --git a/sim/Makefile.in b/sim/Makefile.in index 7644a43c0ac..e0be7cfb338 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -253,6 +253,7 @@ am__dirstamp = $(am__leading_dot)dirstamp am_common_libcommon_a_OBJECTS = \ common/common_libcommon_a-portability.$(OBJEXT) \ common/common_libcommon_a-sim-load.$(OBJEXT) \ + common/common_libcommon_a-target-newlib-errno.$(OBJEXT) \ common/common_libcommon_a-version.$(OBJEXT) common_libcommon_a_OBJECTS = $(am_common_libcommon_a_OBJECTS) igen_libigen_a_AR = $(AR) $(ARFLAGS) @@ -843,6 +844,7 @@ common_libcommon_a_CPPFLAGS = \ common_libcommon_a_SOURCES = \ common/portability.c \ common/sim-load.c \ + common/target-newlib-errno.c \ common/version.c @SIM_ENABLE_IGEN_TRUE@igen_libigen_a_SOURCES = \ @@ -1015,6 +1017,8 @@ common/common_libcommon_a-portability.$(OBJEXT): \ common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp) common/common_libcommon_a-sim-load.$(OBJEXT): common/$(am__dirstamp) \ common/$(DEPDIR)/$(am__dirstamp) +common/common_libcommon_a-target-newlib-errno.$(OBJEXT): \ + common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp) common/common_libcommon_a-version.$(OBJEXT): common/$(am__dirstamp) \ common/$(DEPDIR)/$(am__dirstamp) @@ -1137,6 +1141,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/common_libcommon_a-portability.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/common_libcommon_a-sim-load.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/common_libcommon_a-version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@igen/$(DEPDIR)/filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@igen/$(DEPDIR)/filter_host.Po@am__quote@ @@ -1215,6 +1220,20 @@ common/common_libcommon_a-sim-load.obj: common/sim-load.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common/common_libcommon_a-sim-load.obj `if test -f 'common/sim-load.c'; then $(CYGPATH_W) 'common/sim-load.c'; else $(CYGPATH_W) '$(srcdir)/common/sim-load.c'; fi` +common/common_libcommon_a-target-newlib-errno.o: common/target-newlib-errno.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common/common_libcommon_a-target-newlib-errno.o -MD -MP -MF common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Tpo -c -o common/common_libcommon_a-target-newlib-errno.o `test -f 'common/target-newlib-errno.c' || echo '$(srcdir)/'`common/target-newlib-errno.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Tpo common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/target-newlib-errno.c' object='common/common_libcommon_a-target-newlib-errno.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common/common_libcommon_a-target-newlib-errno.o `test -f 'common/target-newlib-errno.c' || echo '$(srcdir)/'`common/target-newlib-errno.c + +common/common_libcommon_a-target-newlib-errno.obj: common/target-newlib-errno.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common/common_libcommon_a-target-newlib-errno.obj -MD -MP -MF common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Tpo -c -o common/common_libcommon_a-target-newlib-errno.obj `if test -f 'common/target-newlib-errno.c'; then $(CYGPATH_W) 'common/target-newlib-errno.c'; else $(CYGPATH_W) '$(srcdir)/common/target-newlib-errno.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Tpo common/$(DEPDIR)/common_libcommon_a-target-newlib-errno.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/target-newlib-errno.c' object='common/common_libcommon_a-target-newlib-errno.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common/common_libcommon_a-target-newlib-errno.obj `if test -f 'common/target-newlib-errno.c'; then $(CYGPATH_W) 'common/target-newlib-errno.c'; else $(CYGPATH_W) '$(srcdir)/common/target-newlib-errno.c'; fi` + common/common_libcommon_a-version.o: common/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(common_libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common/common_libcommon_a-version.o -MD -MP -MF common/$(DEPDIR)/common_libcommon_a-version.Tpo -c -o common/common_libcommon_a-version.o `test -f 'common/version.c' || echo '$(srcdir)/'`common/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) common/$(DEPDIR)/common_libcommon_a-version.Tpo common/$(DEPDIR)/common_libcommon_a-version.Po diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index cdad4a53d4b..5db835713e7 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -231,6 +231,7 @@ EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \ COMMON_OBJS_NAMES = \ portability.o \ sim-load.o \ + target-newlib-errno.o \ version.o COMMON_OBJS = $(COMMON_OBJS_NAMES:%=../common/common_libcommon_a-%) diff --git a/sim/common/gennltvals.py b/sim/common/gennltvals.py index 955ace34311..3006f7f58fe 100755 --- a/sim/common/gennltvals.py +++ b/sim/common/gennltvals.py @@ -63,8 +63,43 @@ FILE_HEADER = f"""\ /* This file is machine generated by {PROG}. */\ """ +# Used to update sections of files. +START_MARKER = 'gennltvals: START' +END_MARKER = 'gennltvals: END' -def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, + +def extract_syms(cpp: str, srcdir: Path, + headers: Iterable[str], + pattern: str, + filter: str = r'^$') -> dict: + """Extract all the symbols from |headers| matching |pattern| using |cpp|.""" + srcfile = ''.join(f'#include <{x}>\n' for x in headers) + syms = set() + define_pattern = re.compile(r'^#\s*define\s+(' + pattern + ')') + filter_pattern = re.compile(filter) + for header in headers: + with open(srcdir / header, 'r', encoding='utf-8') as fp: + data = fp.read() + for line in data.splitlines(): + m = define_pattern.match(line) + if m and not filter_pattern.search(line): + syms.add(m.group(1)) + for sym in syms: + srcfile += f'#ifdef {sym}\nDEFVAL "{sym}" {sym}\n#endif\n' + + result = subprocess.run( + f'{cpp} -E -I"{srcdir}" -', shell=True, check=True, encoding='utf-8', + input=srcfile, capture_output=True) + ret = {} + for line in result.stdout.splitlines(): + if line.startswith('DEFVAL '): + _, sym, val = line.split() + ret[sym.strip('"')] = val + return ret + + +def gentvals(output_dir: Path, output: TextIO, + cpp: str, srctype: str, srcdir: Path, headers: Iterable[str], pattern: str, filter: str = r'^$', @@ -80,6 +115,29 @@ def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, fullpath = srcdir / header assert fullpath.exists(), f'{fullpath} does not exist' + syms = extract_syms(cpp, srcdir, headers, pattern, filter) + + # If we have a map file, use it directly. + target_map = output_dir / f'target-newlib-{srctype}.c' + if target_map.exists(): + old_lines = target_map.read_text().splitlines() + start_i = end_i = None + for i, line in enumerate(old_lines): + if START_MARKER in line: + start_i = i + if END_MARKER in line: + end_i = i + assert start_i and end_i + new_lines = old_lines[0:start_i + 1] + new_lines.extend( + f'#ifdef {sym}\n' + f' {{ "{sym}", {sym}, {val} }},\n' + f'#endif' for sym, val in sorted(syms.items())) + new_lines.extend(old_lines[end_i:]) + target_map.write_text('\n'.join(new_lines) + '\n') + return + + # Fallback to classic nltvals.def. if target is not None: print(f'#ifdef NL_TARGET_{target}', file=output) print(f'#ifdef {srctype}_defs', file=output) @@ -91,27 +149,8 @@ def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, else: print(f'/* begin {target} {srctype} target macros */', file=output) - # Extract all the symbols. - srcfile = ''.join(f'#include <{x}>\n' for x in headers) - syms = set() - define_pattern = re.compile(r'^#\s*define\s+(' + pattern + ')') - filter_pattern = re.compile(filter) - for header in headers: - with open(srcdir / header, 'r', encoding='utf-8') as fp: - data = fp.read() - for line in data.splitlines(): - m = define_pattern.match(line) - if m and not filter_pattern.search(line): - syms.add(m.group(1)) - for sym in sorted(syms): - srcfile += f'#ifdef {sym}\nDEFVAL {{ "{sym}", {sym} }},\n#endif\n' - - result = subprocess.run( - f'{cpp} -E -I"{srcdir}" -', shell=True, check=True, encoding='utf-8', - input=srcfile, capture_output=True) - for line in result.stdout.splitlines(): - if line.startswith('DEFVAL '): - print(line[6:].rstrip(), file=output) + for sym, val in sorted(syms.items()): + print(f' {{ "{sym}", {val} }},', file=output) print(f'#undef {srctype}_defs', file=output) if target is None: @@ -122,37 +161,37 @@ def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, print('#endif', file=output) -def gen_common(output: TextIO, newlib: Path, cpp: str): +def gen_common(output_dir: Path, output: TextIO, newlib: Path, cpp: str): """Generate the common C library constants. No arch should override these. """ - gentvals(output, cpp, 'errno', newlib / 'newlib/libc/include', + gentvals(output_dir, output, cpp, 'errno', newlib / 'newlib/libc/include', ('errno.h', 'sys/errno.h'), 'E[A-Z0-9]*') - gentvals(output, cpp, 'signal', newlib / 'newlib/libc/include', + gentvals(output_dir, output, cpp, 'signal', newlib / 'newlib/libc/include', ('signal.h', 'sys/signal.h'), r'SIG[A-Z0-9]*', filter=r'SIGSTKSZ') - gentvals(output, cpp, 'open', newlib / 'newlib/libc/include', + gentvals(output_dir, output, cpp, 'open', newlib / 'newlib/libc/include', ('fcntl.h', 'sys/fcntl.h', 'sys/_default_fcntl.h'), r'O_[A-Z0-9]*') -def gen_targets(output: TextIO, newlib: Path, cpp: str): +def gen_targets(output_dir: Path, output: TextIO, newlib: Path, cpp: str): """Generate the target-specific lists.""" for target, subdir in sorted(TARGET_DIRS.items()): - gentvals(output, cpp, 'sys', newlib / subdir, ('syscall.h',), - r'SYS_[_a-zA-Z0-9]*', target=target) + gentvals(output_dir, output, cpp, 'sys', newlib / subdir, + ('syscall.h',), r'SYS_[_a-zA-Z0-9]*', target=target) # Then output the common syscall targets. - gentvals(output, cpp, 'sys', newlib / 'libgloss', ('syscall.h',), - r'SYS_[_a-zA-Z0-9]*') + gentvals(output_dir, output, cpp, 'sys', newlib / 'libgloss', + ('syscall.h',), r'SYS_[_a-zA-Z0-9]*') -def gen(output: TextIO, newlib: Path, cpp: str): +def gen(output_dir: Path, output: TextIO, newlib: Path, cpp: str): """Generate all the things!""" print(FILE_HEADER, file=output) - gen_common(output, newlib, cpp) - gen_targets(output, newlib, cpp) + gen_common(output_dir, output, newlib, cpp) + gen_targets(output_dir, output, newlib, cpp) def get_parser() -> argparse.ArgumentParser: @@ -212,7 +251,7 @@ def main(argv: List[str]) -> int: output = (opts.output / 'nltvals.def').open('w', encoding='utf-8') - gen(output, opts.newlib, opts.cpp) + gen(opts.output, output, opts.newlib, opts.cpp) return 0 diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c index 9f30e66e378..8e6e3aeda32 100644 --- a/sim/common/gentmap.c +++ b/sim/common/gentmap.c @@ -16,13 +16,6 @@ static struct tdefs sys_tdefs[] = { { 0, 0 } }; -static struct tdefs errno_tdefs[] = { -#define errno_defs -#include "nltvals.def" -#undef errno_defs - { 0, 0 } -}; - static struct tdefs signal_tdefs[] = { #define signal_defs #include "nltvals.def" @@ -75,7 +68,6 @@ gen_targ_map_c (void) printf ("/* This file is machine generated by gentmap.c. */\n\n"); printf ("#include \"defs.h\"\n"); - printf ("#include \n"); printf ("#include \n"); printf ("#include \n"); printf ("#include \"ansidecl.h\"\n"); @@ -95,18 +87,6 @@ gen_targ_map_c (void) printf (" { 0, -1, -1 }\n"); printf ("};\n\n"); - printf ("/* errno mapping table */\n"); - printf ("CB_TARGET_DEFS_MAP cb_init_errno_map[] = {\n"); - for (t = &errno_tdefs[0]; t->symbol; ++t) - { - printf ("#define TARGET_%s %d\n", t->symbol, t->value); - printf ("#ifdef %s\n", t->symbol); - printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol); - printf ("#endif\n"); - } - printf (" { 0, 0, 0 }\n"); - printf ("};\n\n"); - printf ("/* signals mapping table */\n"); printf ("CB_TARGET_DEFS_MAP cb_init_signal_map[] = {\n"); for (t = &signal_tdefs[0]; t->symbol; ++t) diff --git a/sim/common/local.mk b/sim/common/local.mk index 25c7e5beb1f..71a931715c2 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -36,6 +36,7 @@ noinst_LIBRARIES += %D%/libcommon.a %C%_libcommon_a_SOURCES = \ %D%/portability.c \ %D%/sim-load.c \ + %D%/target-newlib-errno.c \ %D%/version.c %D%/version.c: %D%/version.c-stamp ; @true diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def index 8bc6ae59026..5e72e596ee8 100644 --- a/sim/common/nltvals.def +++ b/sim/common/nltvals.def @@ -1,97 +1,5 @@ /* Newlib/libgloss macro values needed by remote target support. */ /* This file is machine generated by gennltvals.py. */ -#ifdef errno_defs -/* from errno.h */ -/* from sys/errno.h */ -/* begin errno target macros */ - { "E2BIG", 7 }, - { "EACCES", 13 }, - { "EADDRINUSE", 112 }, - { "EADDRNOTAVAIL", 125 }, - { "EAFNOSUPPORT", 106 }, - { "EAGAIN", 11 }, - { "EALREADY", 120 }, - { "EBADF", 9 }, - { "EBADMSG", 77 }, - { "EBUSY", 16 }, - { "ECANCELED", 140 }, - { "ECHILD", 10 }, - { "ECONNABORTED", 113 }, - { "ECONNREFUSED", 111 }, - { "ECONNRESET", 104 }, - { "EDEADLK", 45 }, - { "EDESTADDRREQ", 121 }, - { "EDOM", 33 }, - { "EDQUOT", 132 }, - { "EEXIST", 17 }, - { "EFAULT", 14 }, - { "EFBIG", 27 }, - { "EFTYPE", 79 }, - { "EHOSTDOWN", 117 }, - { "EHOSTUNREACH", 118 }, - { "EIDRM", 36 }, - { "EILSEQ", 138 }, - { "EINPROGRESS", 119 }, - { "EINTR", 4 }, - { "EINVAL", 22 }, - { "EIO", 5 }, - { "EISCONN", 127 }, - { "EISDIR", 21 }, - { "ELOOP", 92 }, - { "EMFILE", 24 }, - { "EMLINK", 31 }, - { "EMSGSIZE", 122 }, - { "EMULTIHOP", 74 }, - { "ENAMETOOLONG", 91 }, - { "ENETDOWN", 115 }, - { "ENETRESET", 126 }, - { "ENETUNREACH", 114 }, - { "ENFILE", 23 }, - { "ENOBUFS", 105 }, - { "ENODATA", 61 }, - { "ENODEV", 19 }, - { "ENOENT", 2 }, - { "ENOEXEC", 8 }, - { "ENOLCK", 46 }, - { "ENOLINK", 67 }, - { "ENOMEM", 12 }, - { "ENOMSG", 35 }, - { "ENOPROTOOPT", 109 }, - { "ENOSPC", 28 }, - { "ENOSR", 63 }, - { "ENOSTR", 60 }, - { "ENOSYS", 88 }, - { "ENOTCONN", 128 }, - { "ENOTDIR", 20 }, - { "ENOTEMPTY", 90 }, - { "ENOTRECOVERABLE", 141 }, - { "ENOTSOCK", 108 }, - { "ENOTSUP", 134 }, - { "ENOTTY", 25 }, - { "ENXIO", 6 }, - { "EOPNOTSUPP", 95 }, - { "EOVERFLOW", 139 }, - { "EOWNERDEAD", 142 }, - { "EPERM", 1 }, - { "EPFNOSUPPORT", 96 }, - { "EPIPE", 32 }, - { "EPROTO", 71 }, - { "EPROTONOSUPPORT", 123 }, - { "EPROTOTYPE", 107 }, - { "ERANGE", 34 }, - { "EROFS", 30 }, - { "ESPIPE", 29 }, - { "ESRCH", 3 }, - { "ESTALE", 133 }, - { "ETIME", 62 }, - { "ETIMEDOUT", 116 }, - { "ETOOMANYREFS", 129 }, - { "ETXTBSY", 26 }, - { "EWOULDBLOCK", 11 }, - { "EXDEV", 18 }, -#undef errno_defs -/* end errno target macros */ -#endif #ifdef signal_defs /* from signal.h */ /* from sys/signal.h */ diff --git a/sim/common/target-newlib-errno.c b/sim/common/target-newlib-errno.c new file mode 100644 index 00000000000..af223afebef --- /dev/null +++ b/sim/common/target-newlib-errno.c @@ -0,0 +1,289 @@ +/* Target errno mappings for newlib/libgloss environment. + Copyright 1995-2021 Free Software Foundation, Inc. + Contributed by Mike Frysinger. + + This file is part of simulators. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This must come before any other includes. */ +#include "defs.h" + +#include + +#include "sim/callback.h" + +/* This file is kept up-to-date via the gennltvals.py script. Do not edit + anything between the START & END comment blocks below. */ + +CB_TARGET_DEFS_MAP cb_init_errno_map[] = { + /* gennltvals: START */ +#ifdef E2BIG + { "E2BIG", E2BIG, 7 }, +#endif +#ifdef EACCES + { "EACCES", EACCES, 13 }, +#endif +#ifdef EADDRINUSE + { "EADDRINUSE", EADDRINUSE, 112 }, +#endif +#ifdef EADDRNOTAVAIL + { "EADDRNOTAVAIL", EADDRNOTAVAIL, 125 }, +#endif +#ifdef EAFNOSUPPORT + { "EAFNOSUPPORT", EAFNOSUPPORT, 106 }, +#endif +#ifdef EAGAIN + { "EAGAIN", EAGAIN, 11 }, +#endif +#ifdef EALREADY + { "EALREADY", EALREADY, 120 }, +#endif +#ifdef EBADF + { "EBADF", EBADF, 9 }, +#endif +#ifdef EBADMSG + { "EBADMSG", EBADMSG, 77 }, +#endif +#ifdef EBUSY + { "EBUSY", EBUSY, 16 }, +#endif +#ifdef ECANCELED + { "ECANCELED", ECANCELED, 140 }, +#endif +#ifdef ECHILD + { "ECHILD", ECHILD, 10 }, +#endif +#ifdef ECONNABORTED + { "ECONNABORTED", ECONNABORTED, 113 }, +#endif +#ifdef ECONNREFUSED + { "ECONNREFUSED", ECONNREFUSED, 111 }, +#endif +#ifdef ECONNRESET + { "ECONNRESET", ECONNRESET, 104 }, +#endif +#ifdef EDEADLK + { "EDEADLK", EDEADLK, 45 }, +#endif +#ifdef EDESTADDRREQ + { "EDESTADDRREQ", EDESTADDRREQ, 121 }, +#endif +#ifdef EDOM + { "EDOM", EDOM, 33 }, +#endif +#ifdef EDQUOT + { "EDQUOT", EDQUOT, 132 }, +#endif +#ifdef EEXIST + { "EEXIST", EEXIST, 17 }, +#endif +#ifdef EFAULT + { "EFAULT", EFAULT, 14 }, +#endif +#ifdef EFBIG + { "EFBIG", EFBIG, 27 }, +#endif +#ifdef EFTYPE + { "EFTYPE", EFTYPE, 79 }, +#endif +#ifdef EHOSTDOWN + { "EHOSTDOWN", EHOSTDOWN, 117 }, +#endif +#ifdef EHOSTUNREACH + { "EHOSTUNREACH", EHOSTUNREACH, 118 }, +#endif +#ifdef EIDRM + { "EIDRM", EIDRM, 36 }, +#endif +#ifdef EILSEQ + { "EILSEQ", EILSEQ, 138 }, +#endif +#ifdef EINPROGRESS + { "EINPROGRESS", EINPROGRESS, 119 }, +#endif +#ifdef EINTR + { "EINTR", EINTR, 4 }, +#endif +#ifdef EINVAL + { "EINVAL", EINVAL, 22 }, +#endif +#ifdef EIO + { "EIO", EIO, 5 }, +#endif +#ifdef EISCONN + { "EISCONN", EISCONN, 127 }, +#endif +#ifdef EISDIR + { "EISDIR", EISDIR, 21 }, +#endif +#ifdef ELOOP + { "ELOOP", ELOOP, 92 }, +#endif +#ifdef EMFILE + { "EMFILE", EMFILE, 24 }, +#endif +#ifdef EMLINK + { "EMLINK", EMLINK, 31 }, +#endif +#ifdef EMSGSIZE + { "EMSGSIZE", EMSGSIZE, 122 }, +#endif +#ifdef EMULTIHOP + { "EMULTIHOP", EMULTIHOP, 74 }, +#endif +#ifdef ENAMETOOLONG + { "ENAMETOOLONG", ENAMETOOLONG, 91 }, +#endif +#ifdef ENETDOWN + { "ENETDOWN", ENETDOWN, 115 }, +#endif +#ifdef ENETRESET + { "ENETRESET", ENETRESET, 126 }, +#endif +#ifdef ENETUNREACH + { "ENETUNREACH", ENETUNREACH, 114 }, +#endif +#ifdef ENFILE + { "ENFILE", ENFILE, 23 }, +#endif +#ifdef ENOBUFS + { "ENOBUFS", ENOBUFS, 105 }, +#endif +#ifdef ENODATA + { "ENODATA", ENODATA, 61 }, +#endif +#ifdef ENODEV + { "ENODEV", ENODEV, 19 }, +#endif +#ifdef ENOENT + { "ENOENT", ENOENT, 2 }, +#endif +#ifdef ENOEXEC + { "ENOEXEC", ENOEXEC, 8 }, +#endif +#ifdef ENOLCK + { "ENOLCK", ENOLCK, 46 }, +#endif +#ifdef ENOLINK + { "ENOLINK", ENOLINK, 67 }, +#endif +#ifdef ENOMEM + { "ENOMEM", ENOMEM, 12 }, +#endif +#ifdef ENOMSG + { "ENOMSG", ENOMSG, 35 }, +#endif +#ifdef ENOPROTOOPT + { "ENOPROTOOPT", ENOPROTOOPT, 109 }, +#endif +#ifdef ENOSPC + { "ENOSPC", ENOSPC, 28 }, +#endif +#ifdef ENOSR + { "ENOSR", ENOSR, 63 }, +#endif +#ifdef ENOSTR + { "ENOSTR", ENOSTR, 60 }, +#endif +#ifdef ENOSYS + { "ENOSYS", ENOSYS, 88 }, +#endif +#ifdef ENOTCONN + { "ENOTCONN", ENOTCONN, 128 }, +#endif +#ifdef ENOTDIR + { "ENOTDIR", ENOTDIR, 20 }, +#endif +#ifdef ENOTEMPTY + { "ENOTEMPTY", ENOTEMPTY, 90 }, +#endif +#ifdef ENOTRECOVERABLE + { "ENOTRECOVERABLE", ENOTRECOVERABLE, 141 }, +#endif +#ifdef ENOTSOCK + { "ENOTSOCK", ENOTSOCK, 108 }, +#endif +#ifdef ENOTSUP + { "ENOTSUP", ENOTSUP, 134 }, +#endif +#ifdef ENOTTY + { "ENOTTY", ENOTTY, 25 }, +#endif +#ifdef ENXIO + { "ENXIO", ENXIO, 6 }, +#endif +#ifdef EOPNOTSUPP + { "EOPNOTSUPP", EOPNOTSUPP, 95 }, +#endif +#ifdef EOVERFLOW + { "EOVERFLOW", EOVERFLOW, 139 }, +#endif +#ifdef EOWNERDEAD + { "EOWNERDEAD", EOWNERDEAD, 142 }, +#endif +#ifdef EPERM + { "EPERM", EPERM, 1 }, +#endif +#ifdef EPFNOSUPPORT + { "EPFNOSUPPORT", EPFNOSUPPORT, 96 }, +#endif +#ifdef EPIPE + { "EPIPE", EPIPE, 32 }, +#endif +#ifdef EPROTO + { "EPROTO", EPROTO, 71 }, +#endif +#ifdef EPROTONOSUPPORT + { "EPROTONOSUPPORT", EPROTONOSUPPORT, 123 }, +#endif +#ifdef EPROTOTYPE + { "EPROTOTYPE", EPROTOTYPE, 107 }, +#endif +#ifdef ERANGE + { "ERANGE", ERANGE, 34 }, +#endif +#ifdef EROFS + { "EROFS", EROFS, 30 }, +#endif +#ifdef ESPIPE + { "ESPIPE", ESPIPE, 29 }, +#endif +#ifdef ESRCH + { "ESRCH", ESRCH, 3 }, +#endif +#ifdef ESTALE + { "ESTALE", ESTALE, 133 }, +#endif +#ifdef ETIME + { "ETIME", ETIME, 62 }, +#endif +#ifdef ETIMEDOUT + { "ETIMEDOUT", ETIMEDOUT, 116 }, +#endif +#ifdef ETOOMANYREFS + { "ETOOMANYREFS", ETOOMANYREFS, 129 }, +#endif +#ifdef ETXTBSY + { "ETXTBSY", ETXTBSY, 26 }, +#endif +#ifdef EWOULDBLOCK + { "EWOULDBLOCK", EWOULDBLOCK, 11 }, +#endif +#ifdef EXDEV + { "EXDEV", EXDEV, 18 }, +#endif + /* gennltvals: END */ + { NULL, -1, -1 }, +};