title: C unix: sending a signal to a process with kill isn't the same that from keybord..why?
body: <p>So I have this parent process A which forks and creates some processes, B and C. C itself will create more, but I don't think it matters.</p>
  
  <p>A forks: </p>
  
  <pre><code>char *argv_exec[] = {
      "/usr/bin/xfce4-terminal",
      "--geometry",
      "160x48",
      "-x",
      "./tv",
      NULL };
  
  pid_tv = fork();
  
  if (pid_tv == 0)
  {   
      (void) execv(argv_exec[0], argv_exec);
      fprintf (stderr, "Errore nella execv.\n%s\n",
      strerror(errno) );
      anelito(0);
  } 
  </code></pre>
  
  <p>While they all run together, I want to be able to send a signal from process B to its parent process A to make him do something - in this case kill all children and re-fork.</p>
  
  <p>Process A sends its pid to process B in a message.</p>
  
  <p>Parent A handles the signal:</p>
  
  <pre><code>if(signal(SIGQUIT,riparti)==SIG_ERR)
      ...
      void riparti(int s)
      { 
                 kill_all_children();
                 fork_all_children_again();
      }
  </code></pre>
  
  <p>Process B sends a SIGQUIT to A when it receives one (it bounces it)
  process B has:</p>
  
  <pre><code>signal(SIGQUIT,riparti);
  
  void riparti(int a)
      {
            kill(pid_parent,SIGQUIT);
      }
  </code></pre>
  
  <p>Now when i press CTRL+\ on the window of process B once, all goes well.
  If i do it a second time, process A does not seem to receive the signal anymore.</p>