Commit Graph

346 Commits

Author SHA1 Message Date
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
jld
1717a7fe75 Add address translation support for 4MB pages, which we use to map the
kernel text.
2008-01-05 06:54:12 +00:00
jld
324e44d74f The address translation routine needs to use the plN_pi macros (for
indexing into the PTP), not the plN_i ones (for indexing into the entire
linear page table); cf. the analogous code for amd64.  Fixes ~everything
to do with kernel core dumps on i386.
2008-01-05 06:22:55 +00:00
chris
cf792ccc84 Update libkvm to be able to deal with arm kernel core dumps.
These changes allow savecore to successfully save a kernel core dump.

Final part of fixing PR cats/18026
2008-01-01 14:10:37 +00:00
yamt
392c2dc8c2 sync with kernel. 2007-12-22 01:22:03 +00:00
joerg
b9d83a2411 Fix a typo in the last change that broke a comparision. 2007-11-08 21:58:26 +00:00
joerg
6475789b74 Add kvm_dump_header and implement kvm_dump_wrtheader on top of it.
This function allows the caller finer control of how the writes happen
and doesn't force stdio as interface. Optimise clear_gap a bit to not
fill the gap byte-wise. Bump minor version of libkvm.
2007-11-08 20:48:04 +00:00
joerg
4267598f61 ANSIfy. 2007-11-08 17:32:30 +00:00
ad
8fd9a85c2a Catch up with scheduling changes in the kernel. 2007-11-06 01:46:08 +00:00
martin
36097b1de9 Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
2007-11-05 00:46:23 +00:00
yamt
21ac91dd00 sync with kernel after the merge of yamt-x86pmap branch. 2007-10-18 15:30:43 +00:00
ad
dea8adf74d 'true' is a C99 keyword. 2007-07-09 22:28:13 +00:00
christos
4fbeddc144 treat ESRCH as a soft error. From Anon Ymous 2007-07-07 18:27:26 +00:00
christos
1a4c3f68b4 - Fix kvm_getlwps not to spit errors if we lose the race:
- if the process does not exist anymore, return NULL
	- if the process has created more lwps retry
	XXX[1]: We should fix sysctl_kern_lwp() to return the number of lwps it
		needs in oldlenp when ENOMEM. The we can avoid calling sysctl
		twice (by starting let's say with always 1 lwp, or 10).
	XXX[2]: We should fix kvm_getlwps to never spit errors.
- Silence new lint warnings
2007-07-06 14:25:42 +00:00
tls
4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
christos
4be3505e2e fix for yamt-idlelwp 2007-05-17 21:42:32 +00:00
dsl
7effc1a79d Set kp2p->p_ru = 0 in the kproc2 structure.
It was only ever non-zero for zombies, and now doesn't exist.
The 'pstats' field has been valid for zombies for a while (it isn't in
the uarea any more).
Fixes part of build breakage.
2007-05-01 06:58:08 +00:00
scw
5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +00:00
christos
2a84b2c2c1 Revert the kauth_impl.h change. Elad is going to maintain this. Asked by core@ 2007-02-24 20:41:33 +00:00
dsl
c8acc5992d Update only user code that uses the types of the e_[pu]cred members
of struct kinfo_proc.
2007-02-18 15:22:44 +00:00
ad
4ee7030889 Add ${NETBSDSRCDIR}/sys to the include path. 2007-02-10 00:23:13 +00:00
ad
401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +00:00
elad
eb3ad821f0 PR/35506: Chuck Silvers: ps doesn't work on crash dumps, libkvm doesn't
know about kauth

Implemented _kvm_convertcred() to handle copying kauth_cred_t to userspace
and converting it to the appropriate 'struct eproc' members ('pcred' and
'ucred' respectively).

Okay mlelstv@.
2007-02-06 21:21:51 +00:00
chs
f4850e655c fill in p_stat for crashdumps like the kernel does for the sysctl. 2007-01-28 21:31:13 +00:00
yamt
daa6d99693 kvm_getproc2: retry on ENOMEM.
it happens when the number of processes are changed in the mean time.
2006-12-31 16:20:18 +00:00
ross
7731d9ebb9 disable via radical lobotomy
this can't be properly converted now until kernel includes are available
2006-07-05 18:33:18 +00:00
ross
21d9d3841b ppc64 outline, needs more work 2006-07-01 19:21:11 +00:00
yamt
060eacec48 #include a necessary header directly, rather than via user.h. 2006-05-11 12:00:20 +00:00
christos
17c2501482 Coverity CID 881: Always print an error if allocation failed.
If the program is not specified use getprogname()
2006-03-21 23:47:51 +00:00
christos
0213791d0c 1. Eliminate some unnecessary to kvm_{m,re}alloc.
2. Don't malloc/free procbase/procbase2/lwpbase continuously. Keep track
   of the size, and only do it if necessary.
3. Write a macro to malloc/realloc and set the size of members so that it
   is done correctly. Previous open coded version in kvm_file.c always
   set the length, which is incorrect.
4. Remove bogus check against INT_MAX.
5. use NULL to initialize pointers instead of 0.
2006-02-16 20:48:42 +00:00
fvdl
b7bb8fccf1 Fix parsing the page tables. 2005-08-04 19:26:02 +00:00
yamt
6cae8c8d70 as swap is now optional, ENXIO on /dev/drum is normal. 2005-07-30 16:32:29 +00:00
jmc
2c8974a914 Fix fallout from vm_anon changes 2005-05-11 17:41:52 +00:00