func (tg *ThreadGroup) ForegroundProcessGroup(tty *TTY) (int32, error) {
	tty.mu.Lock()
	defer tty.mu.Unlock()

	tg.pidns.owner.mu.Lock()
	defer tg.pidns.owner.mu.Unlock()
	tg.signalHandlers.mu.Lock()
	defer tg.signalHandlers.mu.Unlock()

	// "When fd does not refer to the controlling terminal of the calling
	// process, -1 is returned" - tcgetpgrp(3)
	if tg.tty != tty {
		return -1, syserror.ENOTTY
	}

	return int32(tg.processGroup.session.foreground.id), nil
}
// ForegroundProcessGroup returns the process group ID of the foreground
// process group.
ForegroundProcessGroup returns the process group ID of the foreground
process group.
// ForegroundProcessGroup returns the process group ID of the foreground // process group .
func (tg *ThreadGroup) ForegroundProcessGroup(tty *TTY) (int32, error) {
	tty.mu.Lock()
	defer tty.mu.Unlock()
	tg.pidns.owner.mu.Lock()
	defer tg.pidns.owner.mu.Unlock()
	tg.signalHandlers.mu.Lock()
	defer tg.signalHandlers.mu.Unlock()
	if tg.tty != tty {
		return -1, syserror.ENOTTY
	}
	return int32(tg.processGroup.session.foreground.id), nil
}
func ( tg * ThreadGroup ) ForegroundProcessGroup ( tty * TTY ) ( int32 , error ) { tty . mu . Lock ( ) defer tty . mu . Unlock ( ) tg . pidns . owner . mu . Lock ( ) defer tg . pidns . owner . mu . Unlock ( ) tg . signalHandlers . mu . Lock ( ) defer tg . signalHandlers . mu . Unlock ( ) if tg . tty != tty { return - 1 , syserror . ENOTTY } return int32 ( tg . processGroup . session . foreground . id ) , nil }
ForegroundProcessGroup returns the process group ID of the foreground
process group.
ForegroundProcessGroup returns the process group ID of the foreground process group .
// "When fd does not refer to the controlling terminal of the calling // process, -1 is returned" - tcgetpgrp(3)