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