mirror of
https://github.com/restic/restic.git
synced 2025-11-02 06:10:59 +00:00
12 lines
403 B
Go
12 lines
403 B
Go
package terminal
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
func tcgetpgrp(ttyfd int) (int, error) {
|
|
// We need to use IoctlGetUint32 here, because pid_t is 32-bit even on
|
|
// 64-bit Linux. IoctlGetInt doesn't work on big-endian platforms:
|
|
// https://github.com/golang/go/issues/45585
|
|
// https://github.com/golang/go/issues/60429
|
|
pid, err := unix.IoctlGetUint32(ttyfd, unix.TIOCGPGRP)
|
|
return int(pid), err
|
|
}
|