Re: Windows semihosting (remote-fileio) fix for console reads

Eli Zaretskii
2006-06-10T21:28:40Z

> Date: Sat, 10 Jun 2006 14:21:31 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> Here's the problem: a customer tried to use the remote file I/O protocol to
> read from standard input. Trivial little program, just a read() from stdin
> followed by a write() to stdout. Read was returning -1. A well-placed
> printf discovered that this was actually ENOMEM.
>
> By trial and error, we worked out that on the system we were using a read of
> 26609 bytes from the console, or more, would always return ENOMEM. Given
> 26608 bytes or less, it would succeed normally. Please don't ask me what
> that number means. No, it does not vary with the size of the malloced
> buffer.

That rings a bell, but I'll need to dig deep into old files to find
out the details. In the meantime, could you please post a short test
program that demonstrates this failure?

Thanks.