kernel - Add reapctl() system call for managing sub-processes
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 10 Nov 2014 04:03:02 +0000 (20:03 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 10 Nov 2014 04:03:02 +0000 (20:03 -0800)
commit6e2a912cb0efa95728b97415088752bd859fc640
tree0bd69ecab2c716eea9b2f235c7d0cba14091ee6c
parent8fe17d28a7223b75ab0b25581aca03939d6ed2c0
kernel - Add reapctl() system call for managing sub-processes

* Add reapctl().  This system call allows the current process to become
  the designated reaper for all sub-processes that are directly or indirectly
  forked under it, even if they detach.

  Instead of reparenting to init, related sub-processes will reparent to
  up the tree to the nearest process with reaping management enabled.

* The system call can be run by any user.  Multiple processes in the
  running topology can be reap masters for the processes under them,
  include sub-processes being reap-masters for processes under them,
  recursively.

* The system call provides an easy way to ensure that all processes under
  the current process, when it is a reap master, to be killed.  The first
  child pid under management can be queried, killed, waited upon, and the
  service monitor then simply loops until no children remain.

  Normally this information might not be available or require a 'ps' style
  (expensive) run to obtain.  This way it can be done trivially and
  dependably via reapctl().
14 files changed:
lib/libc/sys/Symbol.map
lib/libc/sys/reapctl.2 [new file with mode: 0644]
sys/kern/init_main.c
sys/kern/init_sysent.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/syscalls.c
sys/kern/syscalls.master
sys/sys/proc.h
sys/sys/reaper.h [new file with mode: 0644]
sys/sys/syscall.h
sys/sys/syscall.mk
sys/sys/sysproto.h
sys/sys/sysunion.h