git: kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
Matthew Dillon
dillon at crater.dragonflybsd.org
Tue Nov 12 11:09:53 PST 2019
commit e7126f0a1027db73e43270705209e5b4120d77e5
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Tue Nov 12 11:00:42 2019 -0800
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
* Generally speaking we are implementing the features necessary
to allow per-thread titling set via pthread_set_name_np() to
show up in 'ps' output, and to use lpmap to make it fast.
* The lwp_setname() system call now stores the title in
lpmap->thread_title[].
* Implement a libc fast-path for lwp_setname() using lpmap.
If called more than 10 times, libc will use lpmap for any
further calls, which omits the need to make any system calls.
* setproctitle() now stores the title in upmap->proc_title[]
instead of replacing proc->p_args. proc->p_args is now no
longer modified from its original contents.
* The kernel now includes lpmap->thread_title[] in the following
priority order when retrieving the process command line:
lpmap->thread_title[] User-supplied thread title, if not empty
upmap->proc_title[] User-supplied process title, if not empty
proc->p_args Original process arguments (no longer modified)
* Put the TID in /dev/lpmap for convenient access
* Enhance the KERN_PROC_ARGS sysctl to allow the TID to be specified.
The sysctl now accepts { KERN_PROC, KERN_PROC_ARGS, pid, tid }
in addition to the existing { KERN_PROC, KERN_PROC_ARGS, pid }
mechanism.
Enhance libkvm to use the new feature. libkvm will fall-back to
the old version if necessary.
Summary of changes:
lib/libc/upmap/Makefile.inc | 2 +-
.../upmap/{ukp_setproctitle.c => ukp_setname.c} | 49 +++++---
lib/libkvm/kvm_proc.c | 23 +++-
sys/kern/kern_proc.c | 128 ++++++++++++++++++---
sys/kern/kern_prot.c | 29 +++--
sys/sys/proc.h | 1 +
sys/sys/upmap.h | 3 +-
sys/vfs/procfs/procfs_status.c | 20 +++-
8 files changed, 200 insertions(+), 55 deletions(-)
copy lib/libc/upmap/{ukp_setproctitle.c => ukp_setname.c} (61%)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e7126f0a1027db73e43270705209e5b4120d77e5
--
DragonFly BSD source repository
More information about the Commits
mailing list