github.com/dolfly/pty@v1.2.1/ioctl_solaris.go (about) 1 //go:build solaris 2 //+build solaris 3 4 package pty 5 6 import ( 7 "syscall" 8 "unsafe" 9 ) 10 11 //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" 12 //go:linkname procioctl libc_ioctl 13 var procioctl uintptr 14 15 const ( 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 33 type strioctl struct { 34 icCmd int32 35 icTimeout int32 36 icLen int32 37 icDP unsafe.Pointer 38 } 39 40 // Defined in asm_solaris_amd64.s. 41 func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 42 43 func 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 }