-
-
Notifications
You must be signed in to change notification settings - Fork 258
Expand file tree
/
Copy pathioctl.go
More file actions
28 lines (22 loc) · 590 Bytes
/
ioctl.go
File metadata and controls
28 lines (22 loc) · 590 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//go:build !windows && go1.12
// +build !windows,go1.12
package pty
import "os"
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)
e = sc.Control(func(fd uintptr) { ch <- ioctlInner(fd, cmd, ptr) })
if e != nil {
return e
}
e = <-ch
return e
}