BSD: int ioctl (int tty, TIOCGETPGRP, int * foreground_group);
Linux: int tcgetpgrp (int tty, int * foreground_group);
Linux only works if you allow the use of a non-owner terminal, i.e. You are the root user. This is a deliberate security implementation. BSD ioctl () allows any tty to accept any process group (or even nonexisting process groups) as its foreground tty. POSIX only allows access to process groups for which tty is their control tty. This restriction prohibits some of the ambiguous security-related cases present in BSD ioctl.
? , , .
: /proc
www.die.net:
/Proc/ []/FD
, , , , . , 0 - , 1 , 2 ..