title: How to kill a spawned "/bin/sh -c" and all its subprocesses using linux syscalls
body: <p>When I start background processes in a shell using the &amp; operator, if I close the terminal window, all these subprocesses end.</p>
  
  <p>How can I copy this behavior to close an arbitrary process and its children?<br>
  For example, if I use the execve syscall to execute this command line :</p>
  
  <pre><code>/bin/sh -c "watch ls &amp; watch ls -lah"
  </code></pre>
  
  <p>and I have the PID of the /bin/sh process, I tried to send the SIGHUP signal which should be transmitted to the sons of /bin/sh, but the other processes keep running.</p>
  
  <p>Why aren't the two "watch" processes killed? And is there a way to kill /bin/sh that would also kill them?</p>