summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement kvm_kerndispLeandro Lupori2020-02-061-0/+1
| | | | | | | | | | | | | | | This change adds a new libkvm function, kvm_kerndisp(), that can be used to retrieve the kernel displacement, that is the difference between the kernel's base virtual address at run time and the kernel base virtual address specified in the kernel image file. This will be used by kgdb, to properly relocate kernel symbols, when needed. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D23285 Notes: svn path=/head/; revision=357615
* kvm: fix types for cross-debuggingEd Maste2019-11-081-9/+9
| | | | | | | | | | | | | | | | | As with other libkvm interfaces use maximum-sized types to support cross-debugging (e.g. a 64-bit vmcore on a 32-bit host). See https://lists.freebsd.org/pipermail/svn-src-all/2019-February/176051.html for further discussion. This is an API-breaking change, but there are few consumers of this interface today. Reviewed by: will Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21945 Notes: svn path=/head/; revision=354543
* Make struct xinpcb and friends word-size independent.Brooks Davis2018-07-051-2/+0
| | | | | | | | | | | | | | | | | | | | | Replace size_t members with ksize_t (uint64_t) and pointer members (never used as pointers in userspace, but instead as unique idenitifiers) with kvaddr_t (uint64_t). This makes the structs identical between 32-bit and 64-bit ABIs. On 64-bit bit systems, the ABI is maintained. On 32-bit systems, this is an ABI breaking change. The ABI of most of these structs was previously broken in r315662. This also imposes a small API change on userspace consumers who must handle kernel pointers becoming virtual addresses. PR: 228301 (exp-run by antoine) Reviewed by: jtl, kib, rwatson (various versions) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15386 Notes: svn path=/head/; revision=335979
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* libkvm: fix build failuresWill Andrews2017-11-121-1/+8
| | | | Notes: svn path=/head/; revision=325732
* libkvm: add kvm_walk_pages API.Will Andrews2017-11-111-0/+16
| | | | | | | | | | | | | | | | | | | | This API allows callers to enumerate all known pages, including any direct map & kernel map virtual addresses, physical addresses, size, offset into the core, & protection configured. For architectures that support direct map addresses, also generate pages for any direct map only addresses that are not associated with kernel map addresses. Fix page size portability issue left behind from previous kvm page table lookup interface. Reviewed by: jhb Sponsored by: Backtrace I/O Differential Revision: https://reviews.freebsd.org/D12279 Notes: svn path=/head/; revision=325728
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* libkvm - extend a bit the swap statistics field.Pedro F. Giffuni2017-01-021-4/+4
| | | | | | | | | | | Change ksw_used and ksw_total to unsigned, which increases the maximum total swap that can be displayed properly from ~8TB to ~16TB. Obtained from: DragonflyBSD (ecc2e461) MFC after: 2 weeks Notes: svn path=/head/; revision=311101
* Remove kvm_getfiles(3)Enji Cooper2016-04-301-1/+0
| | | | | | | | | | | | | | This libcall has been broken since (at least) r174989/8.0-RELEASE. Bump SHLIB_MAJOR for the change Differential Revision: https://reviews.freebsd.org/D6052 Relnotes: yes Reviewed by: jhb, markj Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298840
* Add support to libkvm for reading vmcores from other architectures.John Baldwin2015-11-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a kvaddr_type to represent kernel virtual addresses instead of unsigned long. - Add a struct kvm_nlist which is a stripped down version of struct nlist that uses kvaddr_t for n_value. - Add a kvm_native() routine that returns true if an open kvm descriptor is for a native kernel and memory image. - Add a kvm_open2() function similar to kvm_openfiles(). It drops the unused 'swapfile' argument and adds a new function pointer argument for a symbol resolving function. Native kernels still use _fdnlist() from libc to resolve symbols if a resolver function is not supplied, but cross kernels require a resolver. - Add a kvm_nlist2() function similar to kvm_nlist() except that it uses struct kvm_nlist instead of struct nlist. - Add a kvm_read2() function similar to kvm_read() except that it uses kvaddr_t instead of unsigned long for the kernel virtual address. - Add a new kvm_arch switch of routines needed by a vmcore backend. Each backend is responsible for implementing kvm_read2() for a given vmcore format. - Use libelf to read headers from ELF kernels and cores (except for powerpc cores). - Add internal helper routines for the common page offset hash table used by the minidump backends. - Port all of the existing kvm backends to implement a kvm_arch switch and to be cross-friendly by using private constants instead of ones that vary by platform (e.g. PAGE_SIZE). Static assertions are present when a given backend is compiled natively to ensure the private constants match the real ones. - Enable all of the existing vmcore backends on all platforms. This means that libkvm on any platform should be able to perform KVA translation and read data from a vmcore of any platform. Tested on: amd64, i386, sparc64 (marius) Differential Revision: https://reviews.freebsd.org/D3341 Notes: svn path=/head/; revision=291406
* Add kvm_getncpus() to obtain mp_ncpus.Gleb Smirnoff2014-02-121-0/+1
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261805
* While it isn't too late and kvm_read_zpcpu() function isn't yet usedGleb Smirnoff2014-02-121-1/+1
| | | | | | | | | | outside libkvm(3), change its order of arguments, so that it is the same as in kvm_read(). Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261796
* In r227839, when removing libkvm dependency on procfs(5),Mikolaj Golub2013-07-101-2/+0
| | | | | | | | | | | | | | kvm_uread() function, used for reading from /proc/pid/mem, was removed too. But the function declaration remained in kvm.h public header and the soname was not bumped. Remove kvm_uread() from kvm.h and bump the soname. Reported by: rmh Discussed on: arch Notes: svn path=/head/; revision=253167
* Include types.h for C99 uintXX_t types.Gleb Smirnoff2013-04-111-1/+1
| | | | Notes: svn path=/head/; revision=249355
* o Provide function kvm_read_zpcpu() to access UMA_ZONE_PCPU allocations.Gleb Smirnoff2013-04-101-0/+2
| | | | | | | | | o Provide function kvm_counter_u64_fetch() to fetch valut of a counter(9). Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=249344
* libkvm code janitoringUlrich Spörlein2011-01-231-1/+1
| | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=217744
* Not all programs including kvm.h include the necessary headers to useRobert Watson2010-03-011-1/+1
| | | | | | | | | | u_int, so prefer unsigned int. MFC after: 6 days Pointed out by: bz, kib, Mr Tinderbox Notes: svn path=/head/; revision=204511
* A first cut at teaching libkvm how to deal with dynamic per-CPU storageRobert Watson2010-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | (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. Notes: svn path=/head/; revision=204494
* Add a new routine kvm_getcptime(3) for fetching the equivalent ofJohn Baldwin2008-08-191-0/+1
| | | | | | | | | | | | | 'kern.cp_time'. For a live kernel it uses the sysctl. For a crashdump, it first checks to see if the kernel has a 'cp_time' global symbol. If it does, it uses that. If that doesn't work, when it uses the recently added kvm_getmaxcpu(3) and kvm_getpcpu(3) routines to walk all the CPUs and sum up their counters. MFC after: 1 week Notes: svn path=/head/; revision=181880
* Add two new routines to libkvm for working with per-CPU data:John Baldwin2008-08-191-0/+2
| | | | | | | | | kvm_getmaxcpu() and kvm_getpcpu(). MFC after: 1 week Notes: svn path=/head/; revision=181876
* Remove the advertising clause. UCB did this some time ago, but theseWarner Losh2007-01-081-4/+0
| | | | | | | | | files were never updated to reflect that. MFC After: 2 days Notes: svn path=/head/; revision=165888
* Fixed some style bugs in the removal of __P(()). Blind removal ofBruce Evans2003-10-131-3/+3
| | | | | | | spaces before __P(()) outdented continuation lines to column 0. Notes: svn path=/head/; revision=121060
* Retire the SWIF_DUMP_TREE code, this is in the way for a rework ofPoul-Henning Kamp2003-07-311-1/+0
| | | | | | | the swap_pager layout. Notes: svn path=/head/; revision=118280
* o Merge <machine/ansi.h> and <machine/types.h> into a new headerMike Barcroft2002-08-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | called <machine/_types.h>. o <machine/ansi.h> will continue to live so it can define MD clock macros, which are only MD because of gratuitous differences between architectures. o Change all headers to make use of this. This mainly involves changing: #ifdef _BSD_FOO_T_ typedef _BSD_FOO_T_ foo_t; #undef _BSD_FOO_T_ #endif to: #ifndef _FOO_T_DECLARED typedef __foo_t foo_t; #define _FOO_T_DECLARED #endif Concept by: bde Reviewed by: jake, obrien Notes: svn path=/head/; revision=102227
* Remove __P() usage.David E. O'Brien2002-03-211-14/+14
| | | | Notes: svn path=/head/; revision=92917
* Change the proc information returned from the kernel so that itKirk McKusick2000-12-121-1/+1
| | | | | | | | | | | | | | | 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
* $Id$ -> $FreeBSD$Peter Wemm1999-08-271-1/+1
| | | | Notes: svn path=/head/; revision=50473
* Oops, the previous log message should have been:Bruce Evans1999-04-101-1/+1
| | | | | | | | | | | Include <machine/ansi.h> so that this file is self-sufficient again. Rev.1.6 doesn't do this as claimed unless <nlist.h> has nonstandard pollution. Cleaned up includes. Notes: svn path=/head/; revision=45525
* Declare mkstemps().Bruce Evans1999-04-091-4/+5
| | | | Notes: svn path=/head/; revision=45513
* Removed evil typedef kvm_swap_t and all uses of it (not many).Bruce Evans1999-01-271-5/+5
| | | | | | | Hoped for by: wollman Notes: svn path=/head/; revision=43282
* Oops, forgot this. Needed by libkvm.Matthew Dillon1999-01-231-1/+14
| | | | Notes: svn path=/head/; revision=43085
* Declare size_t and ssize_t if they are not already declared, so thatBruce Evans1998-12-161-6/+15
| | | | | | | | | | | | | | | | | | <kvm.h> is self-sufficient again. Moved typedefs and forward struct declarations out of __BEGIN_DECLS/ __END_DECLS. Don't comment out the prototype for kvm_uread(). This was a 4 year old kludge for previous breakage of self-sufficiency. The prototypwe was broken instead. Fixed bitrot (const poisoning) in the type of kvm_uread(). Fixed order of the declaration of kvm_uread(). Notes: svn path=/head/; revision=41882
* Adjust the declarations of kvm_read and kvm_write to match reality a littleDoug Rabson1998-09-161-2/+2
| | | | | | | closer. Notes: svn path=/head/; revision=39353
* Comment out declaration of kvm_uread until it can be fixed correctly.Rodney W. Grimes1995-03-201-0/+2
| | | | Notes: svn path=/head/; revision=7189
* Change u_long to unsigned long to be consistent.Rodney W. Grimes1995-03-201-1/+2
| | | | Notes: svn path=/head/; revision=7188
* libkvm exports kvm_uread(), so do declare it in the header file.Joerg Wunsch1995-03-191-0/+1
| | | | | | | Got apparent by Philippe's -Wall patch for /usr/bin. Notes: svn path=/head/; revision=7167
* BSD 4.4 Lite Include SourcesRodney W. Grimes1994-05-241-0/+69
Notes: svn path=/head/; revision=1539