Diassociating process from control terminal
hi,I'm really stuck here
I started reading a book on network programming,but the problem is
that this book is for Unix systems and I run Linux.Furtunatelly,the
author spends some time describing Unix environment.But when it came
to Control terminals and diassociating daemons from them,I was lost.
For starters,Im not shure if I understand how terminal group ID in the
tty structure works.
Is each time a job-control shell forks a new process (foreground
job),the terminal group ID changed to refer to this job?Does that mean
that all other process groups associated with this terminal will be
blocked if they try to read or write to terminal?
Secondly,System V has a different method from 4.3BSD
In system V you call fork() and in child process you call setpgrp().I
tried it but when I checked ps -A ,process was still associated with
tty3
It worked with ioctl(fd,TIOCNOTTY,(char *)0);
so Im wondering why didn't call to setpgrp() manage to do the
same?Afterall,isn't the way to diassociate from Control terminal to
put process in process group whose group's ID is zero?
And that is what setpgrp() also did.
Does linux assign control terminal to process only if the process
group ID is zero (as is the case with 4.3DSD)?
thank you very much for taking the time
|