2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-14 18:12:57 +00:00
cointop/vendor/github.com/creack/pty/ioctl_solaris.go

49 lines
1.1 KiB
Go
Raw Normal View History

2021-09-04 20:31:08 +00:00
//go:build solaris
//+build solaris
2020-07-26 20:40:59 +00:00
package pty
import (
2021-09-04 20:31:08 +00:00
"syscall"
2020-07-26 20:40:59 +00:00
"unsafe"
)
2021-09-04 20:31:08 +00:00
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
//go:linkname procioctl libc_ioctl
var procioctl uintptr
2020-07-26 20:40:59 +00:00
const (
// see /usr/include/sys/stropts.h
2021-09-04 20:31:08 +00:00
I_PUSH = uintptr((int32('S')<<8 | 002))
I_STR = uintptr((int32('S')<<8 | 010))
I_FIND = uintptr((int32('S')<<8 | 013))
2020-07-26 20:40:59 +00:00
// see /usr/include/sys/ptms.h
ISPTM = (int32('P') << 8) | 1
UNLKPT = (int32('P') << 8) | 2
PTSSTTY = (int32('P') << 8) | 3
ZONEPT = (int32('P') << 8) | 4
OWNERPT = (int32('P') << 8) | 5
2021-09-04 20:31:08 +00:00
// see /usr/include/sys/termios.h
TIOCSWINSZ = (uint32('T') << 8) | 103
TIOCGWINSZ = (uint32('T') << 8) | 104
2020-07-26 20:40:59 +00:00
)
type strioctl struct {
2021-09-04 20:31:08 +00:00
icCmd int32
icTimeout int32
icLen int32
icDP unsafe.Pointer
2020-07-26 20:40:59 +00:00
}
2021-09-04 20:31:08 +00:00
// Defined in asm_solaris_amd64.s.
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
2020-07-26 20:40:59 +00:00
func ioctl(fd, cmd, ptr uintptr) error {
2021-09-04 20:31:08 +00:00
if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, fd, cmd, ptr, 0, 0, 0); errno != 0 {
return errno
}
return nil
2020-07-26 20:40:59 +00:00
}