How to know the foreground process group ID of another console ??
First of all, I admit that I am not aware whether I can post this question here or not. But this is Linux related and is related to Processes and their information. Also, this is related to C System calls. Hence I was confused as to whether can I post this question here or not. However, I have collected all courage and posting it here !!
I would like to know as to how can we know the foreground process group ID of another console ( or chvt). Say for eg, I am working in /dev/tty1 and there is another process running in /dev/tty2. I would like to know as to what is the foreground process group ID of the process running in /dev/tty2. How can I achieve this? I tried to use the 'ioctl' system call in C language, but I could not succeed, probably due to wrong usage. Could anyone kindly guide me in achieving the above, using C system calls(preferable) or any other method ?