• Mahmood Ali's avatar
    fifo: Use plain fifo file in Unix · 5ca9b6eb
    Mahmood Ali authored
    This PR switches to using plain fifo files instead of golang structs
    managed by containerd/fifo library.
    
    The library main benefit is management of opening fifo files.  In Linux,
    a reader `open()` request would block until a writer opens the file (and
    vice-versa).  The library uses goroutines so that it's the first IO
    operation that blocks.
    
    This benefit isn't really useful for us: Given that logmon simply
    streams output in a separate process, blocking of opening or first read
    is effectively the same.
    
    The library additionally makes further complications for managing state
    and tracking read/write permission that seems overhead for our use,
    compared to using a file directly.
    
    Looking here, I made the following incidental changes:
    * document that we do handle if fifo files are already created, as we
    rely on that behavior for logmon restarts
    * use type system to lock read vs write: currently, fifo library returns
    `io.ReadWriteCloser` even if fifo is opened for writing only!
    5ca9b6eb