1// +build linux freebsd 2 3package logger // import "github.com/docker/docker/daemon/logger" 4 5import ( 6 "context" 7 "io" 8 9 "github.com/containerd/fifo" 10 "github.com/pkg/errors" 11 "golang.org/x/sys/unix" 12) 13 14func openPluginStream(a *pluginAdapter) (io.WriteCloser, error) { 15 // Make sure to also open with read (in addition to write) to avoid borken pipe errors on plugin failure. 16 // It is up to the plugin to keep track of pipes that it should re-attach to, however. 17 // If the plugin doesn't open for reads, then the container will block once the pipe is full. 18 f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_RDWR|unix.O_CREAT|unix.O_NONBLOCK, 0700) 19 if err != nil { 20 return nil, errors.Wrapf(err, "error creating i/o pipe for log plugin: %s", a.Name()) 21 } 22 return f, nil 23} 24