History log of /freebsd-current/lib/libkvm/kvm.h
Revision Date Author Comments
# a2f733ab 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 38cf2a43 06-Feb-2020 Leandro Lupori <luporl@FreeBSD.org>

Implement kvm_kerndisp

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


# 9dc7ed62 08-Nov-2019 Ed Maste <emaste@FreeBSD.org>

kvm: fix types for cross-debugging

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


# f38b68ae 05-Jul-2018 Brooks Davis <brooks@FreeBSD.org>

Make struct xinpcb and friends word-size independent.

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


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

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.


# 8baaf913 11-Nov-2017 Will Andrews <will@FreeBSD.org>

libkvm: fix build failures


# c9057838 11-Nov-2017 Will Andrews <will@FreeBSD.org>

libkvm: add kvm_walk_pages API.

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


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

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


# eca80cd0 02-Jan-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

libkvm - extend a bit the swap statistics field.

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


# 7aad67e9 30-Apr-2016 Enji Cooper <ngie@FreeBSD.org>

Remove kvm_getfiles(3)

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


# 7f911abe 27-Nov-2015 John Baldwin <jhb@FreeBSD.org>

Add support to libkvm for reading vmcores from other architectures.
- 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


# 9292aad4 12-Feb-2014 Gleb Smirnoff <glebius@FreeBSD.org>

Add kvm_getncpus() to obtain mp_ncpus.

Sponsored by: Nginx, Inc.


# 19b5cffe 12-Feb-2014 Gleb Smirnoff <glebius@FreeBSD.org>

While it isn't too late and kvm_read_zpcpu() function isn't yet used
outside libkvm(3), change its order of arguments, so that it is the
same as in kvm_read().

Sponsored by: Nginx, Inc.


# 374931bd 10-Jul-2013 Mikolaj Golub <trociny@FreeBSD.org>

In r227839, when removing libkvm dependency on procfs(5),
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


# b448b67b 11-Apr-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Include types.h for C99 uintXX_t types.


# 2a213404 10-Apr-2013 Gleb Smirnoff <glebius@FreeBSD.org>

o Provide function kvm_read_zpcpu() to access UMA_ZONE_PCPU allocations.
o Provide function kvm_counter_u64_fetch() to fetch valut of a counter(9).

Sponsored by: Nginx, Inc.


# c10970dd 23-Jan-2011 Ulrich Spörlein <uqs@FreeBSD.org>

libkvm code janitoring

- 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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 57a6239f 01-Mar-2010 Robert Watson <rwatson@FreeBSD.org>

Not all programs including kvm.h include the necessary headers to use
u_int, so prefer unsigned int.

MFC after: 6 days
Pointed out by: bz, kib, Mr Tinderbox


# ccd8bad0 28-Feb-2010 Robert Watson <rwatson@FreeBSD.org>

A first cut at teaching libkvm how to deal with dynamic per-CPU storage
(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.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# f110b23b 19-Aug-2008 John Baldwin <jhb@FreeBSD.org>

Add a new routine kvm_getcptime(3) for fetching the equivalent of
'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


# 794a9a6c 19-Aug-2008 John Baldwin <jhb@FreeBSD.org>

Add two new routines to libkvm for working with per-CPU data:
kvm_getmaxcpu() and kvm_getpcpu().

MFC after: 1 week


# 67e40531 08-Jan-2007 Warner Losh <imp@FreeBSD.org>

Remove the advertising clause. UCB did this some time ago, but these
files were never updated to reflect that.

MFC After: 2 days


# 7f75c382 12-Oct-2003 Bruce Evans <bde@FreeBSD.org>

Fixed some style bugs in the removal of __P(()). Blind removal of
spaces before __P(()) outdented continuation lines to column 0.


# 5243b679 31-Jul-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Retire the SWIF_DUMP_TREE code, this is in the way for a rework of
the swap_pager layout.


# abbd8902 21-Aug-2002 Mike Barcroft <mike@FreeBSD.org>

o Merge <machine/ansi.h> and <machine/types.h> into a new header
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


# 69160b1e 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove __P() usage.


# 1f7d2501 12-Dec-2000 Kirk McKusick <mckusick@FreeBSD.org>

Change the proc information returned from the kernel so that it
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.


# a4add9a9 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 34597fa6 09-Apr-1999 Bruce Evans <bde@FreeBSD.org>

Oops, the previous log message should have been:

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.


# 95a7753b 09-Apr-1999 Bruce Evans <bde@FreeBSD.org>

Declare mkstemps().


# 45908a6a 27-Jan-1999 Bruce Evans <bde@FreeBSD.org>

Removed evil typedef kvm_swap_t and all uses of it (not many).

Hoped for by: wollman


# b8808468 22-Jan-1999 Matthew Dillon <dillon@FreeBSD.org>

Oops, forgot this. Needed by libkvm.


# b245b90a 16-Dec-1998 Bruce Evans <bde@FreeBSD.org>

Declare size_t and ssize_t if they are not already declared, so that
<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().


# 4fab6203 16-Sep-1998 Doug Rabson <dfr@FreeBSD.org>

Adjust the declarations of kvm_read and kvm_write to match reality a little
closer.


# 1a96efa2 20-Mar-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Comment out declaration of kvm_uread until it can be fixed correctly.


# 15f7fc2c 20-Mar-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Change u_long to unsigned long to be consistent.


# cb0b0e16 19-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

libkvm exports kvm_uread(), so do declare it in the header file.
Got apparent by Philippe's -Wall patch for /usr/bin.


# 59deaec5 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Include Sources