summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-10-25 07:55:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-10-25 07:55:13 +0000
commit310574f9544729ba6b51c755b0638de70c465e8e (patch)
tree78fae2aa68b6550fbc5ba7d3bfdbdfbcc337d2be
parentInitial commit. (diff)
downloadgolang-github-elisescu-pty-310574f9544729ba6b51c755b0638de70c465e8e.tar.xz
golang-github-elisescu-pty-310574f9544729ba6b51c755b0638de70c465e8e.zip
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--.gitignore4
-rw-r--r--License23
-rw-r--r--README.md36
-rw-r--r--doc.go16
-rw-r--r--ioctl.go13
-rw-r--r--ioctl_bsd.go39
-rwxr-xr-xmktypes.bash19
-rw-r--r--pty_darwin.go61
-rw-r--r--pty_dragonfly.go76
-rw-r--r--pty_freebsd.go73
-rw-r--r--pty_linux.go46
-rw-r--r--pty_unsupported.go11
-rw-r--r--run.go34
-rw-r--r--types.go10
-rw-r--r--types_dragonfly.go17
-rw-r--r--types_freebsd.go15
-rw-r--r--util.go64
-rw-r--r--ztypes_386.go9
-rw-r--r--ztypes_amd64.go9
-rw-r--r--ztypes_arm.go9
-rw-r--r--ztypes_arm64.go11
-rw-r--r--ztypes_dragonfly_amd64.go14
-rw-r--r--ztypes_freebsd_386.go13
-rw-r--r--ztypes_freebsd_amd64.go14
-rw-r--r--ztypes_freebsd_arm.go13
-rw-r--r--ztypes_mipsx.go12
-rw-r--r--ztypes_ppc64.go11
-rw-r--r--ztypes_ppc64le.go11
-rw-r--r--ztypes_s390x.go11
29 files changed, 694 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1f0a99f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+[568].out
+_go*
+_test*
+_obj
diff --git a/License b/License
new file mode 100644
index 0000000..6b7558b
--- /dev/null
+++ b/License
@@ -0,0 +1,23 @@
+Copyright (c) 2011 Keith Rarick
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute,
+sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall
+be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7b7900c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,36 @@
+# pty
+
+Pty is a Go package for using unix pseudo-terminals.
+
+## Install
+
+ go get github.com/kr/pty
+
+## Example
+
+```go
+package main
+
+import (
+ "github.com/kr/pty"
+ "io"
+ "os"
+ "os/exec"
+)
+
+func main() {
+ c := exec.Command("grep", "--color=auto", "bar")
+ f, err := pty.Start(c)
+ if err != nil {
+ panic(err)
+ }
+
+ go func() {
+ f.Write([]byte("foo\n"))
+ f.Write([]byte("bar\n"))
+ f.Write([]byte("baz\n"))
+ f.Write([]byte{4}) // EOT
+ }()
+ io.Copy(os.Stdout, f)
+}
+```
diff --git a/doc.go b/doc.go
new file mode 100644
index 0000000..190cfbe
--- /dev/null
+++ b/doc.go
@@ -0,0 +1,16 @@
+// Package pty provides functions for working with Unix terminals.
+package pty
+
+import (
+ "errors"
+ "os"
+)
+
+// ErrUnsupported is returned if a function is not
+// available on the current platform.
+var ErrUnsupported = errors.New("unsupported")
+
+// Opens a pty and its corresponding tty.
+func Open() (pty, tty *os.File, err error) {
+ return open()
+}
diff --git a/ioctl.go b/ioctl.go
new file mode 100644
index 0000000..c57c19e
--- /dev/null
+++ b/ioctl.go
@@ -0,0 +1,13 @@
+// +build !windows
+
+package pty
+
+import "syscall"
+
+func ioctl(fd, cmd, ptr uintptr) error {
+ _, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr)
+ if e != 0 {
+ return e
+ }
+ return nil
+}
diff --git a/ioctl_bsd.go b/ioctl_bsd.go
new file mode 100644
index 0000000..73b12c5
--- /dev/null
+++ b/ioctl_bsd.go
@@ -0,0 +1,39 @@
+// +build darwin dragonfly freebsd netbsd openbsd
+
+package pty
+
+// from <sys/ioccom.h>
+const (
+ _IOC_VOID uintptr = 0x20000000
+ _IOC_OUT uintptr = 0x40000000
+ _IOC_IN uintptr = 0x80000000
+ _IOC_IN_OUT uintptr = _IOC_OUT | _IOC_IN
+ _IOC_DIRMASK = _IOC_VOID | _IOC_OUT | _IOC_IN
+
+ _IOC_PARAM_SHIFT = 13
+ _IOC_PARAM_MASK = (1 << _IOC_PARAM_SHIFT) - 1
+)
+
+func _IOC_PARM_LEN(ioctl uintptr) uintptr {
+ return (ioctl >> 16) & _IOC_PARAM_MASK
+}
+
+func _IOC(inout uintptr, group byte, ioctl_num uintptr, param_len uintptr) uintptr {
+ return inout | (param_len&_IOC_PARAM_MASK)<<16 | uintptr(group)<<8 | ioctl_num
+}
+
+func _IO(group byte, ioctl_num uintptr) uintptr {
+ return _IOC(_IOC_VOID, group, ioctl_num, 0)
+}
+
+func _IOR(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
+ return _IOC(_IOC_OUT, group, ioctl_num, param_len)
+}
+
+func _IOW(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
+ return _IOC(_IOC_IN, group, ioctl_num, param_len)
+}
+
+func _IOWR(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
+ return _IOC(_IOC_IN_OUT, group, ioctl_num, param_len)
+}
diff --git a/mktypes.bash b/mktypes.bash
new file mode 100755
index 0000000..0c07680
--- /dev/null
+++ b/mktypes.bash
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+GOOSARCH="${GOOS}_${GOARCH}"
+case "$GOOSARCH" in
+_* | *_ | _)
+ echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
+ exit 1
+ ;;
+esac
+
+GODEFS="go tool cgo -godefs"
+
+$GODEFS types.go |gofmt > ztypes_$GOARCH.go
+
+case $GOOS in
+freebsd|dragonfly)
+ $GODEFS types_$GOOS.go |gofmt > ztypes_$GOOSARCH.go
+ ;;
+esac
diff --git a/pty_darwin.go b/pty_darwin.go
new file mode 100644
index 0000000..9341543
--- /dev/null
+++ b/pty_darwin.go
@@ -0,0 +1,61 @@
+package pty
+
+import (
+ "errors"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func open() (pty, tty *os.File, err error) {
+ pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+ p := os.NewFile(uintptr(pFD), "/dev/ptmx")
+
+ sname, err := ptsname(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ err = grantpt(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ err = unlockpt(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ t, err := os.OpenFile(sname, os.O_RDWR, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+ return p, t, nil
+}
+
+func ptsname(f *os.File) (string, error) {
+ n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME))
+
+ err := ioctl(f.Fd(), syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0])))
+ if err != nil {
+ return "", err
+ }
+
+ for i, c := range n {
+ if c == 0 {
+ return string(n[:i]), nil
+ }
+ }
+ return "", errors.New("TIOCPTYGNAME string not NUL-terminated")
+}
+
+func grantpt(f *os.File) error {
+ return ioctl(f.Fd(), syscall.TIOCPTYGRANT, 0)
+}
+
+func unlockpt(f *os.File) error {
+ return ioctl(f.Fd(), syscall.TIOCPTYUNLK, 0)
+}
diff --git a/pty_dragonfly.go b/pty_dragonfly.go
new file mode 100644
index 0000000..5431fb5
--- /dev/null
+++ b/pty_dragonfly.go
@@ -0,0 +1,76 @@
+package pty
+
+import (
+ "errors"
+ "os"
+ "strings"
+ "syscall"
+ "unsafe"
+)
+
+// same code as pty_darwin.go
+func open() (pty, tty *os.File, err error) {
+ p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ sname, err := ptsname(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ err = grantpt(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ err = unlockpt(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ t, err := os.OpenFile(sname, os.O_RDWR, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+ return p, t, nil
+}
+
+func grantpt(f *os.File) error {
+ _, err := isptmaster(f.Fd())
+ return err
+}
+
+func unlockpt(f *os.File) error {
+ _, err := isptmaster(f.Fd())
+ return err
+}
+
+func isptmaster(fd uintptr) (bool, error) {
+ err := ioctl(fd, syscall.TIOCISPTMASTER, 0)
+ return err == nil, err
+}
+
+var (
+ emptyFiodgnameArg fiodgnameArg
+ ioctl_FIODNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg))
+)
+
+func ptsname(f *os.File) (string, error) {
+ name := make([]byte, _C_SPECNAMELEN)
+ fa := fiodgnameArg{Name: (*byte)(unsafe.Pointer(&name[0])), Len: _C_SPECNAMELEN, Pad_cgo_0: [4]byte{0, 0, 0, 0}}
+
+ err := ioctl(f.Fd(), ioctl_FIODNAME, uintptr(unsafe.Pointer(&fa)))
+ if err != nil {
+ return "", err
+ }
+
+ for i, c := range name {
+ if c == 0 {
+ s := "/dev/" + string(name[:i])
+ return strings.Replace(s, "ptm", "pts", -1), nil
+ }
+ }
+ return "", errors.New("TIOCPTYGNAME string not NUL-terminated")
+}
diff --git a/pty_freebsd.go b/pty_freebsd.go
new file mode 100644
index 0000000..b341bab
--- /dev/null
+++ b/pty_freebsd.go
@@ -0,0 +1,73 @@
+package pty
+
+import (
+ "errors"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func posix_openpt(oflag int) (fd int, err error) {
+ r0, _, e1 := syscall.Syscall(syscall.SYS_POSIX_OPENPT, uintptr(oflag), 0, 0)
+ fd = int(r0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
+func open() (pty, tty *os.File, err error) {
+ fd, err := posix_openpt(syscall.O_RDWR | syscall.O_CLOEXEC)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ p := os.NewFile(uintptr(fd), "/dev/pts")
+ sname, err := ptsname(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ t, err := os.OpenFile("/dev/"+sname, os.O_RDWR, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+ return p, t, nil
+}
+
+func isptmaster(fd uintptr) (bool, error) {
+ err := ioctl(fd, syscall.TIOCPTMASTER, 0)
+ return err == nil, err
+}
+
+var (
+ emptyFiodgnameArg fiodgnameArg
+ ioctl_FIODGNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg))
+)
+
+func ptsname(f *os.File) (string, error) {
+ master, err := isptmaster(f.Fd())
+ if err != nil {
+ return "", err
+ }
+ if !master {
+ return "", syscall.EINVAL
+ }
+
+ const n = _C_SPECNAMELEN + 1
+ var (
+ buf = make([]byte, n)
+ arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))}
+ )
+ err = ioctl(f.Fd(), ioctl_FIODGNAME, uintptr(unsafe.Pointer(&arg)))
+ if err != nil {
+ return "", err
+ }
+
+ for i, c := range buf {
+ if c == 0 {
+ return string(buf[:i]), nil
+ }
+ }
+ return "", errors.New("FIODGNAME string not NUL-terminated")
+}
diff --git a/pty_linux.go b/pty_linux.go
new file mode 100644
index 0000000..cb901a2
--- /dev/null
+++ b/pty_linux.go
@@ -0,0 +1,46 @@
+package pty
+
+import (
+ "os"
+ "strconv"
+ "syscall"
+ "unsafe"
+)
+
+func open() (pty, tty *os.File, err error) {
+ p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ sname, err := ptsname(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ err = unlockpt(p)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
+ if err != nil {
+ return nil, nil, err
+ }
+ return p, t, nil
+}
+
+func ptsname(f *os.File) (string, error) {
+ var n _C_uint
+ err := ioctl(f.Fd(), syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n)))
+ if err != nil {
+ return "", err
+ }
+ return "/dev/pts/" + strconv.Itoa(int(n)), nil
+}
+
+func unlockpt(f *os.File) error {
+ var u _C_int
+ // use TIOCSPTLCK with a zero valued arg to clear the slave pty lock
+ return ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u)))
+}
diff --git a/pty_unsupported.go b/pty_unsupported.go
new file mode 100644
index 0000000..bd3d1e7
--- /dev/null
+++ b/pty_unsupported.go
@@ -0,0 +1,11 @@
+// +build !linux,!darwin,!freebsd,!dragonfly
+
+package pty
+
+import (
+ "os"
+)
+
+func open() (pty, tty *os.File, err error) {
+ return nil, nil, ErrUnsupported
+}
diff --git a/run.go b/run.go
new file mode 100644
index 0000000..baecca8
--- /dev/null
+++ b/run.go
@@ -0,0 +1,34 @@
+// +build !windows
+
+package pty
+
+import (
+ "os"
+ "os/exec"
+ "syscall"
+)
+
+// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
+// and c.Stderr, calls c.Start, and returns the File of the tty's
+// corresponding pty.
+func Start(c *exec.Cmd) (pty *os.File, err error) {
+ pty, tty, err := Open()
+ if err != nil {
+ return nil, err
+ }
+ defer tty.Close()
+ c.Stdout = tty
+ c.Stdin = tty
+ c.Stderr = tty
+ if c.SysProcAttr == nil {
+ c.SysProcAttr = &syscall.SysProcAttr{}
+ }
+ c.SysProcAttr.Setctty = true
+ c.SysProcAttr.Setsid = true
+ err = c.Start()
+ if err != nil {
+ pty.Close()
+ return nil, err
+ }
+ return pty, err
+}
diff --git a/types.go b/types.go
new file mode 100644
index 0000000..5aecb6b
--- /dev/null
+++ b/types.go
@@ -0,0 +1,10 @@
+// +build ignore
+
+package pty
+
+import "C"
+
+type (
+ _C_int C.int
+ _C_uint C.uint
+)
diff --git a/types_dragonfly.go b/types_dragonfly.go
new file mode 100644
index 0000000..5c0493b
--- /dev/null
+++ b/types_dragonfly.go
@@ -0,0 +1,17 @@
+// +build ignore
+
+package pty
+
+/*
+#define _KERNEL
+#include <sys/conf.h>
+#include <sys/param.h>
+#include <sys/filio.h>
+*/
+import "C"
+
+const (
+ _C_SPECNAMELEN = C.SPECNAMELEN /* max length of devicename */
+)
+
+type fiodgnameArg C.struct_fiodname_args
diff --git a/types_freebsd.go b/types_freebsd.go
new file mode 100644
index 0000000..ce3eb95
--- /dev/null
+++ b/types_freebsd.go
@@ -0,0 +1,15 @@
+// +build ignore
+
+package pty
+
+/*
+#include <sys/param.h>
+#include <sys/filio.h>
+*/
+import "C"
+
+const (
+ _C_SPECNAMELEN = C.SPECNAMELEN /* max length of devicename */
+)
+
+type fiodgnameArg C.struct_fiodgname_arg
diff --git a/util.go b/util.go
new file mode 100644
index 0000000..4b3ac78
--- /dev/null
+++ b/util.go
@@ -0,0 +1,64 @@
+// +build !windows
+
+package pty
+
+import (
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+// Getsize returns the number of rows (lines) and cols (positions
+// in each line) in terminal t.
+func Getsize(t *os.File) (rows, cols int, err error) {
+ var ws winsize
+ err = getwindowrect(&ws, t.Fd())
+ return int(ws.ws_row), int(ws.ws_col), err
+}
+
+// Setsize sets the number of rows (lines) and cols (positions
+// in each line) in terminal t. Both rows and cols have to be
+// positive integers.
+func Setsize(t *os.File, rows, cols int) error {
+ ws := winsize{
+ ws_col: uint16(cols),
+ ws_row: uint16(rows),
+ ws_xpixel: uint16(0), // not used
+ ws_ypixel: uint16(0), // not used
+ }
+
+ return setwindowrect(&ws, t.Fd())
+}
+
+type winsize struct {
+ ws_row uint16
+ ws_col uint16
+ ws_xpixel uint16
+ ws_ypixel uint16
+}
+
+func getwindowrect(ws *winsize, fd uintptr) error {
+ _, _, errno := syscall.Syscall(
+ syscall.SYS_IOCTL,
+ fd,
+ syscall.TIOCGWINSZ,
+ uintptr(unsafe.Pointer(ws)),
+ )
+ if errno != 0 {
+ return syscall.Errno(errno)
+ }
+ return nil
+}
+
+func setwindowrect(ws *winsize, fd uintptr) error {
+ _, _, errno := syscall.Syscall(
+ syscall.SYS_IOCTL,
+ fd,
+ syscall.TIOCSWINSZ,
+ uintptr(unsafe.Pointer(ws)),
+ )
+ if errno != 0 {
+ return syscall.Errno(errno)
+ }
+ return nil
+}
diff --git a/ztypes_386.go b/ztypes_386.go
new file mode 100644
index 0000000..ff0b8fd
--- /dev/null
+++ b/ztypes_386.go
@@ -0,0 +1,9 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_amd64.go b/ztypes_amd64.go
new file mode 100644
index 0000000..ff0b8fd
--- /dev/null
+++ b/ztypes_amd64.go
@@ -0,0 +1,9 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_arm.go b/ztypes_arm.go
new file mode 100644
index 0000000..ff0b8fd
--- /dev/null
+++ b/ztypes_arm.go
@@ -0,0 +1,9 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_arm64.go b/ztypes_arm64.go
new file mode 100644
index 0000000..6c29a4b
--- /dev/null
+++ b/ztypes_arm64.go
@@ -0,0 +1,11 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+// +build arm64
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_dragonfly_amd64.go b/ztypes_dragonfly_amd64.go
new file mode 100644
index 0000000..6b0ba03
--- /dev/null
+++ b/ztypes_dragonfly_amd64.go
@@ -0,0 +1,14 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_dragonfly.go
+
+package pty
+
+const (
+ _C_SPECNAMELEN = 0x3f
+)
+
+type fiodgnameArg struct {
+ Name *byte
+ Len uint32
+ Pad_cgo_0 [4]byte
+}
diff --git a/ztypes_freebsd_386.go b/ztypes_freebsd_386.go
new file mode 100644
index 0000000..d997537
--- /dev/null
+++ b/ztypes_freebsd_386.go
@@ -0,0 +1,13 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_freebsd.go
+
+package pty
+
+const (
+ _C_SPECNAMELEN = 0x3f
+)
+
+type fiodgnameArg struct {
+ Len int32
+ Buf *byte
+}
diff --git a/ztypes_freebsd_amd64.go b/ztypes_freebsd_amd64.go
new file mode 100644
index 0000000..5fa102f
--- /dev/null
+++ b/ztypes_freebsd_amd64.go
@@ -0,0 +1,14 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_freebsd.go
+
+package pty
+
+const (
+ _C_SPECNAMELEN = 0x3f
+)
+
+type fiodgnameArg struct {
+ Len int32
+ Pad_cgo_0 [4]byte
+ Buf *byte
+}
diff --git a/ztypes_freebsd_arm.go b/ztypes_freebsd_arm.go
new file mode 100644
index 0000000..d997537
--- /dev/null
+++ b/ztypes_freebsd_arm.go
@@ -0,0 +1,13 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_freebsd.go
+
+package pty
+
+const (
+ _C_SPECNAMELEN = 0x3f
+)
+
+type fiodgnameArg struct {
+ Len int32
+ Buf *byte
+}
diff --git a/ztypes_mipsx.go b/ztypes_mipsx.go
new file mode 100644
index 0000000..f0ce740
--- /dev/null
+++ b/ztypes_mipsx.go
@@ -0,0 +1,12 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+// +build linux
+// +build mips mipsle mips64 mips64le
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_ppc64.go b/ztypes_ppc64.go
new file mode 100644
index 0000000..4e1af84
--- /dev/null
+++ b/ztypes_ppc64.go
@@ -0,0 +1,11 @@
+// +build ppc64
+
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_ppc64le.go b/ztypes_ppc64le.go
new file mode 100644
index 0000000..e6780f4
--- /dev/null
+++ b/ztypes_ppc64le.go
@@ -0,0 +1,11 @@
+// +build ppc64le
+
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)
diff --git a/ztypes_s390x.go b/ztypes_s390x.go
new file mode 100644
index 0000000..a7452b6
--- /dev/null
+++ b/ztypes_s390x.go
@@ -0,0 +1,11 @@
+// +build s390x
+
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types.go
+
+package pty
+
+type (
+ _C_int int32
+ _C_uint uint32
+)