summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm.c
Commit message (Collapse)AuthorAgeFilesLines
* libkvm: fix logic inversion introduced with last commituqs2011-02-021-2/+2
| | | | | Reported by: Brandon Gooch <jamesbrandongooch@gmail.com> Pointy hat to: uqs
* libkvm code janitoringuqs2011-01-231-92/+65
| | | | | | | | | | | | - make WARNS=6 clean for archs w/o strict alignment requirments - add const, ANSIfy, remove unused vars, cast types for comparison - thanks to differing definitions of VM_MIN_ADDRESS across our archs, we need to trick the compiler to not complain about signedness. We could either fix VM_MIN_ADDRESS to always be a simple integer or make the check conditional on $ARCH. Closes PRs: kern/42386, kern/83364 Reviewed by: bde
* Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.hdim2010-11-141-3/+4
| | | | as a macro, and use it instead of literal strings.
* A first cut at teaching libkvm how to deal with dynamic per-CPU storagerwatson2010-03-011-3/+20
| | | | | | | | | | | | | | | | | (DPCPU): A new API, kvm_dpcpu_setcpu(3), selects the active CPU for the purposes of DPCPU. Calls to kvm_nlist(3) will automatically translate DPCPU symbols and return a pointer to the current CPU's version of the data. Consumers needing to read the same symbol on several CPUs will invoke a series of setcpu/nlist calls, one per CPU of interest. This addition makes it possible for tools like netstat(1) to query the values of DPCPU variables during crashdump analysis, and is based on similar code handling virtualized global variables. MFC after: 1 week Sponsored by: Juniper Networks, Inc.
* Make libkvm work on live systems and crashdumps with andbz2009-07-231-8/+164
| | | | | | | | | | | | | | | | | | without VIMAGE virtualization in the kernel. If we cannot resolve a symbol try to see if we can find it with prefix of the virtualized subsystem, currently only "vnet_entry" by identifying either the vnet of the current process for a live system or the vnet of proc0 (or of dumptid if compiled in a non-default way). The way this is done currently allows us to only touch libkvm but no single application. Once we are going to virtualize more subsystems we will have to review this decision for better scaling. Submitted by: rwatson (initial version of kvm_vnet.c, lots of ideas) Reviewed by: rwatson Approved by: re (kib)
* Reduce code duplication: use calloc() intead of malloc()delphij2008-10-171-4/+2
| | | | and memset afterward.
* Plug memory leaks that is observed when argbuf or argspc is used in thedelphij2008-01-121-0/+4
| | | | | | | | context. Submitted by: Michal Vranek <michal.vranek seznam cz> PR: bin/118380 MFC after: 1 month
* Re-enable raw dump format support on i386 and amd64 for /dev/fwmem.simokawa2007-06-151-0/+2
|
* Remove the advertising clause. UCB did this some time ago, but theseimp2007-01-081-4/+0
| | | | | | files were never updated to reflect that. MFC After: 2 days
* Don't forget to set internal error message in kvm_nlist().wkoszek2006-09-201-2/+7
| | | | Approved by: cognet (mentor)
* Validate that the supplied file is not empty before trying mmap(2) itcsjp2006-01-151-0/+5
| | | | | | | | and access the pages associated with it. Submitted by: Wojciech A. Koszek PR: bin/91411 MFC after: 1 week
* Support crash dumps > 4GB in size on 32 bit platforms. _kvm_kvatop()peter2005-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | returned an lseek offset in a "u_long *" value, which can't express >4GB offsets on 32 bit machines (eg: PAE). Change to "off_t *" for all. Support ELF crashdumps on i386 and amd64. Support PAE crashdumps on i386. This is done by auto-detecting the presence of the IdlePDPT which means that PAE is active. I used Marcel's _kvm_pa2off strategy and ELF header reader for ELF support on amd64. Paul Saab ported the amd64 changes to i386 and we implemented the PAE support from there. Note that gdb6 in the src tree uses whatever libkvm supports. If you want to debug an old crash dump, you might want to keep an old libkvm.so handy and use LD_PRELOAD or the like. This does not detect the old raw dump format. Approved by: re
* Avoid assignments to cast expressions.stefanf2004-06-081-3/+3
| | | | | Reviewed by: md5 Approved by: das (mentor)
* Allow to specify a character special device as a core file.simokawa2003-10-291-21/+18
| | | | | | | | | | | | | | This enable us to use /dev/fwmem* as a core file. e.g. ps -M /dev/fwmem0.0 -N kernel.debug dmesg -M /dev/fwmem0.0 -N kernel.debug gdb -k -c /dev/fwmem0.0 kernel.debug You need to set target EUI64 in hw.firewire.fwmem.eui64_hi/lo before opening the device. On the target arch, (PCI) bus address must be equivalent to physical address. (We cannot use this for sparc64 because of IOMMU.) No objection in: -audit
* Remove unnecssary <vm/swap_pager.h> includes.phk2003-07-311-1/+0
| | | | | These were probably not cleaned up back in whatever murky past these files were split into separate files.
* In kvm_openfiles/kvm_open, mark the file descriptors as close-on-exec.nectar2002-09-111-0/+12
| | | | | Applications can not do this themselves, as the descriptors are hidden behind the opaque `kvm_t' type.
* Assume __STDC__, remove non-__STDC__ code.alfred2002-05-281-26/+0
| | | | Submitted by: keramida
* Remove __P() usage.obrien2002-03-211-1/+1
|
* Remove 'register' keyword.obrien2002-03-211-19/+19
|
* Finish cleanup in kvm.c revisions 1.10 and 1.11 -- mark sf (swapfile)ru2002-01-221-2/+2
| | | | | | | | | argument to kvm_open() and kvm_openfiles() as unused. BSD didn't read swap since kvm.c CSRG revision 5.21 (u-area is pageable under new VM. no need to read from swap.) The old !NEWVM code was removed in CSRG revision 5.23 (~ten years ago).
* Compensate for "Compensate for header dethreading" by backing it out.bde2001-10-101-2/+0
|
* Implement __FBSDID()dillon2001-09-161-3/+3
|
* Compensate for header dethreading.markm2001-05-011-0/+2
|
* Limit the amount of data copied to the error buffer to _POSIX2_LINE_MAX.kris2000-08-041-2/+2
| | | | This is the documented size which the user-provided buffer must be.
* Change the return value of kvm_read/kvm_write to be -1 on error, tonectar2000-03-311-6/+6
| | | | | | | | match the documented interface. Previously it returned 0 on error. PR: bin/10511
* -Wall, which caught a real bug where buflen wasn't being set properly.obrien2000-03-271-0/+3
|
* Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb jugglingpeter1999-12-271-113/+22
| | | | | | 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.
* Delete the sf (swapfile) arg to an internal function that used to point topeter1999-10-111-6/+8
| | | | | /dev/drum but has not been used for a LONG time. Add $FreeBSD$
* Don't open the swap file. The open descriptor for it hasn't been usedbde1999-08-251-8/+0
| | | | | | for over 5 years since we switched to using procfs for kvm_uread(). This cleanup was motivated by recent breakage of the default swap file (/dev/drum) when swapon() has not been called.
* Allow /dev/null as path for the "/dev/mem" file, and assume that peoplephk1998-06-301-10/+14
| | | | | | | 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
* kvm_malloc:ache1996-11-111-3/+3
| | | | | | | When malloc fails. don't try to memset NULL pointer, it cause core dump Replace malloc+memset with calloc, theoretically it can do some optimization of zeroing process internally Improve error diagnostic
* phkmalloc strikes again! :-) Another use of un-cleared returns frompeter1995-12-091-0/+3
| | | | malloc squashed...
* Remove trailing whitespace.rgrimes1995-05-301-7/+7
|
* Fix previous fix to agree with the man page - don't report errors inbde1995-02-251-2/+3
| | | | kvm_open() if errstr is NULL.
* Remove some unused variables and fix two blatant core dump triggers.phk1995-02-241-5/+6
|
* Get rid of _PATH_UNIX completely; use getbootfile(3) instead.wollman1994-09-241-1/+1
| | | | | | | DANGER WILL ROBINSON! _PATH_UNIX is currently defined as the literal string "don't use this". I am of two minds about this myself, but wanted to get something into the tree as quickly as possible.
* Converted 'vmunix' to 'kernel'.dg1994-08-051-1/+1
|
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+540
OpenPOWER on IntegriCloud