mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
vendor: github.com/containerd/fifo v1.0.0
full diff: 0724c46b32
...v1.0.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e0cabedf14
commit
bfb5b8017b
9 changed files with 31 additions and 46 deletions
|
@ -133,7 +133,7 @@ google.golang.org/genproto 3f1135a288c9a07e340ae8ba4cc6
|
|||
|
||||
# containerd
|
||||
github.com/containerd/containerd 19ee068f93c91f7b9b2a858457f1af2cabc7bc06 # master (v1.5.0-dev)
|
||||
github.com/containerd/fifo 0724c46b320cf96bb172a0550c19a4b1fca4dacb
|
||||
github.com/containerd/fifo 650e8a8a179d040123db61f016cb133143e7a581 # v1.0.0
|
||||
github.com/containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
|
||||
github.com/containerd/cgroups 0b889c03f102012f1d93a97ddd3ef71cd6f4f510
|
||||
github.com/containerd/console 2f1e3d2b6afd18e8b2077816c711205a0b4d8769 # v1.0.2
|
||||
|
|
4
vendor/github.com/containerd/fifo/errors.go
generated
vendored
4
vendor/github.com/containerd/fifo/errors.go
generated
vendored
|
@ -16,9 +16,7 @@
|
|||
|
||||
package fifo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrClosed = errors.New("fifo closed")
|
||||
|
|
4
vendor/github.com/containerd/fifo/fifo.go
generated
vendored
4
vendor/github.com/containerd/fifo/fifo.go
generated
vendored
|
@ -1,3 +1,5 @@
|
|||
// +build !windows
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
|
@ -74,7 +76,7 @@ func OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re
|
|||
func openFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (*fifo, error) {
|
||||
if _, err := os.Stat(fn); err != nil {
|
||||
if os.IsNotExist(err) && flag&syscall.O_CREAT != 0 {
|
||||
if err := mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) {
|
||||
if err := syscall.Mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) {
|
||||
return nil, errors.Wrapf(err, "error creating fifo %v", fn)
|
||||
}
|
||||
} else {
|
||||
|
|
6
vendor/github.com/containerd/fifo/go.mod
generated
vendored
6
vendor/github.com/containerd/fifo/go.mod
generated
vendored
|
@ -3,7 +3,7 @@ module github.com/containerd/fifo
|
|||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/stretchr/testify v1.4.0
|
||||
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.6.1
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
|
||||
)
|
||||
|
|
8
vendor/github.com/containerd/fifo/handle_nolinux.go
generated
vendored
8
vendor/github.com/containerd/fifo/handle_nolinux.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// +build !linux
|
||||
// +build !linux,!windows
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
@ -38,8 +38,8 @@ func getHandle(fn string) (*handle, error) {
|
|||
|
||||
h := &handle{
|
||||
fn: fn,
|
||||
dev: uint64(stat.Dev),
|
||||
ino: uint64(stat.Ino),
|
||||
dev: uint64(stat.Dev), //nolint: unconvert
|
||||
ino: uint64(stat.Ino), //nolint: unconvert
|
||||
}
|
||||
|
||||
return h, nil
|
||||
|
@ -50,7 +50,7 @@ func (h *handle) Path() (string, error) {
|
|||
if err := syscall.Stat(h.fn, &stat); err != nil {
|
||||
return "", errors.Wrapf(err, "path %v could not be statted", h.fn)
|
||||
}
|
||||
if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino {
|
||||
if uint64(stat.Dev) != h.dev || uint64(stat.Ino) != h.ino { //nolint: unconvert
|
||||
return "", errors.Errorf("failed to verify handle %v/%v %v/%v for %v", stat.Dev, h.dev, stat.Ino, h.ino, h.fn)
|
||||
}
|
||||
return h.fn, nil
|
||||
|
|
27
vendor/github.com/containerd/fifo/mkfifo_solaris.go
generated
vendored
27
vendor/github.com/containerd/fifo/mkfifo_solaris.go
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
// +build solaris
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fifo
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func mkfifo(path string, mode uint32) (err error) {
|
||||
return unix.Mkfifo(path, mode)
|
||||
}
|
2
vendor/github.com/containerd/fifo/raw.go
generated
vendored
2
vendor/github.com/containerd/fifo/raw.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// +build go1.12
|
||||
// +build !windows
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
|
4
vendor/github.com/containerd/fifo/readme.md
generated
vendored
4
vendor/github.com/containerd/fifo/readme.md
generated
vendored
|
@ -1,7 +1,9 @@
|
|||
### fifo
|
||||
|
||||
[![Build Status](https://travis-ci.org/containerd/fifo.svg?branch=master)](https://travis-ci.org/containerd/fifo)
|
||||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/fifo)](https://pkg.go.dev/github.com/containerd/fifo)
|
||||
[![Build Status](https://github.com/containerd/fifo/workflows/CI/badge.svg)](https://github.com/containerd/fifo/actions?query=workflow%3ACI)
|
||||
[![codecov](https://codecov.io/gh/containerd/fifo/branch/master/graph/badge.svg)](https://codecov.io/gh/containerd/fifo)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/fifo)](https://goreportcard.com/report/github.com/containerd/fifo)
|
||||
|
||||
Go package for handling fifos in a sane way.
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build !solaris
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
|
@ -18,8 +16,20 @@
|
|||
|
||||
package fifo
|
||||
|
||||
import "syscall"
|
||||
import "os"
|
||||
|
||||
func mkfifo(path string, mode uint32) (err error) {
|
||||
return syscall.Mkfifo(path, mode)
|
||||
// IsFifo checks if a file is a (named pipe) fifo
|
||||
// if the file does not exist then it returns false
|
||||
func IsFifo(path string) (bool, error) {
|
||||
stat, err := os.Stat(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
if stat.Mode()&os.ModeNamedPipe == os.ModeNamedPipe {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
Loading…
Reference in a new issue