mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-31 14:26:40 -04:00
unix: add IoctlGetPtmget on netbsd
This ioctl is used to implement ptsname on netbsd. Change-Id: Ic87f1bf7d15c6fbef0c2226a06a4983a504c3f30 Reviewed-on: https://go-review.googlesource.com/c/148097 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
3a76605856
commit
66b7b1311a
@@ -5,6 +5,7 @@
|
||||
package unix_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
@@ -33,3 +34,18 @@ func TestSysctlClockinfo(t *testing.T) {
|
||||
t.Logf("tick = %v, tickadj = %v, hz = %v, profhz = %v, stathz = %v",
|
||||
ci.Tick, ci.Tickadj, ci.Hz, ci.Profhz, ci.Stathz)
|
||||
}
|
||||
|
||||
func TestIoctlPtmget(t *testing.T) {
|
||||
fd, err := unix.Open("/dev/ptmx", unix.O_NOCTTY|unix.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
t.Skip("failed to open /dev/ptmx, skipping test")
|
||||
}
|
||||
defer unix.Close(fd)
|
||||
|
||||
ptm, err := unix.IoctlGetPtmget(fd, unix.TIOCPTSNAME)
|
||||
if err != nil {
|
||||
t.Fatalf("IoctlGetPtmget: %v\n", err)
|
||||
}
|
||||
|
||||
t.Logf("sfd = %v, ptsname = %v", ptm.Sfd, string(ptm.Sn[:bytes.IndexByte(ptm.Sn[:], 0)]))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user