RE: process group problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The shell after doing a fork would explicitly call setpgid to set the process group of the child. So changing the kernel code doesn't help. The process group is explicitly set for purposes of job control. When a command is given at the shell prompt, that process or processes (if there is piping) is assigned a new process group. The processes belonging to this process group only would be allowed to read from the terminal. Job control commands like fg works on the basis of this process group id. This is why the shell has a different process group id from the processes that it spawns.

Gopu Bhaskar.

-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of surendra singh bisht
Sent: Tuesday, January 25, 2005 7:27 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: process group problem

  

    hi,
  
      it is known that child inherit the process group ID of its  parent then, why the process run by the shell do not inherit its
(shell) process group ID?? 

      suppose process p1 is run from the shell and it forks process p2 then p2 inherit process group of p1 but p1 doesn't inherit the proces group of shell....( can be seen by command ps -xj )

      even i'm doing it in kernel < copy_process() in  fork.c  >

          like p->pgrp = p->parent->pgrp 
          (p is task structure of child process)

    it is not working, why is it so..??

    any idea....

  surendra singh bisht




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux