On Sat, Dec 5, 2020, 3:38 AM Rob Landley <[email protected]> wrote: > (Also, line buffering sucks because it'll flush at the buffer size anyway > so > you're not guaranteed to get a full line of contiguous output. What it > REALLY > wants is nagle's algorithm for stdout but no libc ever bothered to > IMPLEMENT it, > possibly because of the runtime expense... Ahem. My point is commands > should > probably do sane output blocking on their own.)
AFAIK, the only way this would work is if libc only ever does nonblocking writes to stdout, which also means it would need to spawn a thread or use SIGIO to flush its buffer when stdout becomes available, plus modify the flags on STDOUT_FILENO to be O_NONBLOCK (which doesn't even work on regular files). I think people would be far more annoyed with this behavior than any potential gains would justify? (io_uring might make things more interesting, though? You could eliminate libc's buffering entirely, and just memcpy and submit a write for every single fwrite, up to some buffer limit.)
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
