...
1
2
3
4
5 package unix
6
7 import (
8 "internal/abi"
9 "unsafe"
10 )
11
12
13 func libc_grantpt_trampoline()
14
15 func Grantpt(fd int) error {
16 _, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_grantpt_trampoline), uintptr(fd), 0, 0, 0, 0, 0)
17 if errno != 0 {
18 return errno
19 }
20 return nil
21 }
22
23
24 func libc_unlockpt_trampoline()
25
26 func Unlockpt(fd int) error {
27 _, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_unlockpt_trampoline), uintptr(fd), 0, 0, 0, 0, 0)
28 if errno != 0 {
29 return errno
30 }
31 return nil
32 }
33
34
35 func libc_ptsname_r_trampoline()
36
37 func Ptsname(fd int) (string, error) {
38 buf := make([]byte, 256)
39 _, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_ptsname_r_trampoline),
40 uintptr(fd),
41 uintptr(unsafe.Pointer(&buf[0])),
42 uintptr(len(buf)-1),
43 0, 0, 0)
44 if errno != 0 {
45 return "", errno
46 }
47 for i, c := range buf {
48 if c == 0 {
49 buf = buf[:i]
50 break
51 }
52 }
53 return string(buf), nil
54 }
55
56
57 func libc_posix_openpt_trampoline()
58
59 func PosixOpenpt(flag int) (fd int, err error) {
60 ufd, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_posix_openpt_trampoline), uintptr(flag), 0, 0, 0, 0, 0)
61 if errno != 0 {
62 return -1, errno
63 }
64 return int(ufd), nil
65 }
66
View as plain text