summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_proc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Extract the login name when doing a ps on a dead kernel.Peter Wemm1996-01-011-0/+2
| | | | Notes: svn path=/head/; revision=13156
* Cosmetic cleanup and documentation of kvm_argv.. Hopefully the flow ofPeter Wemm1995-12-161-6/+65
| | | | | | | the routine can be much more easily understood now... :-) Notes: svn path=/head/; revision=12885
* Updates to read the extra indirection in ps_strings. Note that anyPeter Wemm1995-12-091-35/+52
| | | | | | | | | | static executables that depend on this will need to be relinked (ie: do this before 'ps'), but the dynamic linked stuff should be OK (ie: 'w') Obtained from: NetBSD (not much point reinventing the wheel.. :-) Notes: svn path=/head/; revision=12682
* Remove trailing whitespace.Rodney W. Grimes1995-05-301-12/+12
| | | | Notes: svn path=/head/; revision=8870
* Cast the offset of one call to lseek() to off_t, as it's already doneJoerg Wunsch1995-03-191-1/+1
| | | | | | | | | | | in all other places here. This is a hack, the interface should be changed to use off_t's everywhere around, but this will require to update all the programs that happen to use libkvm. Notes: svn path=/head/; revision=7166
* Remove some unused variables and fix two blatant core dump triggers.Poul-Henning Kamp1995-02-241-3/+1
| | | | Notes: svn path=/head/; revision=6683
* Fix from Gary Jennejohn - use 'cp' not 'buf' in read call. Oops.David Greenman1994-11-021-1/+1
| | | | Notes: svn path=/head/; revision=4095
* Added spare space on the usr stack. Used in ibcs2 emulation.Søren Schmidt1994-10-091-2/+2
| | | | Notes: svn path=/head/; revision=3477
* Made kvm routines use procfs to get out process data such as argumentDavid Greenman1994-08-111-129/+33
| | | | | | | strings. Notes: svn path=/head/; revision=2029
* Fix kvm_i386.c just enough to make it compile and return lots of errorsRodney W. Grimes1994-05-281-0/+6
| | | | | | | | when called. Noop out swapread in kvm_proc.c as our vm system is different. Notes: svn path=/head/; revision=1603
* BSD 4.4 Lite Lib SourcesRodney W. Grimes1994-05-271-0/+705
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=1573