Commit Graph

378 Commits

Author SHA1 Message Date
martin
81d4664037 Do not fail kvm_dump_mkheader without setting an error message 2012-08-26 23:09:42 +00:00
martin
f8fdd418df Measure kinfo_proc2::p_vm_vsize in pages, as it was always documented.
This value seems to never have been used anywhere.
This makes it consistent with it's cousin p_vm_msize (which is in pages as
well and has several uses).
2012-06-05 08:23:05 +00:00
matt
e1a2f47f12 Use C89 function definition 2012-03-21 10:10:36 +00:00
matt
572e1c8587 These directories don't handle WARNS=5 2012-03-21 10:08:30 +00:00
chs
9f94a5cde3 fix handling of large pages. 2012-01-10 16:01:16 +00:00
christos
5305df2297 kill open_cloexec() 2011-10-15 21:08:53 +00:00
christos
e375a9464f more sys/param.h additions 2011-09-14 12:37:55 +00:00
christos
80867328b8 Include <sys/param.h> for MAXPATHLEN 2011-09-13 19:11:09 +00:00
wiz
810ed21852 Sort sections. 2011-09-13 08:53:15 +00:00
wiz
267db0c546 Fix Xr. 2011-09-13 08:53:10 +00:00
christos
8171e48bf4 doc for kvm_getkernelname 2011-09-12 21:11:53 +00:00
christos
b8c5a24416 add a function to report the name of the file kvm_open{,.files} is using. 2011-09-12 21:11:31 +00:00
matt
9fbae4ec6b Add -D_KMEMUSER to CPPFLAGS 2011-02-14 18:27:24 +00:00
matt
6ab334853b Teach libkvm how kernel virtual memory is laided on 64-bit MIPS kernels. 2011-01-23 06:28:52 +00:00
dholland
01cef2d63e Return error on failure instead of hiding it and always returning zero.
From Henning Petersen in PR 44152.
2010-11-26 22:01:53 +00:00
uebayasi
9a0d0defa9 Fix build. 2010-11-12 04:52:08 +00:00
stacktic
7bede9ad38 Do not return -1 on _kvm_read when all the requested data could be read (fix bin/38648) 2010-10-23 14:34:12 +00:00
jym
f15c6971d1 Import PAE support for kvm(3):
- add kvm_i386pae.c (used for PAE memory translations), and update Makefile
  for libkvm build.
- in pdppaddr: pass a flag to indicate PAE mode. Use a bit ignored
  by the MMU. Mask address with PG_FRAME to avoid side effects.

Tested with vmstat(1)/netstat(1) to debug core files of PAE and !PAE
kernels. Older kernel dumps will default to native i386 (!PAE) mode.

XXX Currently, savecore(8) will fail to dump a PAE kernel in a !PAE
    environment (and reciprocally). So you need to sync and reboot
    with a kernel of the same mode as the one that crashed. Once the dump
    is successful, this does not matter anymore.
2010-10-05 23:48:16 +00:00
jym
8bb0c87c7e Define KREAD() inside kvm_private.h, for reusability. 2010-09-26 22:28:05 +00:00
jym
962a341df6 Change kvm_pa2off() and kvm_kvatop() prototypes (private to kvm(3)):
-int     _kvm_kvatop(kvm_t *, u_long, u_long *);
-off_t   _kvm_pa2off(kvm_t *, u_long);
+int     _kvm_kvatop(kvm_t *, vaddr_t, paddr_t *);
+off_t   _kvm_pa2off(kvm_t *, paddr_t);

Basically, use vaddr_t for VA and paddr_t for PA. In addition, for variables
representing addresses, use paddr_t or vaddr_t, depending on the context.

For most arches, vaddr_t and paddr_t are equivalent to unsigned long. However,
the change was needed for exotic situations, like i386 PAE, were unsigned long
is not suitable for PA which are 64 bits long. As this required a complete
change of the function prototypes, all arches had to be adapted accordingly.

Core files from before this commit should still work with the new code; I did
not see any direct dependency between core's structure and kvatop/pa2off.

The change was compile tested for all arches, as it impacts all of them.

See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-20 23:23:16 +00:00
jym
f0583e593c KNF 2010-09-19 11:37:40 +00:00
jym
6dc46b923b Ansify and KNF all functions within kvm(3). No objection on current-users@.
Used as ground for u_long => vaddr_t/paddr_t replacements in kvm(3)
private functions.

Compile tested for all arches. See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-19 02:07:00 +00:00
skrll
c6d6c8c225 More KNF 2010-06-24 20:46:11 +00:00
skrll
d481569999 ANSIfy / KNF. 2010-06-24 20:42:24 +00:00
joerg
3c70878e9a Use .In instead of .Ar Pa for headers. 2010-03-22 21:55:06 +00:00
matt
7b012669b8 Adapt to <powerpc/spr.h> breakup. 2010-02-25 23:34:54 +00:00
rmind
40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
snj
4988388746 Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@. 2009-10-20 19:10:09 +00:00
apb
50a2fd2471 Make the documentation match reality. If no explicit kernel name is
provided, kvm_open() and kvm_openfiles() will try _PATH_KSYMS first,
then either the path from sysctl machdep.booted_kernel (if that's
available) or _PATH_UNIX (if the sysctl is not available).
2009-09-14 19:34:12 +00:00
apb
8a61809cf3 Move the code that tries to open _PATH_KSYMS first into a common path,
so that it is used both for the /dev/mem case and the core dump case.

Output from savecore(8) before:
    savecore - - - (null): kvm_openfiles: /netbsd: No such file or directory
and after:
    savecore - - - no core dump
2009-09-14 19:29:20 +00:00
he
f9dd8b23a6 Anoter instance of <sys/exec_aout.h> -> <sys/exec.h>. 2009-08-20 11:18:55 +00:00
yamt
edde2bdd71 kvm_getprocs actually works with KVM_NO_FILES. 2009-05-16 11:56:47 +00:00
mrg
fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
joerg
86a5a95669 Remove redundant .br. 2009-03-10 23:49:07 +00:00
christos
46edb91e9f bump shared libraries. 2009-01-11 03:07:47 +00:00
christos
7bf2b3b453 tdev is unsigned 2008-12-28 19:49:26 +00:00
christos
6127c68e1c cast dev_t's to int32_t because XXX: sysctl can't change size. This should
be not a problem since tty's live in the low part of the dev range.
2008-12-28 19:46:47 +00:00
cegger
83776b8eea check error case for kvm_getlwps or SIGSEGV occurs due to dereferecing a NULL pointer.
return NULL if there are no threads or proceed further through all loops.
Fixes PR 40004. Ok rmind@
2008-11-29 18:24:58 +00:00
mrg
18c9521083 look for ${KVM_MACHINE_ARCH} before ${MACHINE_ARCH} and ${MACHINE_CPU} 2008-10-25 23:59:42 +00:00
mrg
4e9d08ba3d use <i386/foo.h> in a few places. 2008-10-25 23:59:06 +00:00
mrg
ed79731b5f use <sparc/pmap.h> and <sparc/kcore.h> so this builds properly with
a 64 bit "cc -m32".
2008-10-25 19:09:10 +00:00
martin
11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
mrg
3db9261484 don't need <sys/tty.h> here. 2008-03-12 05:57:28 +00:00
ad
0565241b89 +#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL
2008-02-27 15:46:23 +00:00
elad
5c80416b17 PR/37962: Andrew Doran: libkvm is busted due to kauth_cred redefinition
Sync structure with kernel version.
2008-02-05 15:56:01 +00:00
martin
3049bc6660 Use the new information about per-cpu mappings. Gdb now can examine
the interrupt stack.
2008-01-18 16:26:09 +00:00
ad
eba222df68 ... and make kvm_dump_inval() work on the raw device. 2008-01-15 14:16:30 +00:00
ad
a7a2d171df Handle reading from raw disk devices. 2008-01-15 13:57:41 +00:00
simonb
d8de5b102b Remove support for NetBSD/pc532. 2008-01-09 11:25:58 +00:00