[ECOS] read and write to standerd IO
Jonathan Larmour
jifl@eCosCentric.com
Wed Oct 23 20:18:00 GMT 2002
Satoshi Sasaki wrote:
>
> read() failed if the following programs are executed.
> test_prog() is executed as a thread.
>
> int test_prog()
> {
> char tmpbuf[5];
>
> write(1,"XXXX",4);
> read(0,&tmpbuf,4);
[snip]
>
> Can I use standard input(fd number 0)?
Yes. The issue is that in the default configuration, stdio uses
/dev/ttydiag, which is a TTY device over a "pretend" serial device that
actually uses the HAL diagnostic I/O routines. These routines may or may
not support input, and more importantly won't work if you're communicating
via GDB.
> Or is it necessary to call open() again from a user program?
You can do that, or you can change CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE to
select the TTY device you really want.
Jifl
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list