Register handlers to be invoked after internal_fork() * to do various per-subsystem setup / cleanup tasks. * Takes a reference to a "stable" structure (i.e. static or * malloc'ed) which has to be alive until the last internal_fork() * is called. */
| 64 | * malloc'ed) which has to be alive until the last internal_fork() |
| 65 | * is called. */ |
| 66 | void register_fork_handler(struct internal_fork_handler *h) |
| 67 | { |
| 68 | struct internal_fork_handler *hp; |
| 69 | |
| 70 | if (is_main == 0) { |
| 71 | LM_BUG("buggy call from non-main process!!!\n"); |
| 72 | abort(); |
| 73 | } |
| 74 | if (h->_next != NULL) { |
| 75 | LM_BUG("buggy call h->_next != NULL!!!\n"); |
| 76 | abort(); |
| 77 | } |
| 78 | |
| 79 | for (hp = _fork_handlers; hp->_next != NULL; hp = hp->_next) |
| 80 | continue; |
| 81 | hp->_next = h; |
| 82 | }; |
| 83 | |
| 84 | static unsigned long count_running_processes(void *x) |
| 85 | { |