git: DragonFly_RELEASE_4_0 kernel - Add reapctl() system call for managing sub-processes

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Nov 10 23:01:11 PST 2014


commit 6260c20b39ae34ecd57a647c56e7ea93090fffed
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Nov 9 20:03:02 2014 -0800

    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().

Summary of changes:
 lib/libc/sys/Symbol.map                    |   3 +
 lib/libc/sys/reapctl.2                     | 128 +++++++++++++++
 sys/kern/init_main.c                       |   2 +
 sys/kern/init_sysent.c                     |   1 +
 sys/kern/kern_exit.c                       |  51 ++++--
 sys/kern/kern_fork.c                       | 250 +++++++++++++++++++++++++++++
 sys/kern/syscalls.c                        |   1 +
 sys/kern/syscalls.master                   |   1 +
 sys/sys/proc.h                             |   9 +-
 lib/libc/upmap/upmap.h => sys/sys/reaper.h |  50 +++++-
 sys/sys/syscall.h                          |   3 +-
 sys/sys/syscall.mk                         |   3 +-
 sys/sys/sysproto.h                         |   8 +
 sys/sys/sysunion.h                         |   1 +
 14 files changed, 489 insertions(+), 22 deletions(-)
 create mode 100644 lib/libc/sys/reapctl.2
 copy lib/libc/upmap/upmap.h => sys/sys/reaper.h (66%)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6260c20b39ae34ecd57a647c56e7ea93090fffed


-- 
DragonFly BSD source repository


More information about the Commits mailing list