-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #827 from crosbymichael/update-console
Update go-runc and console packages
- Loading branch information
Showing
24 changed files
with
109 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ithub.com/crosbymichael/console/README.md → ...c/github.com/containerd/console/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...thub.com/crosbymichael/console/tc_unix.go → ...ithub.com/containerd/console/tc_darwin.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// +build !linux | ||
|
||
package console | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package console | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"unsafe" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
func tcget(fd uintptr, p *unix.Termios) error { | ||
return ioctl(fd, unix.TIOCGETA, uintptr(unsafe.Pointer(p))) | ||
} | ||
|
||
func tcset(fd uintptr, p *unix.Termios) error { | ||
return ioctl(fd, unix.TIOCSETA, uintptr(unsafe.Pointer(p))) | ||
} | ||
|
||
func ioctl(fd, flag, data uintptr) error { | ||
if _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, flag, data); err != 0 { | ||
return err | ||
} | ||
return 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. | ||
// This does not exist on FreeBSD, it does not allocate controlling terminals on open | ||
func unlockpt(f *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) { | ||
var n int32 | ||
if err := ioctl(f.Fd(), unix.TIOCGPTN, uintptr(unsafe.Pointer(&n))); 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 | ||
} | ||
// Set -onlcr so we don't have to deal with \r. | ||
termios.Oflag &^= unix.ONLCR | ||
return tcset(f.Fd(), &termios) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.