in reply to Re: confusing fork/readline behaviour
in thread confusing fork/readline behaviour

Ah that makes sense, thanks. Presumably my script above is unsafe in the general case - I imagine libc could readahead 4k and not finish on a line boundary, then the second process would call readline and start halfway through a line...
  • Comment on Re^2: confusing fork/readline behaviour

Replies are listed 'Best First'.
Re^3: confusing fork/readline behaviour
by afoken (Chancellor) on Aug 14, 2015 at 18:22 UTC
    Presumably my script above is unsafe in the general case - I imagine libc could readahead 4k and not finish on a line boundary, then the second process would call readline and start halfway through a line.

    Correct.

    Why do you want two processes to read the same file?

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)