mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-05 19:17:43 +08:00
Merge pull request #2908 from crazy-max/update-pty
vendor: github.com/creack/pty v1.1.24
This commit is contained in:
commit
1eb167a767
2
go.mod
2
go.mod
@ -14,7 +14,7 @@ require (
|
||||
github.com/containerd/log v0.1.0
|
||||
github.com/containerd/platforms v0.2.1
|
||||
github.com/containerd/typeurl/v2 v2.2.3
|
||||
github.com/creack/pty v1.1.21
|
||||
github.com/creack/pty v1.1.24
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/distribution/reference v0.6.0
|
||||
github.com/docker/cli v27.4.1+incompatible
|
||||
|
4
go.sum
4
go.sum
@ -117,8 +117,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
|
||||
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
|
||||
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
2
vendor/github.com/creack/pty/README.md
generated
vendored
2
vendor/github.com/creack/pty/README.md
generated
vendored
@ -10,7 +10,7 @@ go get github.com/creack/pty
|
||||
|
||||
## Examples
|
||||
|
||||
Note that those examples are for demonstration purpose only, to showcase how to use the library. They are not meant to be used in any kind of production environment.
|
||||
Note that those examples are for demonstration purpose only, to showcase how to use the library. They are not meant to be used in any kind of production environment. If you want to **set deadlines to work** and `Close()` **interrupting** `Read()` on the returned `*os.File`, you will need to call `syscall.SetNonblock` manually.
|
||||
|
||||
### Command
|
||||
|
||||
|
4
vendor/github.com/creack/pty/pty_unsupported.go
generated
vendored
4
vendor/github.com/creack/pty/pty_unsupported.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
//go:build !linux && !darwin && !freebsd && !dragonfly && !netbsd && !openbsd && !solaris
|
||||
// +build !linux,!darwin,!freebsd,!dragonfly,!netbsd,!openbsd,!solaris
|
||||
//go:build !linux && !darwin && !freebsd && !dragonfly && !netbsd && !openbsd && !solaris && !zos
|
||||
// +build !linux,!darwin,!freebsd,!dragonfly,!netbsd,!openbsd,!solaris,!zos
|
||||
|
||||
package pty
|
||||
|
||||
|
141
vendor/github.com/creack/pty/pty_zos.go
generated
vendored
Normal file
141
vendor/github.com/creack/pty/pty_zos.go
generated
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
//go:build zos
|
||||
// +build zos
|
||||
|
||||
package pty
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
SYS_UNLOCKPT = 0x37B
|
||||
SYS_GRANTPT = 0x37A
|
||||
SYS_POSIX_OPENPT = 0xC66
|
||||
SYS_FCNTL = 0x18C
|
||||
SYS___PTSNAME_A = 0x718
|
||||
|
||||
SETCVTON = 1
|
||||
|
||||
O_NONBLOCK = 0x04
|
||||
|
||||
F_SETFL = 4
|
||||
F_CONTROL_CVT = 13
|
||||
)
|
||||
|
||||
type f_cnvrt struct {
|
||||
Cvtcmd int32
|
||||
Pccsid int16
|
||||
Fccsid int16
|
||||
}
|
||||
|
||||
func open() (pty, tty *os.File, err error) {
|
||||
ptmxfd, err := openpt(os.O_RDWR | syscall.O_NOCTTY)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// Needed for z/OS so that the characters are not garbled if ptyp* is untagged
|
||||
cvtreq := f_cnvrt{Cvtcmd: SETCVTON, Pccsid: 0, Fccsid: 1047}
|
||||
if _, err = fcntl(uintptr(ptmxfd), F_CONTROL_CVT, uintptr(unsafe.Pointer(&cvtreq))); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := os.NewFile(uintptr(ptmxfd), "/dev/ptmx")
|
||||
if p == nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// In case of error after this point, make sure we close the ptmx fd.
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = p.Close() // Best effort.
|
||||
}
|
||||
}()
|
||||
|
||||
sname, err := ptsname(ptmxfd)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
_, err = grantpt(ptmxfd)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if _, err = unlockpt(ptmxfd); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ptsfd, err := syscall.Open(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if _, err = fcntl(uintptr(ptsfd), F_CONTROL_CVT, uintptr(unsafe.Pointer(&cvtreq))); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
t := os.NewFile(uintptr(ptsfd), sname)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return p, t, nil
|
||||
}
|
||||
|
||||
func openpt(oflag int) (fd int, err error) {
|
||||
r0, _, e1 := runtime.CallLeFuncWithErr(runtime.GetZosLibVec()+SYS_POSIX_OPENPT<<4, uintptr(oflag))
|
||||
fd = int(r0)
|
||||
if e1 != 0 {
|
||||
err = syscall.Errno(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func fcntl(fd uintptr, cmd int, arg uintptr) (val int, err error) {
|
||||
r0, _, e1 := runtime.CallLeFuncWithErr(runtime.GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), arg)
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = syscall.Errno(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ptsname(fd int) (name string, err error) {
|
||||
r0, _, e1 := runtime.CallLeFuncWithPtrReturn(runtime.GetZosLibVec()+SYS___PTSNAME_A<<4, uintptr(fd))
|
||||
name = u2s(unsafe.Pointer(r0))
|
||||
if e1 != 0 {
|
||||
err = syscall.Errno(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func grantpt(fildes int) (rc int, err error) {
|
||||
r0, _, e1 := runtime.CallLeFuncWithErr(runtime.GetZosLibVec()+SYS_GRANTPT<<4, uintptr(fildes))
|
||||
rc = int(r0)
|
||||
if e1 != 0 {
|
||||
err = syscall.Errno(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func unlockpt(fildes int) (rc int, err error) {
|
||||
r0, _, e1 := runtime.CallLeFuncWithErr(runtime.GetZosLibVec()+SYS_UNLOCKPT<<4, uintptr(fildes))
|
||||
rc = int(r0)
|
||||
if e1 != 0 {
|
||||
err = syscall.Errno(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func u2s(cstr unsafe.Pointer) string {
|
||||
str := (*[1024]uint8)(cstr)
|
||||
i := 0
|
||||
for str[i] != 0 {
|
||||
i++
|
||||
}
|
||||
return string(str[:i])
|
||||
}
|
3
vendor/github.com/creack/pty/ztypes_openbsd_32bit_int.go
generated
vendored
3
vendor/github.com/creack/pty/ztypes_openbsd_32bit_int.go
generated
vendored
@ -1,5 +1,4 @@
|
||||
//go:build (386 || amd64 || arm || arm64 || mips64) && openbsd
|
||||
// +build 386 amd64 arm arm64 mips64
|
||||
//go:build openbsd
|
||||
// +build openbsd
|
||||
|
||||
package pty
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -212,8 +212,8 @@ github.com/containerd/typeurl/v2
|
||||
# github.com/cpuguy83/go-md2man/v2 v2.0.6
|
||||
## explicit; go 1.12
|
||||
github.com/cpuguy83/go-md2man/v2/md2man
|
||||
# github.com/creack/pty v1.1.21
|
||||
## explicit; go 1.13
|
||||
# github.com/creack/pty v1.1.24
|
||||
## explicit; go 1.18
|
||||
github.com/creack/pty
|
||||
# github.com/davecgh/go-spew v1.1.1
|
||||
## explicit
|
||||
|
Loading…
x
Reference in New Issue
Block a user