File: pty_solaris.go

package info (click to toggle)
golang-github-pkg-term 1.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 244 kB
  • sloc: makefile: 2
file content (33 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
package termios

// #include<stdlib.h>
import "C"

import "syscall"

func open_pty_master() (uintptr, error) {
	return open_device("/dev/ptmx")
}

func Ptsname(fd uintptr) (string, error) {
	slavename := C.GoString(C.ptsname(C.int(fd)))
	return slavename, nil
}

func grantpt(fd uintptr) error {
	rc := C.grantpt(C.int(fd))
	if rc == 0 {
		return nil
	} else {
		return syscall.Errno(rc)
	}
}

func unlockpt(fd uintptr) error {
	rc := C.unlockpt(C.int(fd))
	if rc == 0 {
		return nil
	} else {
		return syscall.Errno(rc)
	}
}