Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!botter!ark!rmgtkro From: rmgtkro@cs.vu.nl (Rob ten Kroode) Newsgroups: comp.os.minix Subject: Re: Process group initialization (was: SIGNAL Handling Problems) Message-ID: <1019@ark.cs.vu.nl> Date: Mon, 18-May-87 13:24:28 EDT Article-I.D.: ark.1019 Posted: Mon May 18 13:24:28 1987 Date-Received: Tue, 19-May-87 04:18:45 EDT References: <3882@cae780.TEK.COM> <2508@ncoast.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 43 In article <2508@ncoast.UUCP> allbery@ncoast.UUCP (Brandon Allbery) writes: >As quoted from <3882@cae780.TEK.COM> by hubble@cae780.TEK.COM (Larry Hubble): >+--------------- >| Third and last, the process group is never set to anything. Which means >| it is always zero now. I'm not sure what I did is the best answer, but >| it works. In mm/forkexit.c when a fork is done, do_fork() now looks to >| see if the parent doing the fork is INIT. If it is INIT, a new PRIVATE >| variable (process_group) is incremented and put in the process table. >| If the parent is not INIT, the child inherits the parents process group. >+--------------- > >The process group should be the same as the parent process's pid. The correct >fix would not be in the kernel, it should be in init. After init forks a >child but before the child execs getty (login?), the child should setpgrp(). >(Okay, I lied; this requires MM to have a setpgrp() system call. Probably it >should be added to do_getset(). The action of setpgrp() is to set the caller's >pgrp to its pid, and any process should be allowed to do this, so very little >if any checking should need to be done.) > >++Brando I don't agree. A process should inherit it's parent's process group (unless you put the child in a specified process group). This means I don't check in do_fork() if the parent is INIT. During initiliation I put INIT in a "special" process-group. In the INIT-program all the children are put in a process group which differs from it's parent. The action of setpgrp() is NOT to set the caller's process group to it's pid. Setpgrp() has two arguments: a pid, and a process group. Setpgrp() puts the process whith the specified pid in the specified process group (which is most of the time the pid). I made setpgrp() and getpgrp(), which returns the process group of the specified pid. I made these system calls while I was busy imlementing job-control for MINIX. I had to change a lot before it worked properly, but now everything seems to work perfect (I only need a new shell, but I don't have time to write a new one myself). If someone wants the sources of setpgrp(), getpgrp() and/or job-control please let me know (the sources of job-control are a LOT of diff's !). Rob ten Kroode (rmgtkro@cs.vu.nl).