Change kinfo_proc interface between kernel and userland.
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 1 Feb 2007 10:33:26 +0000 (10:33 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 1 Feb 2007 10:33:26 +0000 (10:33 +0000)
commit5dfd06ac148512faf075c4e399e8485fd955578f
tree7477c0d17bf7633f5e44fd14d4e43edac38ea750
parent244b48f8b7b36bde8aa69872df8c6f1dd4cb3b37
Change kinfo_proc interface between kernel and userland.

Before, we were embedding a struct proc (among others) into struct
kinfo_proc.  Every time we change implementation details in the kernel,
userland has to be adapted (recompiled).  In preparation for the coming
LWP changes this interface has been reworked.  Now kinfo_proc is a
structure which does not depend on other structures on the kernel which
are subject to change.  Instead, the routines fill_kinfo_proc and
fill_kinfo_lwp copy all values which are of interest between the kernel
structure and the stable kinfo_proc structure.

Furthermore, this change adds infrastructure to export LWP-specific data.
If userland requests LWP data, it sets the flag KERN_PROC_FLAG_LWP in the
sysctl oid.  This leads to multiple kinfo_procs being exported.  If not
set, the first LWP will used.  This is like FreeBSD do it, and it seems
easy and simple.  Note that userland was not yet adjusted to actually
request LWPs and aggregate this information if necessary.  Besides, the
kernel does not yet have more than one LWP per process anyways.

This introduces a new file, kern/kern_kinfo.c, which is shared between
kernel and libkvm.  This was done to avoid and remove code duplication.
Now kvm_getprocs constructs a complete struct proc, including pointers,
and then calls fill_kinfo_proc to do its job.

In-collaboration-with: Thomas E. Spanjaard <tgen@netphreax.net>
34 files changed:
bin/ps/extern.h
bin/ps/keyword.c
bin/ps/print.c
bin/ps/ps.c
bin/ps/ps.h
contrib/ipfilter/ipsend/sock.c
lib/libc/gen/sysctl.3
lib/libkcore/kcore_file.c
lib/libkvm/Makefile
lib/libkvm/kvm.c
lib/libkvm/kvm.h
lib/libkvm/kvm_getprocs.3
lib/libkvm/kvm_private.h
lib/libkvm/kvm_proc.c
sys/conf/files
sys/kern/imgact_aout.c
sys/kern/kern_exit.c
sys/kern/kern_kinfo.c [new file with mode: 0644]
sys/kern/kern_proc.c
sys/sys/jail.h
sys/sys/kinfo.h
sys/sys/proc.h
sys/sys/sysctl.h
sys/sys/user.h
usr.bin/fstat/fstat.c
usr.bin/gcore/gcore.c
usr.bin/killall/killall.c
usr.bin/pkill/pkill.c
usr.bin/sockstat/sockstat.c
usr.bin/systat/pigs.c
usr.bin/top/machine.c
usr.bin/w/extern.h
usr.bin/w/proc_compare.c
usr.bin/w/w.c