pty_solaris.go 526 B

123456789101112131415161718192021222324252627282930313233
  1. package termios
  2. // #include<stdlib.h>
  3. import "C"
  4. import "syscall"
  5. func open_pty_master() (uintptr, error) {
  6. return open_device("/dev/ptmx")
  7. }
  8. func Ptsname(fd uintptr) (string, error) {
  9. slavename := C.GoString(C.ptsname(C.int(fd)))
  10. return slavename, nil
  11. }
  12. func grantpt(fd uintptr) error {
  13. rc := C.grantpt(C.int(fd))
  14. if rc == 0 {
  15. return nil
  16. } else {
  17. return syscall.Errno(rc)
  18. }
  19. }
  20. func unlockpt(fd uintptr) error {
  21. rc := C.unlockpt(C.int(fd))
  22. if rc == 0 {
  23. return nil
  24. } else {
  25. return syscall.Errno(rc)
  26. }
  27. }