sim: callback: add human readable strings for debugging to maps

When tracing, we often want to display the human readable name for the
various syscall/errno values.  Rather than make each target duplicate
the lookup, extend the existing maps to include the string directly,
and add helper functions to look up the constants.

While most targets are autogenerated (from libgloss), the bfin/cris
targets have custom maps for the Linux ABI which need to be updated
by hand.
This commit is contained in:
Mike Frysinger 2015-06-15 19:17:16 +05:45
parent 920467912a
commit 6362a3f875
9 changed files with 784 additions and 675 deletions

View File

@ -1,3 +1,10 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
* callback.h (CB_TARGET_DEFS_MAP): Add name member.
(cb_host_str_syscall, cb_host_str_errno, cb_host_str_signal,
cb_target_str_syscall, cb_target_str_errno, cb_target_str_signal):
Declare.
2015-03-28 James Bowman <james.bowman@ftdichip.com> 2015-03-28 James Bowman <james.bowman@ftdichip.com>
* sim-ft32.h: New file. * sim-ft32.h: New file.

View File

@ -59,6 +59,7 @@
name of the symbol. */ name of the symbol. */
typedef struct { typedef struct {
const char *name;
int host_val; int host_val;
int target_val; int target_val;
} CB_TARGET_DEFS_MAP; } CB_TARGET_DEFS_MAP;
@ -316,6 +317,14 @@ int cb_target_to_host_signal (host_callback *, int);
/* Translate host signal number to target. */ /* Translate host signal number to target. */
int cb_host_to_gdb_signal (host_callback *, int); int cb_host_to_gdb_signal (host_callback *, int);
/* Translate symbols into human readable strings. */
const char *cb_host_str_syscall (host_callback *, int);
const char *cb_host_str_errno (host_callback *, int);
const char *cb_host_str_signal (host_callback *, int);
const char *cb_target_str_syscall (host_callback *, int);
const char *cb_target_str_errno (host_callback *, int);
const char *cb_target_str_signal (host_callback *, int);
/* Translate host stat struct to target. /* Translate host stat struct to target.
If stat struct ptr is NULL, just compute target stat struct size. If stat struct ptr is NULL, just compute target stat struct size.
Result is size of target stat struct or 0 if error. */ Result is size of target stat struct or 0 if error. */

View File

@ -1,3 +1,10 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
* linux-targ-map.h: Update example comments.
(cb_linux_syscall_map): Fill out name field.
(cb_linux_errno_map, cb_linux_open_map, cb_linux_signal_map):
Likewise.
2015-06-12 Mike Frysinger <vapier@gentoo.org> 2015-06-12 Mike Frysinger <vapier@gentoo.org>
* interp.c: Expand comment on CB_SYS_xxx defines. * interp.c: Expand comment on CB_SYS_xxx defines.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,13 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
* callback.c (cb_target_map_entry, cb_host_map_entry): Define.
(cb_target_to_host_syscall): Rewrite to use cb_target_map_entry.
(cb_host_to_target_errno): Rewrite to use cb_host_map_entry.
(cb_host_str_syscall, cb_host_str_errno, cb_host_str_signal,
cb_target_str_syscall, cb_target_str_errno, cb_target_str_signal):
Define.
* gentmap.c (gen_targ_map_c): Output name field.
2015-06-12 Mike Frysinger <vapier@gentoo.org> 2015-06-12 Mike Frysinger <vapier@gentoo.org>
* acinclude.m4: Change configure.in to configure.ac. * acinclude.m4: Change configure.in to configure.ac.

View File

@ -796,6 +796,32 @@ cb_read_target_syscall_maps (host_callback *cb, const char *file)
return CB_RC_OK; return CB_RC_OK;
} }
/* General utility functions to search a map for a value. */
static const CB_TARGET_DEFS_MAP *
cb_target_map_entry (const CB_TARGET_DEFS_MAP map[], int target_val)
{
const CB_TARGET_DEFS_MAP *m;
for (m = &map[0]; map->target_val != -1; ++m)
if (m->target_val == target_val)
return m;
return NULL;
}
static const CB_TARGET_DEFS_MAP *
cb_host_map_entry (const CB_TARGET_DEFS_MAP map[], int host_val)
{
const CB_TARGET_DEFS_MAP *m;
for (m = &map[0]; map->host_val != -1; ++m)
if (m->host_val == host_val)
return m;
return NULL;
}
/* Translate the target's version of a syscall number to the host's. /* Translate the target's version of a syscall number to the host's.
This isn't actually the host's version, rather a canonical form. This isn't actually the host's version, rather a canonical form.
??? Perhaps this should be renamed to ..._canon_syscall. */ ??? Perhaps this should be renamed to ..._canon_syscall. */
@ -803,13 +829,10 @@ cb_read_target_syscall_maps (host_callback *cb, const char *file)
int int
cb_target_to_host_syscall (host_callback *cb, int target_val) cb_target_to_host_syscall (host_callback *cb, int target_val)
{ {
CB_TARGET_DEFS_MAP *m; const CB_TARGET_DEFS_MAP *m =
cb_target_map_entry (cb->syscall_map, target_val);
for (m = &cb->syscall_map[0]; m->target_val != -1; ++m) return m ? m->host_val : -1;
if (m->target_val == target_val)
return m->host_val;
return -1;
} }
/* FIXME: sort tables if large. /* FIXME: sort tables if large.
@ -821,16 +844,12 @@ cb_target_to_host_syscall (host_callback *cb, int target_val)
int int
cb_host_to_target_errno (host_callback *cb, int host_val) cb_host_to_target_errno (host_callback *cb, int host_val)
{ {
CB_TARGET_DEFS_MAP *m; const CB_TARGET_DEFS_MAP *m = cb_host_map_entry (cb->errno_map, host_val);
for (m = &cb->errno_map[0]; m->host_val; ++m)
if (m->host_val == host_val)
return m->target_val;
/* ??? Which error to return in this case is up for grabs. /* ??? Which error to return in this case is up for grabs.
Note that some missing values may have standard alternatives. Note that some missing values may have standard alternatives.
For now return 0 and require caller to deal with it. */ For now return 0 and require caller to deal with it. */
return 0; return m ? m->target_val : 0;
} }
/* Given a set of target bitmasks for the open system call, /* Given a set of target bitmasks for the open system call,
@ -1045,3 +1064,54 @@ cb_is_stderr (host_callback *cb, int fd)
{ {
return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 2; return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 2;
} }
const char *
cb_host_str_syscall (host_callback *cb, int host_val)
{
const CB_TARGET_DEFS_MAP *m = cb_host_map_entry (cb->syscall_map, host_val);
return m ? m->name : NULL;
}
const char *
cb_host_str_errno (host_callback *cb, int host_val)
{
const CB_TARGET_DEFS_MAP *m = cb_host_map_entry (cb->errno_map, host_val);
return m ? m->name : NULL;
}
const char *
cb_host_str_signal (host_callback *cb, int host_val)
{
const CB_TARGET_DEFS_MAP *m = cb_host_map_entry (cb->signal_map, host_val);
return m ? m->name : NULL;
}
const char *
cb_target_str_syscall (host_callback *cb, int target_val)
{
const CB_TARGET_DEFS_MAP *m =
cb_target_map_entry (cb->syscall_map, target_val);
return m ? m->name : NULL;
}
const char *
cb_target_str_errno (host_callback *cb, int target_val)
{
const CB_TARGET_DEFS_MAP *m =
cb_target_map_entry (cb->errno_map, target_val);
return m ? m->name : NULL;
}
const char *
cb_target_str_signal (host_callback *cb, int target_val)
{
const CB_TARGET_DEFS_MAP *m =
cb_target_map_entry (cb->signal_map, target_val);
return m ? m->name : NULL;
}

View File

@ -80,10 +80,11 @@ gen_targ_map_c (void)
for (t = &sys_tdefs[0]; t->symbol; ++t) for (t = &sys_tdefs[0]; t->symbol; ++t)
{ {
printf ("#ifdef CB_%s\n", t->symbol); printf ("#ifdef CB_%s\n", t->symbol);
printf (" { CB_%s, TARGET_%s },\n", t->symbol, t->symbol); /* Skip the "SYS_" prefix for the name. */
printf (" { \"%s\", CB_%s, TARGET_%s },\n", t->symbol + 4, t->symbol, t->symbol);
printf ("#endif\n"); printf ("#endif\n");
} }
printf (" { -1, -1 }\n"); printf (" { 0, -1, -1 }\n");
printf ("};\n\n"); printf ("};\n\n");
printf ("/* errno mapping table */\n"); printf ("/* errno mapping table */\n");
@ -91,10 +92,10 @@ gen_targ_map_c (void)
for (t = &errno_tdefs[0]; t->symbol; ++t) for (t = &errno_tdefs[0]; t->symbol; ++t)
{ {
printf ("#ifdef %s\n", t->symbol); printf ("#ifdef %s\n", t->symbol);
printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol); printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol);
printf ("#endif\n"); printf ("#endif\n");
} }
printf (" { 0, 0 }\n"); printf (" { 0, 0, 0 }\n");
printf ("};\n\n"); printf ("};\n\n");
printf ("/* open flags mapping table */\n"); printf ("/* open flags mapping table */\n");
@ -102,10 +103,10 @@ gen_targ_map_c (void)
for (t = &open_tdefs[0]; t->symbol; ++t) for (t = &open_tdefs[0]; t->symbol; ++t)
{ {
printf ("#ifdef %s\n", t->symbol); printf ("#ifdef %s\n", t->symbol);
printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol); printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol);
printf ("#endif\n"); printf ("#endif\n");
} }
printf (" { -1, -1 }\n"); printf (" { 0, -1, -1 }\n");
printf ("};\n\n"); printf ("};\n\n");
} }

View File

@ -1,3 +1,8 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
* traps.c (syscall_map): Fill out name field.
(syscall_stat32_map, errno_map, open_map): Likewise.
2015-06-12 Mike Frysinger <vapier@gentoo.org> 2015-06-12 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate. * configure: Regenerate.

View File

@ -263,21 +263,21 @@ static const char stat_map[] =
static const CB_TARGET_DEFS_MAP syscall_map[] = static const CB_TARGET_DEFS_MAP syscall_map[] =
{ {
{ CB_SYS_open, TARGET_SYS_open }, { "open", CB_SYS_open, TARGET_SYS_open },
{ CB_SYS_close, TARGET_SYS_close }, { "close", CB_SYS_close, TARGET_SYS_close },
{ CB_SYS_read, TARGET_SYS_read }, { "read", CB_SYS_read, TARGET_SYS_read },
{ CB_SYS_write, TARGET_SYS_write }, { "write", CB_SYS_write, TARGET_SYS_write },
{ CB_SYS_lseek, TARGET_SYS_lseek }, { "lseek", CB_SYS_lseek, TARGET_SYS_lseek },
{ CB_SYS_unlink, TARGET_SYS_unlink }, { "unlink", CB_SYS_unlink, TARGET_SYS_unlink },
{ CB_SYS_getpid, TARGET_SYS_getpid }, { "getpid", CB_SYS_getpid, TARGET_SYS_getpid },
{ CB_SYS_fstat, TARGET_SYS_fstat64 }, { "fstat", CB_SYS_fstat, TARGET_SYS_fstat64 },
{ CB_SYS_lstat, TARGET_SYS_lstat64 }, { "lstat", CB_SYS_lstat, TARGET_SYS_lstat64 },
{ CB_SYS_stat, TARGET_SYS_stat64 }, { "stat", CB_SYS_stat, TARGET_SYS_stat64 },
{ CB_SYS_pipe, TARGET_SYS_pipe }, { "pipe", CB_SYS_pipe, TARGET_SYS_pipe },
{ CB_SYS_rename, TARGET_SYS_rename }, { "rename", CB_SYS_rename, TARGET_SYS_rename },
{ CB_SYS_truncate, TARGET_SYS_truncate }, { "truncate", CB_SYS_truncate, TARGET_SYS_truncate },
{ CB_SYS_ftruncate, TARGET_SYS_ftruncate }, { "ftruncate", CB_SYS_ftruncate, TARGET_SYS_ftruncate },
{ 0, -1 } { 0, -1, -1 }
}; };
/* An older, 32-bit-only stat mapping. */ /* An older, 32-bit-only stat mapping. */
@ -290,9 +290,9 @@ static const char stat32_map[] =
newlib Linux mapping. */ newlib Linux mapping. */
static const CB_TARGET_DEFS_MAP syscall_stat32_map[] = static const CB_TARGET_DEFS_MAP syscall_stat32_map[] =
{ {
{ CB_SYS_fstat, TARGET_SYS_fstat }, { "fstat", CB_SYS_fstat, TARGET_SYS_fstat },
{ CB_SYS_stat, TARGET_SYS_stat }, { "stat", CB_SYS_stat, TARGET_SYS_stat },
{ 0, -1 } { 0, -1, -1 }
}; };
/* Giving the true value for the running sim process will lead to /* Giving the true value for the running sim process will lead to
@ -311,378 +311,378 @@ static const CB_TARGET_DEFS_MAP syscall_stat32_map[] =
static const CB_TARGET_DEFS_MAP errno_map[] = static const CB_TARGET_DEFS_MAP errno_map[] =
{ {
#ifdef EPERM #ifdef EPERM
{ EPERM, 1 }, { "EPERM", EPERM, 1 },
#endif #endif
#ifdef ENOENT #ifdef ENOENT
{ ENOENT, 2 }, { "ENOENT", ENOENT, 2 },
#endif #endif
#ifdef ESRCH #ifdef ESRCH
{ ESRCH, 3 }, { "ESRCH", ESRCH, 3 },
#endif #endif
#ifdef EINTR #ifdef EINTR
{ EINTR, 4 }, { "EINTR", EINTR, 4 },
#endif #endif
#ifdef EIO #ifdef EIO
{ EIO, 5 }, { "EIO", EIO, 5 },
#endif #endif
#ifdef ENXIO #ifdef ENXIO
{ ENXIO, 6 }, { "ENXIO", ENXIO, 6 },
#endif #endif
#ifdef E2BIG #ifdef E2BIG
{ E2BIG, 7 }, { "E2BIG", E2BIG, 7 },
#endif #endif
#ifdef ENOEXEC #ifdef ENOEXEC
{ ENOEXEC, 8 }, { "ENOEXEC", ENOEXEC, 8 },
#endif #endif
#ifdef EBADF #ifdef EBADF
{ EBADF, 9 }, { "EBADF", EBADF, 9 },
#endif #endif
#ifdef ECHILD #ifdef ECHILD
{ ECHILD, 10 }, { "ECHILD", ECHILD, 10 },
#endif #endif
#ifdef EAGAIN #ifdef EAGAIN
{ EAGAIN, 11 }, { "EAGAIN", EAGAIN, 11 },
#endif #endif
#ifdef ENOMEM #ifdef ENOMEM
{ ENOMEM, 12 }, { "ENOMEM", ENOMEM, 12 },
#endif #endif
#ifdef EACCES #ifdef EACCES
{ EACCES, 13 }, { "EACCES", EACCES, 13 },
#endif #endif
#ifdef EFAULT #ifdef EFAULT
{ EFAULT, 14 }, { "EFAULT", EFAULT, 14 },
#endif #endif
#ifdef ENOTBLK #ifdef ENOTBLK
{ ENOTBLK, 15 }, { "ENOTBLK", ENOTBLK, 15 },
#endif #endif
#ifdef EBUSY #ifdef EBUSY
{ EBUSY, 16 }, { "EBUSY", EBUSY, 16 },
#endif #endif
#ifdef EEXIST #ifdef EEXIST
{ EEXIST, 17 }, { "EEXIST", EEXIST, 17 },
#endif #endif
#ifdef EXDEV #ifdef EXDEV
{ EXDEV, 18 }, { "EXDEV", EXDEV, 18 },
#endif #endif
#ifdef ENODEV #ifdef ENODEV
{ ENODEV, 19 }, { "ENODEV", ENODEV, 19 },
#endif #endif
#ifdef ENOTDIR #ifdef ENOTDIR
{ ENOTDIR, 20 }, { "ENOTDIR", ENOTDIR, 20 },
#endif #endif
#ifdef EISDIR #ifdef EISDIR
{ EISDIR, 21 }, { "EISDIR", EISDIR, 21 },
#endif #endif
#ifdef EINVAL #ifdef EINVAL
{ EINVAL, 22 }, { "EINVAL", EINVAL, 22 },
#endif #endif
#ifdef ENFILE #ifdef ENFILE
{ ENFILE, 23 }, { "ENFILE", ENFILE, 23 },
#endif #endif
#ifdef EMFILE #ifdef EMFILE
{ EMFILE, 24 }, { "EMFILE", EMFILE, 24 },
#endif #endif
#ifdef ENOTTY #ifdef ENOTTY
{ ENOTTY, 25 }, { "ENOTTY", ENOTTY, 25 },
#endif #endif
#ifdef ETXTBSY #ifdef ETXTBSY
{ ETXTBSY, 26 }, { "ETXTBSY", ETXTBSY, 26 },
#endif #endif
#ifdef EFBIG #ifdef EFBIG
{ EFBIG, 27 }, { "EFBIG", EFBIG, 27 },
#endif #endif
#ifdef ENOSPC #ifdef ENOSPC
{ ENOSPC, 28 }, { "ENOSPC", ENOSPC, 28 },
#endif #endif
#ifdef ESPIPE #ifdef ESPIPE
{ ESPIPE, 29 }, { "ESPIPE", ESPIPE, 29 },
#endif #endif
#ifdef EROFS #ifdef EROFS
{ EROFS, 30 }, { "EROFS", EROFS, 30 },
#endif #endif
#ifdef EMLINK #ifdef EMLINK
{ EMLINK, 31 }, { "EMLINK", EMLINK, 31 },
#endif #endif
#ifdef EPIPE #ifdef EPIPE
{ EPIPE, 32 }, { "EPIPE", EPIPE, 32 },
#endif #endif
#ifdef EDOM #ifdef EDOM
{ EDOM, 33 }, { "EDOM", EDOM, 33 },
#endif #endif
#ifdef ERANGE #ifdef ERANGE
{ ERANGE, 34 }, { "ERANGE", ERANGE, 34 },
#endif #endif
#ifdef EDEADLK #ifdef EDEADLK
{ EDEADLK, 35 }, { "EDEADLK", EDEADLK, 35 },
#endif #endif
#ifdef ENAMETOOLONG #ifdef ENAMETOOLONG
{ ENAMETOOLONG, 36 }, { "ENAMETOOLONG", ENAMETOOLONG, 36 },
#endif #endif
#ifdef ENOLCK #ifdef ENOLCK
{ ENOLCK, 37 }, { "ENOLCK", ENOLCK, 37 },
#endif #endif
#ifdef ENOSYS #ifdef ENOSYS
{ ENOSYS, 38 }, { "ENOSYS", ENOSYS, 38 },
#endif #endif
#ifdef ENOTEMPTY #ifdef ENOTEMPTY
{ ENOTEMPTY, 39 }, { "ENOTEMPTY", ENOTEMPTY, 39 },
#endif #endif
#ifdef ELOOP #ifdef ELOOP
{ ELOOP, 40 }, { "ELOOP", ELOOP, 40 },
#endif #endif
#ifdef EWOULDBLOCK #ifdef EWOULDBLOCK
{ EWOULDBLOCK, 11 }, { "EWOULDBLOCK", EWOULDBLOCK, 11 },
#endif #endif
#ifdef ENOMSG #ifdef ENOMSG
{ ENOMSG, 42 }, { "ENOMSG", ENOMSG, 42 },
#endif #endif
#ifdef EIDRM #ifdef EIDRM
{ EIDRM, 43 }, { "EIDRM", EIDRM, 43 },
#endif #endif
#ifdef ECHRNG #ifdef ECHRNG
{ ECHRNG, 44 }, { "ECHRNG", ECHRNG, 44 },
#endif #endif
#ifdef EL2NSYNC #ifdef EL2NSYNC
{ EL2NSYNC, 45 }, { "EL2NSYNC", EL2NSYNC, 45 },
#endif #endif
#ifdef EL3HLT #ifdef EL3HLT
{ EL3HLT, 46 }, { "EL3HLT", EL3HLT, 46 },
#endif #endif
#ifdef EL3RST #ifdef EL3RST
{ EL3RST, 47 }, { "EL3RST", EL3RST, 47 },
#endif #endif
#ifdef ELNRNG #ifdef ELNRNG
{ ELNRNG, 48 }, { "ELNRNG", ELNRNG, 48 },
#endif #endif
#ifdef EUNATCH #ifdef EUNATCH
{ EUNATCH, 49 }, { "EUNATCH", EUNATCH, 49 },
#endif #endif
#ifdef ENOCSI #ifdef ENOCSI
{ ENOCSI, 50 }, { "ENOCSI", ENOCSI, 50 },
#endif #endif
#ifdef EL2HLT #ifdef EL2HLT
{ EL2HLT, 51 }, { "EL2HLT", EL2HLT, 51 },
#endif #endif
#ifdef EBADE #ifdef EBADE
{ EBADE, 52 }, { "EBADE", EBADE, 52 },
#endif #endif
#ifdef EBADR #ifdef EBADR
{ EBADR, 53 }, { "EBADR", EBADR, 53 },
#endif #endif
#ifdef EXFULL #ifdef EXFULL
{ EXFULL, 54 }, { "EXFULL", EXFULL, 54 },
#endif #endif
#ifdef ENOANO #ifdef ENOANO
{ ENOANO, 55 }, { "ENOANO", ENOANO, 55 },
#endif #endif
#ifdef EBADRQC #ifdef EBADRQC
{ EBADRQC, 56 }, { "EBADRQC", EBADRQC, 56 },
#endif #endif
#ifdef EBADSLT #ifdef EBADSLT
{ EBADSLT, 57 }, { "EBADSLT", EBADSLT, 57 },
#endif #endif
#ifdef EDEADLOCK #ifdef EDEADLOCK
{ EDEADLOCK, 35 }, { "EDEADLOCK", EDEADLOCK, 35 },
#endif #endif
#ifdef EBFONT #ifdef EBFONT
{ EBFONT, 59 }, { "EBFONT", EBFONT, 59 },
#endif #endif
#ifdef ENOSTR #ifdef ENOSTR
{ ENOSTR, 60 }, { "ENOSTR", ENOSTR, 60 },
#endif #endif
#ifdef ENODATA #ifdef ENODATA
{ ENODATA, 61 }, { "ENODATA", ENODATA, 61 },
#endif #endif
#ifdef ETIME #ifdef ETIME
{ ETIME, 62 }, { "ETIME", ETIME, 62 },
#endif #endif
#ifdef ENOSR #ifdef ENOSR
{ ENOSR, 63 }, { "ENOSR", ENOSR, 63 },
#endif #endif
#ifdef ENONET #ifdef ENONET
{ ENONET, 64 }, { "ENONET", ENONET, 64 },
#endif #endif
#ifdef ENOPKG #ifdef ENOPKG
{ ENOPKG, 65 }, { "ENOPKG", ENOPKG, 65 },
#endif #endif
#ifdef EREMOTE #ifdef EREMOTE
{ EREMOTE, 66 }, { "EREMOTE", EREMOTE, 66 },
#endif #endif
#ifdef ENOLINK #ifdef ENOLINK
{ ENOLINK, 67 }, { "ENOLINK", ENOLINK, 67 },
#endif #endif
#ifdef EADV #ifdef EADV
{ EADV, 68 }, { "EADV", EADV, 68 },
#endif #endif
#ifdef ESRMNT #ifdef ESRMNT
{ ESRMNT, 69 }, { "ESRMNT", ESRMNT, 69 },
#endif #endif
#ifdef ECOMM #ifdef ECOMM
{ ECOMM, 70 }, { "ECOMM", ECOMM, 70 },
#endif #endif
#ifdef EPROTO #ifdef EPROTO
{ EPROTO, 71 }, { "EPROTO", EPROTO, 71 },
#endif #endif
#ifdef EMULTIHOP #ifdef EMULTIHOP
{ EMULTIHOP, 72 }, { "EMULTIHOP", EMULTIHOP, 72 },
#endif #endif
#ifdef EDOTDOT #ifdef EDOTDOT
{ EDOTDOT, 73 }, { "EDOTDOT", EDOTDOT, 73 },
#endif #endif
#ifdef EBADMSG #ifdef EBADMSG
{ EBADMSG, 74 }, { "EBADMSG", EBADMSG, 74 },
#endif #endif
#ifdef EOVERFLOW #ifdef EOVERFLOW
{ EOVERFLOW, 75 }, { "EOVERFLOW", EOVERFLOW, 75 },
#endif #endif
#ifdef ENOTUNIQ #ifdef ENOTUNIQ
{ ENOTUNIQ, 76 }, { "ENOTUNIQ", ENOTUNIQ, 76 },
#endif #endif
#ifdef EBADFD #ifdef EBADFD
{ EBADFD, 77 }, { "EBADFD", EBADFD, 77 },
#endif #endif
#ifdef EREMCHG #ifdef EREMCHG
{ EREMCHG, 78 }, { "EREMCHG", EREMCHG, 78 },
#endif #endif
#ifdef ELIBACC #ifdef ELIBACC
{ ELIBACC, 79 }, { "ELIBACC", ELIBACC, 79 },
#endif #endif
#ifdef ELIBBAD #ifdef ELIBBAD
{ ELIBBAD, 80 }, { "ELIBBAD", ELIBBAD, 80 },
#endif #endif
#ifdef ELIBSCN #ifdef ELIBSCN
{ ELIBSCN, 81 }, { "ELIBSCN", ELIBSCN, 81 },
#endif #endif
#ifdef ELIBMAX #ifdef ELIBMAX
{ ELIBMAX, 82 }, { "ELIBMAX", ELIBMAX, 82 },
#endif #endif
#ifdef ELIBEXEC #ifdef ELIBEXEC
{ ELIBEXEC, 83 }, { "ELIBEXEC", ELIBEXEC, 83 },
#endif #endif
#ifdef EILSEQ #ifdef EILSEQ
{ EILSEQ, 84 }, { "EILSEQ", EILSEQ, 84 },
#endif #endif
#ifdef ERESTART #ifdef ERESTART
{ ERESTART, 85 }, { "ERESTART", ERESTART, 85 },
#endif #endif
#ifdef ESTRPIPE #ifdef ESTRPIPE
{ ESTRPIPE, 86 }, { "ESTRPIPE", ESTRPIPE, 86 },
#endif #endif
#ifdef EUSERS #ifdef EUSERS
{ EUSERS, 87 }, { "EUSERS", EUSERS, 87 },
#endif #endif
#ifdef ENOTSOCK #ifdef ENOTSOCK
{ ENOTSOCK, 88 }, { "ENOTSOCK", ENOTSOCK, 88 },
#endif #endif
#ifdef EDESTADDRREQ #ifdef EDESTADDRREQ
{ EDESTADDRREQ, 89 }, { "EDESTADDRREQ", EDESTADDRREQ, 89 },
#endif #endif
#ifdef EMSGSIZE #ifdef EMSGSIZE
{ EMSGSIZE, 90 }, { "EMSGSIZE", EMSGSIZE, 90 },
#endif #endif
#ifdef EPROTOTYPE #ifdef EPROTOTYPE
{ EPROTOTYPE, 91 }, { "EPROTOTYPE", EPROTOTYPE, 91 },
#endif #endif
#ifdef ENOPROTOOPT #ifdef ENOPROTOOPT
{ ENOPROTOOPT, 92 }, { "ENOPROTOOPT", ENOPROTOOPT, 92 },
#endif #endif
#ifdef EPROTONOSUPPORT #ifdef EPROTONOSUPPORT
{ EPROTONOSUPPORT, 93 }, { "EPROTONOSUPPORT", EPROTONOSUPPORT, 93 },
#endif #endif
#ifdef ESOCKTNOSUPPORT #ifdef ESOCKTNOSUPPORT
{ ESOCKTNOSUPPORT, 94 }, { "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, 94 },
#endif #endif
#ifdef EOPNOTSUPP #ifdef EOPNOTSUPP
{ EOPNOTSUPP, 95 }, { "EOPNOTSUPP", EOPNOTSUPP, 95 },
#endif #endif
#ifdef EPFNOSUPPORT #ifdef EPFNOSUPPORT
{ EPFNOSUPPORT, 96 }, { "EPFNOSUPPORT", EPFNOSUPPORT, 96 },
#endif #endif
#ifdef EAFNOSUPPORT #ifdef EAFNOSUPPORT
{ EAFNOSUPPORT, 97 }, { "EAFNOSUPPORT", EAFNOSUPPORT, 97 },
#endif #endif
#ifdef EADDRINUSE #ifdef EADDRINUSE
{ EADDRINUSE, 98 }, { "EADDRINUSE", EADDRINUSE, 98 },
#endif #endif
#ifdef EADDRNOTAVAIL #ifdef EADDRNOTAVAIL
{ EADDRNOTAVAIL, 99 }, { "EADDRNOTAVAIL", EADDRNOTAVAIL, 99 },
#endif #endif
#ifdef ENETDOWN #ifdef ENETDOWN
{ ENETDOWN, 100 }, { "ENETDOWN", ENETDOWN, 100 },
#endif #endif
#ifdef ENETUNREACH #ifdef ENETUNREACH
{ ENETUNREACH, 101 }, { "ENETUNREACH", ENETUNREACH, 101 },
#endif #endif
#ifdef ENETRESET #ifdef ENETRESET
{ ENETRESET, 102 }, { "ENETRESET", ENETRESET, 102 },
#endif #endif
#ifdef ECONNABORTED #ifdef ECONNABORTED
{ ECONNABORTED, 103 }, { "ECONNABORTED", ECONNABORTED, 103 },
#endif #endif
#ifdef ECONNRESET #ifdef ECONNRESET
{ ECONNRESET, 104 }, { "ECONNRESET", ECONNRESET, 104 },
#endif #endif
#ifdef ENOBUFS #ifdef ENOBUFS
{ ENOBUFS, 105 }, { "ENOBUFS", ENOBUFS, 105 },
#endif #endif
#ifdef EISCONN #ifdef EISCONN
{ EISCONN, 106 }, { "EISCONN", EISCONN, 106 },
#endif #endif
#ifdef ENOTCONN #ifdef ENOTCONN
{ ENOTCONN, 107 }, { "ENOTCONN", ENOTCONN, 107 },
#endif #endif
#ifdef ESHUTDOWN #ifdef ESHUTDOWN
{ ESHUTDOWN, 108 }, { "ESHUTDOWN", ESHUTDOWN, 108 },
#endif #endif
#ifdef ETOOMANYREFS #ifdef ETOOMANYREFS
{ ETOOMANYREFS, 109 }, { "ETOOMANYREFS", ETOOMANYREFS, 109 },
#endif #endif
#ifdef ETIMEDOUT #ifdef ETIMEDOUT
{ ETIMEDOUT, 110 }, { "ETIMEDOUT", ETIMEDOUT, 110 },
#endif #endif
#ifdef ECONNREFUSED #ifdef ECONNREFUSED
{ ECONNREFUSED, 111 }, { "ECONNREFUSED", ECONNREFUSED, 111 },
#endif #endif
#ifdef EHOSTDOWN #ifdef EHOSTDOWN
{ EHOSTDOWN, 112 }, { "EHOSTDOWN", EHOSTDOWN, 112 },
#endif #endif
#ifdef EHOSTUNREACH #ifdef EHOSTUNREACH
{ EHOSTUNREACH, 113 }, { "EHOSTUNREACH", EHOSTUNREACH, 113 },
#endif #endif
#ifdef EALREADY #ifdef EALREADY
{ EALREADY, 114 }, { "EALREADY", EALREADY, 114 },
#endif #endif
#ifdef EINPROGRESS #ifdef EINPROGRESS
{ EINPROGRESS, 115 }, { "EINPROGRESS", EINPROGRESS, 115 },
#endif #endif
#ifdef ESTALE #ifdef ESTALE
{ ESTALE, 116 }, { "ESTALE", ESTALE, 116 },
#endif #endif
#ifdef EUCLEAN #ifdef EUCLEAN
{ EUCLEAN, 117 }, { "EUCLEAN", EUCLEAN, 117 },
#endif #endif
#ifdef ENOTNAM #ifdef ENOTNAM
{ ENOTNAM, 118 }, { "ENOTNAM", ENOTNAM, 118 },
#endif #endif
#ifdef ENAVAIL #ifdef ENAVAIL
{ ENAVAIL, 119 }, { "ENAVAIL", ENAVAIL, 119 },
#endif #endif
#ifdef EISNAM #ifdef EISNAM
{ EISNAM, 120 }, { "EISNAM", EISNAM, 120 },
#endif #endif
#ifdef EREMOTEIO #ifdef EREMOTEIO
{ EREMOTEIO, 121 }, { "EREMOTEIO", EREMOTEIO, 121 },
#endif #endif
#ifdef EDQUOT #ifdef EDQUOT
{ EDQUOT, 122 }, { "EDQUOT", EDQUOT, 122 },
#endif #endif
#ifdef ENOMEDIUM #ifdef ENOMEDIUM
{ ENOMEDIUM, 123 }, { "ENOMEDIUM", ENOMEDIUM, 123 },
#endif #endif
#ifdef EMEDIUMTYPE #ifdef EMEDIUMTYPE
{ EMEDIUMTYPE, 124 }, { "EMEDIUMTYPE", EMEDIUMTYPE, 124 },
#endif #endif
{ 0, -1 } { 0, 0, 0 }
}; };
/* Extracted by applying /* Extracted by applying
@ -702,57 +702,57 @@ static const CB_TARGET_DEFS_MAP errno_map[] =
static const CB_TARGET_DEFS_MAP open_map[] = { static const CB_TARGET_DEFS_MAP open_map[] = {
#ifdef O_ACCMODE #ifdef O_ACCMODE
{ O_ACCMODE, TARGET_O_ACCMODE }, { "O_ACCMODE", O_ACCMODE, TARGET_O_ACCMODE },
#endif #endif
#ifdef O_RDONLY #ifdef O_RDONLY
{ O_RDONLY, TARGET_O_RDONLY }, { "O_RDONLY", O_RDONLY, TARGET_O_RDONLY },
#endif #endif
#ifdef O_WRONLY #ifdef O_WRONLY
{ O_WRONLY, TARGET_O_WRONLY }, { "O_WRONLY", O_WRONLY, TARGET_O_WRONLY },
#endif #endif
#ifdef O_RDWR #ifdef O_RDWR
{ O_RDWR, 0x2 }, { "O_RDWR", O_RDWR, 0x2 },
#endif #endif
#ifdef O_CREAT #ifdef O_CREAT
{ O_CREAT, 0x40 }, { "O_CREAT", O_CREAT, 0x40 },
#endif #endif
#ifdef O_EXCL #ifdef O_EXCL
{ O_EXCL, 0x80 }, { "O_EXCL", O_EXCL, 0x80 },
#endif #endif
#ifdef O_NOCTTY #ifdef O_NOCTTY
{ O_NOCTTY, 0x100 }, { "O_NOCTTY", O_NOCTTY, 0x100 },
#endif #endif
#ifdef O_TRUNC #ifdef O_TRUNC
{ O_TRUNC, 0x200 }, { "O_TRUNC", O_TRUNC, 0x200 },
#endif #endif
#ifdef O_APPEND #ifdef O_APPEND
{ O_APPEND, 0x400 }, { "O_APPEND", O_APPEND, 0x400 },
#endif #endif
#ifdef O_NONBLOCK #ifdef O_NONBLOCK
{ O_NONBLOCK, 0x800 }, { "O_NONBLOCK", O_NONBLOCK, 0x800 },
#endif #endif
#ifdef O_NDELAY #ifdef O_NDELAY
{ O_NDELAY, 0x0 }, { "O_NDELAY", O_NDELAY, 0x0 },
#endif #endif
#ifdef O_SYNC #ifdef O_SYNC
{ O_SYNC, 0x1000 }, { "O_SYNC", O_SYNC, 0x1000 },
#endif #endif
#ifdef FASYNC #ifdef FASYNC
{ FASYNC, 0x2000 }, { "FASYNC", FASYNC, 0x2000 },
#endif #endif
#ifdef O_DIRECT #ifdef O_DIRECT
{ O_DIRECT, 0x4000 }, { "O_DIRECT", O_DIRECT, 0x4000 },
#endif #endif
#ifdef O_LARGEFILE #ifdef O_LARGEFILE
{ O_LARGEFILE, 0x8000 }, { "O_LARGEFILE", O_LARGEFILE, 0x8000 },
#endif #endif
#ifdef O_DIRECTORY #ifdef O_DIRECTORY
{ O_DIRECTORY, 0x10000 }, { "O_DIRECTORY", O_DIRECTORY, 0x10000 },
#endif #endif
#ifdef O_NOFOLLOW #ifdef O_NOFOLLOW
{ O_NOFOLLOW, 0x20000 }, { "O_NOFOLLOW", O_NOFOLLOW, 0x20000 },
#endif #endif
{ -1, -1 } { 0, -1, -1 }
}; };
/* Let's be less drastic and more traceable. FIXME: mark as noreturn. */ /* Let's be less drastic and more traceable. FIXME: mark as noreturn. */