mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
f5be3578a8
2/3 Added vendor/ dir to lock down dependent pkg versions. The author of git.schwanenlied.me/yawning/{chacha20,newhope,kyber}.git has copied their repos to gitlab.com/yawning/ but some imports of chacha20 from newhope still inconsistently refer to git.schwanenlied.me/, breaking build. Licenses for chacha20 also changed from CC0 to AGPL, which may or may not be an issue. Until the two aforementioned issues are resolved, locking to last-good versions is probably the best way forward for now. To build with vendored deps, use make VENDOR=1 clean all 3/3 Moved body of CI push script into bacillus/
33 lines
773 B
Go
33 lines
773 B
Go
package pty
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
func open() (pty, tty *os.File, err error) {
|
|
/*
|
|
* from ptm(4):
|
|
* The PTMGET command allocates a free pseudo terminal, changes its
|
|
* ownership to the caller, revokes the access privileges for all previous
|
|
* users, opens the file descriptors for the pty and tty devices and
|
|
* returns them to the caller in struct ptmget.
|
|
*/
|
|
|
|
p, err := os.OpenFile("/dev/ptm", os.O_RDWR|syscall.O_CLOEXEC, 0)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
defer p.Close()
|
|
|
|
var ptm ptmget
|
|
if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm")
|
|
tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm")
|
|
|
|
return pty, tty, nil
|
|
}
|