summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_proc2.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Revert the convertion of per-process thread into a SMR_TAILQ.mpi2021-02-081-6/+5
| | | | | We did not reach a consensus about using SMR to unlock single_thread_set() so there's no point in keeping this change.
* Convert the per-process thread list into a SMR_TAILQ.mpi2020-12-071-5/+6
| | | | | | | Currently all iterations are done under KERNEL_LOCK() and therefor use the *_LOCKED() variant. From and ok claudio@
* add sys/wait.h to unbreak builds; following "Replace p_xstat with ps_xexit andsthen2019-12-111-1/+2
| | | | | | | | | ps_xsig" (sysctl.h r1.198 and friends) FILL_KPROC requires W_EXITCODE from there. cc -static -pie -o ps keyword.o nlist.o print.o ps.o utf8.o -lkvm ld: error: undefined symbol: W_EXITCODE >>> referenced by kvm_proc2.c:293 (/usr/src/lib/libkvm/kvm_proc2.c:293) [...]
* struct proc: change ps_start from utc time to uptimecheloha2019-10-221-1/+37
| | | | | | | | | Allows us to determine how long a process has been running, even if the UTC clock jumps. With help from bluhm@ and millert@, who squashed several bugs. ok bluhm@ millert@
* Export unveil state so that ps(8) can show it. Two new status flags,deraadt2019-06-231-1/+2
| | | | | | | | you'll see one, or neither. 'u' - process installed unveils, but not yet locked with unveil(0,0) or pledge w/o "unveil" 'U' - process has installed unveils, and locked. ok rob
* fix print not specified process.asou2019-06-071-2/+2
| | | | ok guenther@ yasuoka@
* Split PID from TID, giving processes a PID unrelated to the TID of theirguenther2016-11-071-28/+14
| | | | | | initial thread ok jsing@ kettenis@
* port the changes just made to kvm_getfiles in kvm_file2.c r1.47 todlg2015-09-081-25/+27
| | | | | | | | | kvm_getprocs. basically cope with the number of procs growing between when we get the size and when we get the list. ok guenther@
* Apply reallocarray() idiom.deraadt2014-10-151-2/+2
| | | | ok guenther
* sys/user.h can now be substantially gutted.deraadt2014-07-081-2/+4
| | | | ok guenther
* Track whether a process is a zombie or not yet fully built via flagsguenther2014-07-041-8/+27
| | | | | | | | | | | PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
* Get the vmspace pointer from the process, not the threadguenther2014-05-251-2/+2
|
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-12/+6
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* Unbreak tree; p_sigacts moved from struct proc to struct processflorian2014-03-221-4/+4
|
* More crash dump parsing fixes: correct paddr in process info and pidsguenther2014-02-051-3/+3
| | | | | | in file info. Drop some unnecessary casts and unused variables too. ok millert@
* Threads can't be zombies, only processes, so change zombproc to zombprocess,guenther2014-01-201-75/+103
| | | | | | | | make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread flags to process flags. Add allprocess list for the code that just wants to see processes. ok tedu@
* Apply format __attribute__ to _kvm_err() and fix the errors that it detects.guenther2013-11-121-28/+32
| | | | | | | Treat failure to KREAD teh pcredd or ucreds to be errors insteading of continuing with bogus data. ok deraadt@ millert@
* spacesderaadt2013-03-201-2/+2
|
* When non-root asks sysctl for kinfo proc or file requests, do not fill inderaadt2013-03-201-3/+3
| | | | | any kernel addresses information. ok guenther
* Fix pid matching on kernel crashdumps in kvm_getprocs(KERN_PROC_PID)guenther2012-11-121-2/+2
|
* Make it optional for kvm_getprocs() (and related sysctl) to returnpirofti2012-04-171-1/+9
| | | | | | | | | | | | thread information. Add a KERN_PROC_SHOW_THREADS flag that has to be set in order to get the thread info and make it off by default. This creates backwards compatibility for applications that relied on a given size/number of items to be returned. Modify ps(1) and top(1) accordingly. Okay guenther@.
* Update to match nprocs-->nprocess/nthreads changesguenther2012-04-141-16/+17
|
* Add per thread accounting, mainly for usage & friends.pirofti2012-04-121-3/+34
| | | | | | | | | | | | | | This expands the already bloated FILL_KPROC macro to take an extra parameter that indicates if the callee is a thread or a process. The userland bits are adjusted accordingly and ps(1) and top(1) now display per thread usage times when -H is used. Also pkill(1) had to be adjusted so that duplicates don't pop up. libkvm does basically the same thing as the kernel bits. Okay guenther@.
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-8/+2
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* Add rtable id and thread id to struct kinfo_proc (and fix process id)guenther2012-01-071-9/+14
| | | | | | | | | | | and add an 'rtableid' keyword to ps. Add rtable id, thread id, and socket splice info to struct kinfo_file2 and make fstat display socket splice information. Remove old KVM_PROC2 and kinfo_proc2 interfaces; bump libkvm major Socket splice info and corrections from bluhm@ "Lovely" deraadt@
* Recommit the reverted sigacts change now that the NFS use-after-freeguenther2011-07-051-2/+14
| | | | | | | | problem has been tracked down. This fixes the sharing of the signal handling state: shared bits go in sigacts, per-rthread bits goes in struct proc. ok deraadt@
* Revert the sigacts diff: NFS can apparently retain pointers to processesguenther2011-04-181-14/+2
| | | | | | until they're zombies and then send them signals (for intr mounts). Until that is untangled, the sigacts change is unsafe. sthen@ was the victim for this one
* p_sigacts is NULL for zombies, so FILL_KPROC() and kvm_proclist() haveguenther2011-04-151-7/+12
| | | | | | to handle that with the sigacts change. problem observed and diagnosed by claudio@ and kettenis@
* Correct the sharing of the signal handling state: stuff that shouldguenther2011-04-151-2/+9
| | | | | | | | | | | | be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@
* Replace the old, broken KERN_PROC ABI and its matching functionsguenther2011-03-121-20/+26
| | | | | | | | | in libkvm with the stable-ABI versions that are currently named KERN_PROC2, kvm_get{proc,argv,envv}2(). The latter names and symbols will continue to be supported for a few releases. Committing now that they ports people have had a couple releases to update pkgs that usd the old functions
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-14/+27
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* Fail instead of lying if a process asks sysctl()'s KERN_PROC2 orguenther2010-06-291-1/+7
| | | | | | | KERN_FILE2 (or their libkvm wrappers) for more information than the running implementation knows how to provide. ok millert@ deraadt@
* Reimplement kvm_getproc2()'s support for reading crash dumps andguenther2010-01-101-0/+378
/dev/mem to be direct instead of going through kvm_getprocs(), as that function is going to get more an more broken as we move stuff from struct proc to struct process for rthreads. To minimize the code copying, put the common logic of filling in a kinfo_proc2 structure into a macro FILL_KPROC2() in <sys/sysctl.h> for use from both the kernel and user-space. This also hides the KERN_PROC #define behind "#if defined(_KERNEL)||defined(_LIBKVM)", as it's deprecated. Positive feedback from millert and blambert; so committing to unblock further rthreads work.