Problems redirecting stdin/out for a task in 4.6.99.2
Brett Swimley
brett.swimley at aedbozeman.com
Fri Jan 6 00:24:12 UTC 2006
Till Straumann wrote:
> Brett Swimley wrote:
>
>> Till -
>>
>> I'm noticing something similar to this with the rtems_monitor
>> (mon-monitor.c). I tried your change by adding
>>
>> fileno(STDIN_FILENO);
>
>
> This is certainly bad, bad. fileno() expects a 'FILE *' argument
> but you give it what it is supposed to return (an integer file
> descriptor).
>
Yup, I should have looked at the prototype...
>>
>> prior to the tcgetattr, and tcsetattr calls for STDIN_FILENO.
>> I also tried fileno(stdout) as you suggested.
>
>
> Please attach your code.
>
Code is in cpukit\libmisc\monitor\mon-monitor.c. Pertinent section (I
think) is shown below. I've never used the monitor before this
particular app that I'm putting together, but the behavior just doesn't
seem right. I need to press the ENTER key twice before I get the
monitor prompt, and then the terminal advances to the next line. I'm
also not getting echo.
Perhaps this is not a related issue, but reading the description of the
issue led me to believe it was...
Thanks.
Brett
void
rtems_monitor_task(
rtems_task_argument monitor_flags
)
{
rtems_tcb *debugee = 0;
rtems_context *rp;
rtems_context_fp *fp;
char command_buffer[513];
int argc;
char *argv[64];
boolean verbose = FALSE;
struct termios term;
fileno(stdin); ====> Added this call (now corrected).
/*
* Make the stdin stream characte not line based.
*/
if (tcgetattr (STDIN_FILENO, &term) < 0)
{
fprintf(stdout,"rtems-monitor: cannot get terminal attributes.\n");
}
else
More information about the users
mailing list