mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
vendor: github.com/containerd/console 8f6c4e4
full diff: https://github.com/containerd/console/compare/v1.0.3...8f6c4e4faef5a326d2cd907097d04c0239ee5e2f Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
2c1f46450a
commit
6ffb77dcda
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
|||||||
github.com/Masterminds/semver/v3 v3.2.1
|
github.com/Masterminds/semver/v3 v3.2.1
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.18.16
|
github.com/aws/aws-sdk-go-v2/config v1.18.16
|
||||||
github.com/compose-spec/compose-go/v2 v2.0.0-rc.3
|
github.com/compose-spec/compose-go/v2 v2.0.0-rc.3
|
||||||
github.com/containerd/console v1.0.3
|
github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 // include https://github.com/containerd/console/pull/66, which is not yet in a release.
|
||||||
github.com/containerd/containerd v1.7.12
|
github.com/containerd/containerd v1.7.12
|
||||||
github.com/containerd/continuity v0.4.2
|
github.com/containerd/continuity v0.4.2
|
||||||
github.com/containerd/log v0.1.0
|
github.com/containerd/log v0.1.0
|
||||||
|
4
go.sum
4
go.sum
@ -90,8 +90,8 @@ github.com/compose-spec/compose-go/v2 v2.0.0-rc.3 h1:t0qajSNkH3zR4HEN2CM+GVU7GBx
|
|||||||
github.com/compose-spec/compose-go/v2 v2.0.0-rc.3/go.mod h1:r7CJHU0GaLtRVLm2ch8RCNkJh3GHyaqqc2rSti7VP44=
|
github.com/compose-spec/compose-go/v2 v2.0.0-rc.3/go.mod h1:r7CJHU0GaLtRVLm2ch8RCNkJh3GHyaqqc2rSti7VP44=
|
||||||
github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM=
|
github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM=
|
||||||
github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw=
|
github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw=
|
||||||
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 h1:Ig+OPkE3XQrrl+SKsOqAjlkrBN/zrr+Qpw7rCuDjRCE=
|
||||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
|
||||||
github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0=
|
github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0=
|
||||||
github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk=
|
github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk=
|
||||||
github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM=
|
github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM=
|
||||||
|
14
vendor/github.com/containerd/console/.golangci.yml
generated
vendored
14
vendor/github.com/containerd/console/.golangci.yml
generated
vendored
@ -1,16 +1,16 @@
|
|||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- structcheck
|
|
||||||
- varcheck
|
|
||||||
- staticcheck
|
|
||||||
- unconvert
|
|
||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- vet
|
|
||||||
- unused
|
|
||||||
- misspell
|
- misspell
|
||||||
|
- revive
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- unconvert
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
- vet
|
||||||
disable:
|
disable:
|
||||||
- errcheck
|
- errcheck
|
||||||
|
|
||||||
|
6
vendor/github.com/containerd/console/README.md
generated
vendored
6
vendor/github.com/containerd/console/README.md
generated
vendored
@ -22,8 +22,8 @@ current.Resize(ws)
|
|||||||
|
|
||||||
console is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
|
console is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
|
||||||
As a containerd sub-project, you will find the:
|
As a containerd sub-project, you will find the:
|
||||||
* [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md),
|
* [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md),
|
||||||
* [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS),
|
* [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS),
|
||||||
* and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md)
|
* and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md)
|
||||||
|
|
||||||
information in our [`containerd/project`](https://github.com/containerd/project) repository.
|
information in our [`containerd/project`](https://github.com/containerd/project) repository.
|
||||||
|
9
vendor/github.com/containerd/console/console.go
generated
vendored
9
vendor/github.com/containerd/console/console.go
generated
vendored
@ -22,7 +22,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNotAConsole = errors.New("provided file is not a console")
|
var (
|
||||||
|
ErrNotAConsole = errors.New("provided file is not a console")
|
||||||
|
ErrNotImplemented = errors.New("not implemented")
|
||||||
|
)
|
||||||
|
|
||||||
type File interface {
|
type File interface {
|
||||||
io.ReadWriteCloser
|
io.ReadWriteCloser
|
||||||
@ -45,7 +48,7 @@ type Console interface {
|
|||||||
SetRaw() error
|
SetRaw() error
|
||||||
// DisableEcho disables echo on the console
|
// DisableEcho disables echo on the console
|
||||||
DisableEcho() error
|
DisableEcho() error
|
||||||
// Reset restores the console to its orignal state
|
// Reset restores the console to its original state
|
||||||
Reset() error
|
Reset() error
|
||||||
// Size returns the window size of the console
|
// Size returns the window size of the console
|
||||||
Size() (WinSize, error)
|
Size() (WinSize, error)
|
||||||
@ -78,7 +81,7 @@ func Current() (c Console) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ConsoleFromFile returns a console using the provided file
|
// ConsoleFromFile returns a console using the provided file
|
||||||
// nolint:golint
|
// nolint:revive
|
||||||
func ConsoleFromFile(f File) (Console, error) {
|
func ConsoleFromFile(f File) (Console, error) {
|
||||||
if err := checkConsole(f); err != nil {
|
if err := checkConsole(f); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
1
vendor/github.com/containerd/console/console_linux.go
generated
vendored
1
vendor/github.com/containerd/console/console_linux.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
36
vendor/github.com/containerd/console/console_other.go
generated
vendored
Normal file
36
vendor/github.com/containerd/console/console_other.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//go:build !darwin && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
|
||||||
|
// +build !darwin,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 console
|
||||||
|
|
||||||
|
// NewPty creates a new pty pair
|
||||||
|
// The master is returned as the first console and a string
|
||||||
|
// with the path to the pty slave is returned as the second
|
||||||
|
func NewPty() (Console, string, error) {
|
||||||
|
return nil, "", ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkConsole checks if the provided file is a console
|
||||||
|
func checkConsole(f File) error {
|
||||||
|
return ErrNotAConsole
|
||||||
|
}
|
||||||
|
|
||||||
|
func newMaster(f File) (Console, error) {
|
||||||
|
return nil, ErrNotImplemented
|
||||||
|
}
|
3
vendor/github.com/containerd/console/console_unix.go
generated
vendored
3
vendor/github.com/containerd/console/console_unix.go
generated
vendored
@ -1,4 +1,5 @@
|
|||||||
// +build darwin freebsd linux netbsd openbsd solaris
|
//go:build darwin || freebsd || linux || netbsd || openbsd || zos
|
||||||
|
// +build darwin freebsd linux netbsd openbsd zos
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
25
vendor/github.com/containerd/console/console_windows.go
generated
vendored
25
vendor/github.com/containerd/console/console_windows.go
generated
vendored
@ -24,12 +24,13 @@ import (
|
|||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var vtInputSupported bool
|
||||||
vtInputSupported bool
|
|
||||||
ErrNotImplemented = errors.New("not implemented")
|
|
||||||
)
|
|
||||||
|
|
||||||
func (m *master) initStdios() {
|
func (m *master) initStdios() {
|
||||||
|
// Note: We discard console mode warnings, because in/out can be redirected.
|
||||||
|
//
|
||||||
|
// TODO: Investigate opening CONOUT$/CONIN$ to handle this correctly
|
||||||
|
|
||||||
m.in = windows.Handle(os.Stdin.Fd())
|
m.in = windows.Handle(os.Stdin.Fd())
|
||||||
if err := windows.GetConsoleMode(m.in, &m.inMode); err == nil {
|
if err := windows.GetConsoleMode(m.in, &m.inMode); err == nil {
|
||||||
// Validate that windows.ENABLE_VIRTUAL_TERMINAL_INPUT is supported, but do not set it.
|
// Validate that windows.ENABLE_VIRTUAL_TERMINAL_INPUT is supported, but do not set it.
|
||||||
@ -39,8 +40,6 @@ func (m *master) initStdios() {
|
|||||||
// Unconditionally set the console mode back even on failure because SetConsoleMode
|
// Unconditionally set the console mode back even on failure because SetConsoleMode
|
||||||
// remembers invalid bits on input handles.
|
// remembers invalid bits on input handles.
|
||||||
windows.SetConsoleMode(m.in, m.inMode)
|
windows.SetConsoleMode(m.in, m.inMode)
|
||||||
} else {
|
|
||||||
fmt.Printf("failed to get console mode for stdin: %v\n", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m.out = windows.Handle(os.Stdout.Fd())
|
m.out = windows.Handle(os.Stdout.Fd())
|
||||||
@ -50,8 +49,6 @@ func (m *master) initStdios() {
|
|||||||
} else {
|
} else {
|
||||||
windows.SetConsoleMode(m.out, m.outMode)
|
windows.SetConsoleMode(m.out, m.outMode)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fmt.Printf("failed to get console mode for stdout: %v\n", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m.err = windows.Handle(os.Stderr.Fd())
|
m.err = windows.Handle(os.Stderr.Fd())
|
||||||
@ -61,8 +58,6 @@ func (m *master) initStdios() {
|
|||||||
} else {
|
} else {
|
||||||
windows.SetConsoleMode(m.err, m.errMode)
|
windows.SetConsoleMode(m.err, m.errMode)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fmt.Printf("failed to get console mode for stderr: %v\n", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +89,8 @@ func (m *master) SetRaw() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *master) Reset() error {
|
func (m *master) Reset() error {
|
||||||
|
var errs []error
|
||||||
|
|
||||||
for _, s := range []struct {
|
for _, s := range []struct {
|
||||||
fd windows.Handle
|
fd windows.Handle
|
||||||
mode uint32
|
mode uint32
|
||||||
@ -103,10 +100,16 @@ func (m *master) Reset() error {
|
|||||||
{m.err, m.errMode},
|
{m.err, m.errMode},
|
||||||
} {
|
} {
|
||||||
if err := windows.SetConsoleMode(s.fd, s.mode); err != nil {
|
if err := windows.SetConsoleMode(s.fd, s.mode); err != nil {
|
||||||
return fmt.Errorf("unable to restore console mode: %w", err)
|
// we can't just abort on the first error, otherwise we might leave
|
||||||
|
// the console in an unexpected state.
|
||||||
|
errs = append(errs, fmt.Errorf("unable to restore console mode: %w", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errs) > 0 {
|
||||||
|
return errs[0]
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
163
vendor/github.com/containerd/console/console_zos.go
generated
vendored
163
vendor/github.com/containerd/console/console_zos.go
generated
vendored
@ -1,163 +0,0 @@
|
|||||||
// +build zos
|
|
||||||
|
|
||||||
/*
|
|
||||||
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 console
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewPty creates a new pty pair
|
|
||||||
// The master is returned as the first console and a string
|
|
||||||
// with the path to the pty slave is returned as the second
|
|
||||||
func NewPty() (Console, string, error) {
|
|
||||||
var f File
|
|
||||||
var err error
|
|
||||||
var slave string
|
|
||||||
for i := 0;; i++ {
|
|
||||||
ptyp := fmt.Sprintf("/dev/ptyp%04d", i)
|
|
||||||
f, err = os.OpenFile(ptyp, os.O_RDWR, 0600)
|
|
||||||
if err == nil {
|
|
||||||
slave = fmt.Sprintf("/dev/ttyp%04d", i)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
// else probably Resource Busy
|
|
||||||
}
|
|
||||||
m, err := newMaster(f)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
return m, slave, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type master struct {
|
|
||||||
f File
|
|
||||||
original *unix.Termios
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Read(b []byte) (int, error) {
|
|
||||||
return m.f.Read(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Write(b []byte) (int, error) {
|
|
||||||
return m.f.Write(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Close() error {
|
|
||||||
return m.f.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Resize(ws WinSize) error {
|
|
||||||
return tcswinsz(m.f.Fd(), ws)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) ResizeFrom(c Console) error {
|
|
||||||
ws, err := c.Size()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return m.Resize(ws)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Reset() error {
|
|
||||||
if m.original == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return tcset(m.f.Fd(), m.original)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) getCurrent() (unix.Termios, error) {
|
|
||||||
var termios unix.Termios
|
|
||||||
if err := tcget(m.f.Fd(), &termios); err != nil {
|
|
||||||
return unix.Termios{}, err
|
|
||||||
}
|
|
||||||
return termios, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) SetRaw() error {
|
|
||||||
rawState, err := m.getCurrent()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
rawState = cfmakeraw(rawState)
|
|
||||||
rawState.Oflag = rawState.Oflag | unix.OPOST
|
|
||||||
return tcset(m.f.Fd(), &rawState)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) DisableEcho() error {
|
|
||||||
rawState, err := m.getCurrent()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
rawState.Lflag = rawState.Lflag &^ unix.ECHO
|
|
||||||
return tcset(m.f.Fd(), &rawState)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Size() (WinSize, error) {
|
|
||||||
return tcgwinsz(m.f.Fd())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Fd() uintptr {
|
|
||||||
return m.f.Fd()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *master) Name() string {
|
|
||||||
return m.f.Name()
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkConsole checks if the provided file is a console
|
|
||||||
func checkConsole(f File) error {
|
|
||||||
var termios unix.Termios
|
|
||||||
if tcget(f.Fd(), &termios) != nil {
|
|
||||||
return ErrNotAConsole
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func newMaster(f File) (Console, error) {
|
|
||||||
m := &master{
|
|
||||||
f: f,
|
|
||||||
}
|
|
||||||
t, err := m.getCurrent()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
m.original = &t
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearONLCR sets the necessary tty_ioctl(4)s to ensure that a pty pair
|
|
||||||
// created by us acts normally. In particular, a not-very-well-known default of
|
|
||||||
// Linux unix98 ptys is that they have +onlcr by default. While this isn't a
|
|
||||||
// problem for terminal emulators, because we relay data from the terminal we
|
|
||||||
// also relay that funky line discipline.
|
|
||||||
func ClearONLCR(fd uintptr) error {
|
|
||||||
return setONLCR(fd, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetONLCR sets the necessary tty_ioctl(4)s to ensure that a pty pair
|
|
||||||
// created by us acts as intended for a terminal emulator.
|
|
||||||
func SetONLCR(fd uintptr) error {
|
|
||||||
return setONLCR(fd, true)
|
|
||||||
}
|
|
1
vendor/github.com/containerd/console/pty_freebsd_cgo.go
generated
vendored
1
vendor/github.com/containerd/console/pty_freebsd_cgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build freebsd && cgo
|
||||||
// +build freebsd,cgo
|
// +build freebsd,cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
1
vendor/github.com/containerd/console/pty_freebsd_nocgo.go
generated
vendored
1
vendor/github.com/containerd/console/pty_freebsd_nocgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build freebsd && !cgo
|
||||||
// +build freebsd,!cgo
|
// +build freebsd,!cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
3
vendor/github.com/containerd/console/pty_unix.go
generated
vendored
3
vendor/github.com/containerd/console/pty_unix.go
generated
vendored
@ -1,4 +1,5 @@
|
|||||||
// +build darwin linux netbsd openbsd solaris
|
//go:build darwin || linux || netbsd || openbsd
|
||||||
|
// +build darwin linux netbsd openbsd
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
43
vendor/github.com/containerd/console/pty_zos.go
generated
vendored
Normal file
43
vendor/github.com/containerd/console/pty_zos.go
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
//go:build zos
|
||||||
|
// +build zos
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 console
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// openpt allocates a new pseudo-terminal by opening the first available /dev/ptypXX device
|
||||||
|
func openpt() (*os.File, error) {
|
||||||
|
var f *os.File
|
||||||
|
var err error
|
||||||
|
for i := 0; ; i++ {
|
||||||
|
ptyp := fmt.Sprintf("/dev/ptyp%04d", i)
|
||||||
|
f, err = os.OpenFile(ptyp, os.O_RDWR, 0600)
|
||||||
|
if err == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// else probably Resource Busy
|
||||||
|
}
|
||||||
|
return f, nil
|
||||||
|
}
|
1
vendor/github.com/containerd/console/tc_freebsd_cgo.go
generated
vendored
1
vendor/github.com/containerd/console/tc_freebsd_cgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build freebsd && cgo
|
||||||
// +build freebsd,cgo
|
// +build freebsd,cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
1
vendor/github.com/containerd/console/tc_freebsd_nocgo.go
generated
vendored
1
vendor/github.com/containerd/console/tc_freebsd_nocgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build freebsd && !cgo
|
||||||
// +build freebsd,!cgo
|
// +build freebsd,!cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
1
vendor/github.com/containerd/console/tc_openbsd_cgo.go
generated
vendored
1
vendor/github.com/containerd/console/tc_openbsd_cgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build openbsd && cgo
|
||||||
// +build openbsd,cgo
|
// +build openbsd,cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
1
vendor/github.com/containerd/console/tc_openbsd_nocgo.go
generated
vendored
1
vendor/github.com/containerd/console/tc_openbsd_nocgo.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build openbsd && !cgo
|
||||||
// +build openbsd,!cgo
|
// +build openbsd,!cgo
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
51
vendor/github.com/containerd/console/tc_solaris_cgo.go
generated
vendored
51
vendor/github.com/containerd/console/tc_solaris_cgo.go
generated
vendored
@ -1,51 +0,0 @@
|
|||||||
// +build solaris,cgo
|
|
||||||
|
|
||||||
/*
|
|
||||||
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 console
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
|
||||||
|
|
||||||
//#include <stdlib.h>
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
const (
|
|
||||||
cmdTcGet = unix.TCGETS
|
|
||||||
cmdTcSet = unix.TCSETS
|
|
||||||
)
|
|
||||||
|
|
||||||
// ptsname retrieves the name of the first available pts for the given master.
|
|
||||||
func ptsname(f *os.File) (string, error) {
|
|
||||||
ptspath, err := C.ptsname(C.int(f.Fd()))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return C.GoString(ptspath), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// unlockpt unlocks the slave pseudoterminal device corresponding to the master pseudoterminal referred to by f.
|
|
||||||
// unlockpt should be called before opening the slave side of a pty.
|
|
||||||
func unlockpt(f *os.File) error {
|
|
||||||
if _, err := C.grantpt(C.int(f.Fd())); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
47
vendor/github.com/containerd/console/tc_solaris_nocgo.go
generated
vendored
47
vendor/github.com/containerd/console/tc_solaris_nocgo.go
generated
vendored
@ -1,47 +0,0 @@
|
|||||||
// +build solaris,!cgo
|
|
||||||
|
|
||||||
/*
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// Implementing the functions below requires cgo support. Non-cgo stubs
|
|
||||||
// versions are defined below to enable cross-compilation of source code
|
|
||||||
// that depends on these functions, but the resultant cross-compiled
|
|
||||||
// binaries cannot actually be used. If the stub function(s) below are
|
|
||||||
// actually invoked they will display an error message and cause the
|
|
||||||
// calling process to exit.
|
|
||||||
//
|
|
||||||
|
|
||||||
package console
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
cmdTcGet = unix.TCGETS
|
|
||||||
cmdTcSet = unix.TCSETS
|
|
||||||
)
|
|
||||||
|
|
||||||
func ptsname(f *os.File) (string, error) {
|
|
||||||
panic("ptsname() support requires cgo.")
|
|
||||||
}
|
|
||||||
|
|
||||||
func unlockpt(f *os.File) error {
|
|
||||||
panic("unlockpt() support requires cgo.")
|
|
||||||
}
|
|
5
vendor/github.com/containerd/console/tc_unix.go
generated
vendored
5
vendor/github.com/containerd/console/tc_unix.go
generated
vendored
@ -1,4 +1,5 @@
|
|||||||
// +build darwin freebsd linux netbsd openbsd solaris zos
|
//go:build darwin || freebsd || linux || netbsd || openbsd || zos
|
||||||
|
// +build darwin freebsd linux netbsd openbsd zos
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
@ -83,7 +84,7 @@ func cfmakeraw(t unix.Termios) unix.Termios {
|
|||||||
t.Oflag &^= unix.OPOST
|
t.Oflag &^= unix.OPOST
|
||||||
t.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN)
|
t.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN)
|
||||||
t.Cflag &^= (unix.CSIZE | unix.PARENB)
|
t.Cflag &^= (unix.CSIZE | unix.PARENB)
|
||||||
t.Cflag &^= unix.CS8
|
t.Cflag |= unix.CS8
|
||||||
t.Cc[unix.VMIN] = 1
|
t.Cc[unix.VMIN] = 1
|
||||||
t.Cc[unix.VTIME] = 0
|
t.Cc[unix.VTIME] = 0
|
||||||
|
|
||||||
|
13
vendor/github.com/containerd/console/tc_zos.go
generated
vendored
13
vendor/github.com/containerd/console/tc_zos.go
generated
vendored
@ -17,6 +17,9 @@
|
|||||||
package console
|
package console
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,3 +27,13 @@ const (
|
|||||||
cmdTcGet = unix.TCGETS
|
cmdTcGet = unix.TCGETS
|
||||||
cmdTcSet = unix.TCSETS
|
cmdTcSet = unix.TCSETS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// unlockpt is a no-op on zos.
|
||||||
|
func unlockpt(_ *os.File) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ptsname retrieves the name of the first available pts for the given master.
|
||||||
|
func ptsname(f *os.File) (string, error) {
|
||||||
|
return "/dev/ttyp" + strings.TrimPrefix(f.Name(), "/dev/ptyp"), nil
|
||||||
|
}
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -140,7 +140,7 @@ github.com/compose-spec/compose-go/v2/tree
|
|||||||
github.com/compose-spec/compose-go/v2/types
|
github.com/compose-spec/compose-go/v2/types
|
||||||
github.com/compose-spec/compose-go/v2/utils
|
github.com/compose-spec/compose-go/v2/utils
|
||||||
github.com/compose-spec/compose-go/v2/validation
|
github.com/compose-spec/compose-go/v2/validation
|
||||||
# github.com/containerd/console v1.0.3
|
# github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/containerd/console
|
github.com/containerd/console
|
||||||
# github.com/containerd/containerd v1.7.12
|
# github.com/containerd/containerd v1.7.12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user