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