Update containerd dependencies

sys/unix
cgroups
go-runc
console

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-07-07 11:46:54 -07:00
parent b9fb2793a8
commit d46b562043
51 changed files with 508 additions and 196 deletions

View File

@@ -26,6 +26,8 @@ type Console interface {
Reset() error
// Size returns the window size of the console
Size() (WinSize, error)
// Fd returns the console's file descriptor
Fd() uintptr
}
// WinSize specifies the window size of the console

View File

@@ -114,6 +114,10 @@ func (m *master) Size() (WinSize, error) {
return ws, nil
}
func (m *master) Fd() uintptr {
return m.f.Fd()
}
// checkConsole checks if the provided file is a console
func checkConsole(f *os.File) error {
var termios unix.Termios

View File

@@ -150,6 +150,10 @@ func (m *master) Write(b []byte) (int, error) {
panic("not implemented on windows")
}
func (m *master) Fd() uintptr {
return m.in
}
// makeInputRaw puts the terminal (Windows Console) connected to the given
// file descriptor into raw mode
func makeInputRaw(fd uintptr, mode uint32) error {

View File

@@ -9,11 +9,16 @@ import (
)
func tcget(fd uintptr, p *unix.Termios) error {
return ioctl(fd, unix.TCGETS, uintptr(unsafe.Pointer(p)))
termios, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
if err != nil {
return err
}
*p = *termios
return nil
}
func tcset(fd uintptr, p *unix.Termios) error {
return ioctl(fd, unix.TCSETS, uintptr(unsafe.Pointer(p)))
return unix.IoctlSetTermios(int(fd), unix.TCSETS, p)
}
func ioctl(fd, flag, data uintptr) error {
@@ -32,15 +37,14 @@ func unlockpt(f *os.File) error {
// ptsname retrieves the name of the first available pts for the given master.
func ptsname(f *os.File) (string, error) {
var n int32
if err := ioctl(f.Fd(), unix.TIOCGPTN, uintptr(unsafe.Pointer(&n))); err != nil {
n, err := unix.IoctlGetInt(int(f.Fd()), unix.TIOCGPTN)
if err != nil {
return "", err
}
return fmt.Sprintf("/dev/pts/%d", n), nil
}
func saneTerminal(f *os.File) error {
// Go doesn't have a wrapper for any of the termios ioctls.
var termios unix.Termios
if err := tcget(f.Fd(), &termios); err != nil {
return err