summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_proc.c
Commit message (Collapse)AuthorAgeFilesLines
* Catch up to SMTX -> SLOCK changes.John Baldwin2002-10-021-7/+7
| | | | Notes: svn path=/head/; revision=104388
* Ressurect libkvm use of the bitmasked signal list in the kernel, now thatJuli Mallett2002-10-011-7/+1
| | | | | | | reliable signal queues are gone. Notes: svn path=/head/; revision=104307
* Fix typo, should zero the kinfo_proc's siglist, not the real one's - the realJuli Mallett2002-10-011-1/+1
| | | | | | | | | | one doesn't have one. Submitted by: jake, scottl Big pointed hat that lands one in the badcommitters box to: jmallett Notes: svn path=/head/; revision=104248
* The list of queued signals is not, can not, and will not be exported to theJuli Mallett2002-09-301-1/+7
| | | | | | | | | userland. If someone wants to implement a backup p_siglist in the kernel for compatability and to export one could. For now, just tell KVM to hand an empty signal set off to the userland. Notes: svn path=/head/; revision=104243
* Fixed messes involving $FreeBSD$ starting with one left in the copyrightBruce Evans2002-09-161-21/+5
| | | | | | | | | | | after adding __FBSDID(). Garbage-collected kvm_readswap(). This was once used by kvm_uread(), but kvm_uread() now just reads /proc/<pid>/mem and procfs hopefully handles swapped out pages. Notes: svn path=/head/; revision=103385
* Allocate KSEs and KSEGRPs separatly and remove them from the proc structure.Julian Elischer2002-09-151-12/+45
| | | | | | | | | | | | next step is to allow > 1 to be allocated per process. This would give multi-processor threads. (when the rest of the infrastructure is in place) While doing this I noticed libkvm and sys/kern/kern_proc.c:fill_kinfo_proc are diverging more than they should.. corrective action needed soon. Notes: svn path=/head/; revision=103367
* Completely redo thread states.Julian Elischer2002-09-111-21/+24
| | | | | | | Reviewed by: davidxu@freebsd.org Notes: svn path=/head/; revision=103216
* Hopefully unbreak world. ke_slptime is gone. It should really have beenPeter Wemm2002-08-301-1/+1
| | | | | | | looking at p_ksegrp.kg_slptime anyway. Notes: svn path=/head/; revision=102594
* Allow one to grab the definition of struct ucred by defining _WANT_UCREDAlfred Perlstein2002-08-281-2/+1
| | | | | | | | | | instead of forcing _KERNEL. Move the include of sys/_label.h in ucred.h under the _KERNEL || _WANT_UCRED case. Notes: svn path=/head/; revision=102538
* &x is not a format stringKris Kennaway2002-08-241-1/+1
| | | | Notes: svn path=/head/; revision=102350
* Hide 'struct ucred' behind '#ifdef _KERNEL', this should stop userlandAlfred Perlstein2002-08-161-0/+3
| | | | | | | | | | from attempting to use it for good. There is a catch, kvm_proc.c needs to '#define _KERNEL' to get at the ucred. Requested by: rwatson Notes: svn path=/head/; revision=101968
* Don't even read in the thread if it is a zombie process.Julian Elischer2002-06-301-7/+10
| | | | Notes: svn path=/head/; revision=99157
* grow a brain and do this right.Julian Elischer2002-06-301-5/+7
| | | | Notes: svn path=/head/; revision=99142
* Don't follow non existant thread pointers (e.g. for zombies)Julian Elischer2002-06-301-33/+35
| | | | Notes: svn path=/head/; revision=99128
* Part 1 of KSE-IIIJulian Elischer2002-06-291-2/+19
| | | | | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals.. Notes: svn path=/head/; revision=99072
* Fix (for the second time) kvm_getprocs() for the case where noDima Dorfman2002-04-071-0/+26
| | | | | | | | | | | | | | | processes match the given criteria. Since revision 1.60 of malloc.c, malloc() and friends return an invalid pointer when given a size of 0. kvm_getprocs() uses sysctl() with a NULL oldp argument to get an initial size, but does not check whether it's 0 before passing it to realloc() (via _kvm_realloc()). Before the aforementioned malloc() change, this resulted in a minimal allocation made and a valid poitner returned, but now results in an invalid, but non-NULL, pointer being returned. When this is passed to sysctl(), the latter returns EFAULT (as it should). Notes: svn path=/head/; revision=94028
* Remove 'register' keyword.David E. O'Brien2002-03-211-17/+17
| | | | Notes: svn path=/head/; revision=92913
* Also blindly attempt to fix broken world with respect to proc.p_runtimeBrian Feldman2002-02-221-1/+3
| | | | | | | changes. Notes: svn path=/head/; revision=91075
* I THINK this fixes 'make world'Julian Elischer2002-02-131-1/+4
| | | | | | | | | I'll know as soon as I re-import it and compile it.. :-) There is no longer a 'pri' strict in the proc struct. the fields are scattered between the ksegrp and thread in question. Notes: svn path=/head/; revision=90592
* pre-emptively fix a KSE/M3 problem.Julian Elischer2002-02-071-7/+14
| | | | | | | | | | Make a slight change so that libkvm reaches the main thread via the linked list, rather than assuming it is in the proc structure. Both conditions are true in -current but only the first will be true in the KSE M3 world. Notes: svn path=/head/; revision=90360
* kern.ps_arg_max_cache is a long, not an int. I believe this is half ofPeter Wemm2001-11-081-1/+1
| | | | | | | | | what broke ps on ia64. It probably also broke on alpha, but the fallback method of using lseek/read on /proc/*/mem to read ps_strings seems to work there. It doesn't on ia64 yet. Notes: svn path=/head/; revision=86179
* Compensate for "Compensate for header dethreading" by backing it out.Bruce Evans2001-10-101-2/+0
| | | | Notes: svn path=/head/; revision=84768
* Implement __FBSDID()Matthew Dillon2001-09-161-0/+3
| | | | Notes: svn path=/head/; revision=83551
* KSE Milestone 2Julian Elischer2001-09-121-15/+16
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Make ps -M corefile work again. This has been broken for quite some time.Peter Wemm2001-08-241-6/+11
| | | | | | | kvm_proclist() was aborting when it saw the ithreads with no pgrp. Notes: svn path=/head/; revision=82266
* o Merge contents of struct pcred into struct ucred. Specifically, add theRobert Watson2001-05-251-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account. Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit Notes: svn path=/head/; revision=77183
* Avoid dividing by zero if kd->procbase->ki_structsize is uninitalised.David Malone2001-05-031-1/+1
| | | | | | | | (I'm testing the numerator rather than the denominator, which looks weird, but is the right thing to do here). Notes: svn path=/head/; revision=76243
* Don't give a warning about "proc size mismatch" if no struct wereDavid Malone2001-05-011-1/+2
| | | | | | | | | | returned. (This arose on a list about a month ago when someone found bogus warnings if they used "ps -Uuser_with_no_processes".) Approved by: mckusick Notes: svn path=/head/; revision=76182
* Compensate for header dethreading.Mark Murray2001-05-011-0/+2
| | | | Notes: svn path=/head/; revision=76176
* Catch up to new priority interface.Jake Burkholder2001-02-121-4/+1
| | | | Notes: svn path=/head/; revision=72377
* Add a new item to kinfo_proc: ki_sflag to mirror p_sflag.John Baldwin2001-01-241-1/+2
| | | | Notes: svn path=/head/; revision=71577
* Revert rev. 1.27. This file only included <sys/select.h> because ofGarrett Wollman2001-01-201-3/+0
| | | | | | | | brokenness introduced in <sys/select.h> rev. 1.8 which is now OBE. <sys/tty.h> and <sys/selinfo.h> together do the right thing. Notes: svn path=/head/; revision=71289
* Use macro API to <sys/queue.h>Ben Smithurst2000-12-301-1/+1
| | | | Notes: svn path=/head/; revision=70525
* Change the proc information returned from the kernel so that itKirk McKusick2000-12-121-73/+159
| | | | | | | | | | | | | | | no longer contains kernel specific data structures, but rather only scalar values and structures that are already part of the kernel/user interface, specifically rusage and rtprio. It no longer contains proc, session, pcred, ucred, procsig, vmspace, pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If any of these changed in size, ps, w, fstat, gcore, systat, and top would all stop working. The new structure has over 200 bytes of unassigned space for future values to be added, yet is nearly 100 bytes smaller per entry than the structure that it replaced. Notes: svn path=/head/; revision=69896
* Good, fixing the header showed incorrect usage of it! #define _KERNELBrian Feldman2000-08-061-0/+3
| | | | | | | here for the include of sys/select.h. Notes: svn path=/head/; revision=64297
* -Wall, which caught a real bug where buflen wasn't being set properly.David E. O'Brien2000-03-271-8/+9
| | | | Notes: svn path=/head/; revision=58642
* Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb jugglingPeter Wemm1999-12-271-1/+6
| | | | | | | | | and is module aware. Yes, this means that kvm_nlist(3) will find symbols in loaded modules. The emulation of the nlist struct is pretty crude but seems to work well enough for all the users in the tree that I found. Notes: svn path=/head/; revision=55127
* Introduce commandline caching in the kernel.Poul-Henning Kamp1999-11-161-0/+48
| | | | | | | | | | | | | | This fixes some nasty procfs problems for SMP, makes ps(1) run much faster, and makes ps(1) even less dependent on /proc which will aid chroot and jails alike. To disable this facility and revert to previous behaviour: sysctl -w kern.ps_arg_cache_limit=0 For full details see the current@FreeBSD.org mail-archives. Notes: svn path=/head/; revision=53239
* Adjust for kern.ps_strings and PS_STRINGS not being a pointer. ThisBruce Evans1998-12-161-17/+12
| | | | | | | | | | | | | fixes a type mismatch in the call to kvm_uread(). The bug has gone undetected for almost 3 years because kvm_uproc()'s protoype has been disabled for almost 4 years. Trust sysctlbyname() to work properly if it succeeds. Fixed style bugs in revs. 1.19 and 1.22. Notes: svn path=/head/; revision=41880
* Avoid the "Cannot allocate memory" problem that appears on heavilyDag-Erling Smørgrav1998-10-121-4/+10
| | | | | | | | | | | | loaded systems by retrying the sysctl() with a larger buffer if it fails with ENOMEM. For good measure, allocate 10% more memory than sysctl() claims is necessary. PR: 8275 Reviewed by: David Greenman <dg@freebsd.org> Notes: svn path=/head/; revision=40268
* Replace memory leaking instances of realloc with non-leaking reallocf.Warner Losh1998-09-161-1/+3
| | | | | | | | | | | | | | In some cases replace if (a == null) a = malloc(x); else a = realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is guaranteed to be the same thing. I've been running these on my system here w/o ill effects for some time. However, the CTM-express is at part 6 of 34 for the CAM changes, so I've not been able to do a build world with the CAM in the tree with these changes. Shouldn't impact anything, but... Notes: svn path=/head/; revision=39327
* The length argument to sysctl is now size_t.Doug Rabson1998-08-251-2/+4
| | | | Notes: svn path=/head/; revision=38534
* Allow /dev/null as path for the "/dev/mem" file, and assume that peoplePoul-Henning Kamp1998-06-301-20/+24
| | | | | | | | | | know what they're doing if they do that. This will allow ps to use the kvm_proc.c bits without having access to /dev/mem. Fix kvm_proc.c to not need /dev/mem for access to argv/envp Notes: svn path=/head/; revision=37316
* Fixed bugs in the conversion of kvm to to use procfs in rev.1.3. AllBruce Evans1998-01-161-9/+14
| | | | | | | | | | | | | | | are in kvm_uread(): - the setting of errno before checking it in the lseek() was lost. - EOF handling was lost. kvm_uread() retried forever on EOF. EOF is not really an error, but report it one as in rev.1.2. - reporting of errno after a read error was lost. Fixed style bugs in rev.1.3 and rev.1.12. Not fixed: errno is not reported after lseek() failures. Notes: svn path=/head/; revision=32568
* Fill in parent process id when reading process information from aTor Egge1997-06-251-0/+12
| | | | | | | memory dump. This fixes one of the problems noted in PR kern/3581. Notes: svn path=/head/; revision=26947
* General -Wall warning cleanup, part I.Jordan K. Hubbard1996-07-121-3/+7
| | | | | | | Submitted-By: Kent Vander Velden <graphix@iastate.edu> Notes: svn path=/head/; revision=17141
* Pass correct length OID to kernel for KERN_PROC_ALL.Poul-Henning Kamp1996-06-061-2/+2
| | | | Notes: svn path=/head/; revision=16158
* NBPG -> PAGE_SIZEPoul-Henning Kamp1996-05-021-8/+8
| | | | Notes: svn path=/head/; revision=15533
* From Lite2: proc and file LIST changesJeffrey Hsu1996-03-111-1/+1
| | | | Notes: svn path=/head/; revision=14523
* If the two recently added sysctl variables exist, use those rather thanPeter Wemm1996-02-241-2/+17
| | | | | | | | | | the statically compiled PS_STRINGS and USRSTACK variables. This prevents programs using setproctitle from coredumping if the kernel VM is increased, and stops libkvm users (w, ps, etc) from needing to be recompiled if only the VM layout changes. Notes: svn path=/head/; revision=14236