title: How to find number of children of a process in C?
body: <p>I am doing quite a lot of forking in a process (and the children of that process are further forking), and I want to keep an acceptable limit on the total number of processes I create.</p>
  
  <p>Is there a (preferably efficient) way of finding the total number of children of a process (including children of children, children of children of children, etc.) from C?</p>
  
  <p>I would like my code to work on both linux and mac, so no <code>/proc</code> I'm afraid!</p>