elvish/sys/tc.go

23 lines
374 B
Go
Raw Normal View History

2017-12-08 08:45:10 +08:00
// +build !windows,!plan9
2017-12-02 05:34:06 +08:00
package sys
import (
"unsafe"
"golang.org/x/sys/unix"
)
2017-01-17 07:42:02 +08:00
func Tcgetpgrp(fd int) (int, error) {
var pid int
errno := Ioctl(fd, unix.TIOCGPGRP, uintptr(unsafe.Pointer(&pid)))
if errno == nil {
return pid, nil
2017-01-17 07:42:02 +08:00
}
return -1, errno
2017-01-17 07:42:02 +08:00
}
func Tcsetpgrp(fd int, pid int) error {
return Ioctl(fd, unix.TIOCSPGRP, uintptr(unsafe.Pointer(&pid)))
}