title: Grouping child processes with setpgid()
body: <p>I just don't get the whole thing.</p>
  
  <p>My process tree:</p>
  
  <pre><code>     0
      / \
     1   2
    /     \
   5       3
          / 
         4
  </code></pre>
  
  <p>I want to make a process group (3, 4, 5), and send this group a signal from, say, 2.</p>
  
  <p>I tried it this way:</p>
  
  <pre><code>setpgid(pid3, pid3);
  setpgid(pid4, pid3);
  setpgid(pid5, pid3);
  
  ...
  
  kill(-pid3, SIGUSR1);
  </code></pre>
  
  <p>Where should I place my <code>setpgid()</code> block? I tried placing it in 3, 0 and every other process, but <code>setpgid()</code>s return either "No such process" or "Operation not permitted".</p>
  
  <p>pids are stored in files, so I retrieve them just before calling <code>setpgid()</code></p>