Reads the process group and the terminal foreground group from the text of /proc/self/stat or from ps -o pgid= -o tpgid=.
/proc/self/stat
ps -o pgid= -o tpgid=
The stat line or the ps output
True when the process is in the foreground
Reads the process group and the terminal foreground group from the text of
/proc/self/stator fromps -o pgid= -o tpgid=.