* Kill all children. * * @todo It would be kind of nice to make sure that they are actually * all our children before we kill them, because their pids may have * been recycled by some other process. Perhaps when we wait for a * child, we should remove it from this array. Alternatively we could * perhaps use process groups, but I think that would not work on * ancient Unix versions that do
| 610 | * ancient Unix versions that don't support them. |
| 611 | **/ |
| 612 | void kill_all(int sig) |
| 613 | { |
| 614 | int i; |
| 615 | |
| 616 | for (i = 0; i < num_pids; i++) { |
| 617 | /* Let's just be a little careful where we |
| 618 | * point that gun, hey? See kill(2) for the |
| 619 | * magic caused by negative values. */ |
| 620 | pid_t p = all_pids[i]; |
| 621 | |
| 622 | if (p == getpid()) |
| 623 | continue; |
| 624 | if (p <= 0) |
| 625 | continue; |
| 626 | |
| 627 | kill(p, sig); |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | /** Lock a byte range in a open file */ |
| 632 | int lock_range(int fd, int offset, int len) |