Re: sim/arm/armos.c: IsTTY [PATCH]

Shaun Jackman
2005-09-09T17:16:07Z

2005/9/8, Richard Earnshaw <rearnsha@gcc.gnu.org>:
> 1) PATH_MAX isn't ANSI (it's POSIX, or something like that). So you
> can't rely on it being defined. I think for this case you can probably
> just define it to 1024 anyway if it's missing, but see
> libiberty/lrealpath.c if you want the gory details.

I'll use the ANSI FILENAME_MAX as Eli suggested.

> 2) If you do overflow the path limit, you need to set the simulator's
> errno value and return. Use cb_host_to_target_errno(sim_callback,
> ENAMETOOLONG) to set it.

Is this the correct way to use cb_host_to_target_errno?

for (i = 0; i < sizeof buf; i++)
if ((*p++ = ARMul_SafeReadByte (state, name++)) == '\0')
break;
if (i == sizeof buf) {
state->Reg[0] = -1;
OSptr->ErrorNo = cb_host_to_target_errno(sim_callback, ENAMETOOLONG);
return;
}

Cheers,
Shaun