On 24/10/2023 12:18, tom kronmiller wrote:
so I unbuffered stdin and that seemed to make it happy.

It might be performance killer. Even fflush(NULL) before fork() may be better.

https://stackoverflow.com/questions/50110992/why-does-forking-my-process-cause-the-file-to-be-read-infinitely
"Why does forking my process cause the file to be read infinitely"

extensively explains that seek offset is shared by inherited file description and flushing stdin in child affects its parent. However buffers are independent. Accordingly to POSIX "The application shall prepare for a fork() exactly as if it were a change of active handle."

glibc bug report was closed as invalid
https://sourceware.org/bugzilla/show_bug.cgi?id=23151

I am curious why macOS behaves differently.

Reply via email to