...

Text file src/github.com/containerd/fifo/readme.md

Documentation: github.com/containerd/fifo

     1### fifo
     2
     3[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/fifo)](https://pkg.go.dev/github.com/containerd/fifo)
     4[![Build Status](https://github.com/containerd/fifo/workflows/CI/badge.svg)](https://github.com/containerd/fifo/actions?query=workflow%3ACI)
     5[![codecov](https://codecov.io/gh/containerd/fifo/branch/master/graph/badge.svg)](https://codecov.io/gh/containerd/fifo)
     6[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/fifo)](https://goreportcard.com/report/github.com/containerd/fifo)
     7
     8Go package for handling fifos in a sane way.
     9
    10```
    11// OpenFifo opens a fifo. Returns io.ReadWriteCloser.
    12// Context can be used to cancel this function until open(2) has not returned.
    13// Accepted flags:
    14// - syscall.O_CREAT - create new fifo if one doesn't exist
    15// - syscall.O_RDONLY - open fifo only from reader side
    16// - syscall.O_WRONLY - open fifo only from writer side
    17// - syscall.O_RDWR - open fifo from both sides, never block on syscall level
    18// - syscall.O_NONBLOCK - return io.ReadWriteCloser even if other side of the
    19//     fifo isn't open. read/write will be connected after the actual fifo is
    20//     open or after fifo is closed.
    21func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)
    22
    23
    24// Read from a fifo to a byte array.
    25func (f *fifo) Read(b []byte) (int, error)
    26
    27
    28// Write from byte array to a fifo.
    29func (f *fifo) Write(b []byte) (int, error)
    30
    31
    32// Close the fifo. Next reads/writes will error. This method can also be used
    33// before open(2) has returned and fifo was never opened.
    34func (f *fifo) Close() error 
    35```
    36
    37## Project details
    38
    39The fifo is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
    40As a containerd sub-project, you will find the:
    41
    42 * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md),
    43 * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS),
    44 * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md)
    45
    46information in our [`containerd/project`](https://github.com/containerd/project) repository.

View as plain text