1//go:build solaris 2//+build solaris 3 4package pty 5 6import ( 7 "syscall" 8 "unsafe" 9) 10 11//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" 12//go:linkname procioctl libc_ioctl 13var procioctl uintptr 14 15const ( 16 // see /usr/include/sys/stropts.h 17 I_PUSH = uintptr((int32('S')<<8 | 002)) 18 I_STR = uintptr((int32('S')<<8 | 010)) 19 I_FIND = uintptr((int32('S')<<8 | 013)) 20 21 // see /usr/include/sys/ptms.h 22 ISPTM = (int32('P') << 8) | 1 23 UNLKPT = (int32('P') << 8) | 2 24 PTSSTTY = (int32('P') << 8) | 3 25 ZONEPT = (int32('P') << 8) | 4 26 OWNERPT = (int32('P') << 8) | 5 27 28 // see /usr/include/sys/termios.h 29 TIOCSWINSZ = (uint32('T') << 8) | 103 30 TIOCGWINSZ = (uint32('T') << 8) | 104 31) 32 33type strioctl struct { 34 icCmd int32 35 icTimeout int32 36 icLen int32 37 icDP unsafe.Pointer 38} 39 40// Defined in asm_solaris_amd64.s. 41func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 42 43func ioctl(fd, cmd, ptr uintptr) error { 44 if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, fd, cmd, ptr, 0, 0, 0); errno != 0 { 45 return errno 46 } 47 return nil 48} 49