#include "sim-syscall.h"
#include "sim-hw.h"
-#include "targ-vals.h"
-
/* The numbers here do not matter. They just need to be unique. They also
need not be static across releases -- they're used internally only. The
mapping from the Linux ABI to the CB values is in linux-targ-map.h. */
else
{
sc.result = -1;
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
}
break;
if (sc.arg4 & 0x20 /*MAP_ANONYMOUS*/)
/* XXX: We don't handle zeroing, but default is all zeros. */;
else if (args[4] >= MAX_CALLBACK_FDS)
- sc.errcode = TARGET_ENOSYS;
+ sc.errcode = cb_host_to_target_errno (cb, ENOSYS);
else
{
#ifdef HAVE_PREAD
if (pread (cb->fdmap[args[4]], data, sc.arg2, args[5] << 12) == sc.arg2)
sc.write_mem (cb, &sc, heap, data, sc.arg2);
else
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
free (data);
#else
- sc.errcode = TARGET_ENOSYS;
+ sc.errcode = cb_host_to_target_errno (cb, ENOSYS);
#endif
}
if (sc.arg1 >= MAX_CALLBACK_FDS || sc.arg2 >= MAX_CALLBACK_FDS)
{
sc.result = -1;
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
}
else
{
if (sc.arg2)
{
sc.result = -1;
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
}
else
{
if (sc.arg1 >= MAX_CALLBACK_FDS)
{
sc.result = -1;
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
}
else
{
if (getcwd (p, sc.arg2) == NULL)
{
sc.result = -1;
- sc.errcode = TARGET_EINVAL;
+ sc.errcode = cb_host_to_target_errno (cb, EINVAL);
}
else
{
if (sc.arg1 != getpid ())
{
sc.result = -1;
- sc.errcode = TARGET_EPERM;
+ sc.errcode = cb_host_to_target_errno (cb, EPERM);
}
else
{
goto sys_finish;
#else
sc.result = -1;
- sc.errcode = TARGET_ENOSYS;
+ sc.errcode = cb_host_to_target_errno (cb, ENOSYS);
#endif
}
break;
printf ("#define TARGET_%s %d\n", t->symbol, t->value);
printf ("\n");
- printf ("/* errno values */\n");
- for (t = &errno_tdefs[0]; t->symbol; ++t)
- printf ("#define TARGET_%s %d\n", t->symbol, t->value);
- printf ("\n");
-
printf ("/* signal values */\n");
for (t = &signal_tdefs[0]; t->symbol; ++t)
printf ("#define TARGET_%s %d\n", t->symbol, t->value);
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");