2024-01-08 04:22:09 -05:00
|
|
|
//go:build !windows && go1.12
|
|
|
|
// +build !windows,go1.12
|
2019-04-19 07:03:37 -04:00
|
|
|
|
|
|
|
package pty
|
|
|
|
|
2024-01-08 04:22:09 -05:00
|
|
|
import "os"
|
2019-04-19 07:03:37 -04:00
|
|
|
|
2024-01-08 04:22:09 -05:00
|
|
|
func ioctl(f *os.File, cmd, ptr uintptr) error {
|
|
|
|
return ioctlInner(f.Fd(), cmd, ptr) // Fall back to blocking io.
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: Unused. Keeping for reference.
|
|
|
|
func ioctlNonblock(f *os.File, cmd, ptr uintptr) error {
|
|
|
|
sc, e := f.SyscallConn()
|
|
|
|
if e != nil {
|
|
|
|
return ioctlInner(f.Fd(), cmd, ptr) // Fall back to blocking io (old behavior).
|
|
|
|
}
|
|
|
|
|
|
|
|
ch := make(chan error, 1)
|
|
|
|
defer close(ch)
|
2023-04-26 20:20:43 -04:00
|
|
|
|
2024-01-08 04:22:09 -05:00
|
|
|
e = sc.Control(func(fd uintptr) { ch <- ioctlInner(fd, cmd, ptr) })
|
|
|
|
if e != nil {
|
2019-04-19 07:03:37 -04:00
|
|
|
return e
|
|
|
|
}
|
2024-01-08 04:22:09 -05:00
|
|
|
e = <-ch
|
|
|
|
return e
|
2019-04-19 07:03:37 -04:00
|
|
|
}
|