Commit Graph

29 Commits

Author SHA1 Message Date
ben
7f9795769e Use macro API to <sys/queue.h> 2000-12-30 21:52:34 +00:00
mckusick
7d330b9cd3 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.
2000-12-12 07:25:57 +00:00
green
a76d7b0016 Good, fixing the header showed incorrect usage of it! #define _KERNEL
here for the include of sys/select.h.
2000-08-06 17:03:09 +00:00
obrien
5e6516932f -Wall, which caught a real bug where buflen wasn't being set properly. 2000-03-27 00:33:45 +00:00
peter
300be24243 Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb juggling
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.
1999-12-27 07:14:58 +00:00
phk
9e8e07135f Introduce commandline caching in the kernel.
This fixes some nasty procfs problems for SMP, makes ps(1) run much faster,
and makes ps(1) even less dependent on /proc which will aid chroot and
jails alike.

To disable this facility and revert to previous behaviour:
        sysctl -w kern.ps_arg_cache_limit=0

For full details see the current@FreeBSD.org mail-archives.
1999-11-16 20:31:58 +00:00
bde
f2d66b8784 Adjust for kern.ps_strings and PS_STRINGS not being a pointer. This
fixes a type mismatch in the call to kvm_uread().  The bug has gone
undetected for almost 3 years because kvm_uproc()'s protoype has been
disabled for almost 4 years.

Trust sysctlbyname() to work properly if it succeeds.

Fixed style bugs in revs. 1.19 and 1.22.
1998-12-16 18:31:51 +00:00
des
3a59a5e55b Avoid the "Cannot allocate memory" problem that appears on heavily
loaded systems by retrying the sysctl() with a larger buffer if it
fails with ENOMEM. For good measure, allocate 10% more memory than
sysctl() claims is necessary.

PR:		8275
Reviewed by:	David Greenman <dg@freebsd.org>
1998-10-12 20:36:33 +00:00
imp
c6419dc030 Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x).  Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time.  However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes.  Shouldn't impact anything, but...
1998-09-16 04:17:47 +00:00
dfr
e15df4b9fc The length argument to sysctl is now size_t. 1998-08-25 07:52:33 +00:00
phk
a0666d1453 Allow /dev/null as path for the "/dev/mem" file, and assume that people
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
1998-06-30 21:29:44 +00:00
bde
ac7024beac Fixed bugs in the conversion of kvm to to use procfs in rev.1.3. All
are in kvm_uread():
- the setting of errno before checking it in the lseek() was lost.
- EOF handling was lost.  kvm_uread() retried forever on EOF.  EOF is
  not really an error, but report it one as in rev.1.2.
- reporting of errno after a read error was lost.

Fixed style bugs in rev.1.3 and rev.1.12.

Not fixed: errno is not reported after lseek() failures.
1998-01-16 16:45:05 +00:00
tegge
033649779e Fill in parent process id when reading process information from a
memory dump. This fixes one of the problems noted in PR kern/3581.
1997-06-25 20:56:48 +00:00
jkh
a3b50e31fd General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
phk
fba4fb2dda Pass correct length OID to kernel for KERN_PROC_ALL. 1996-06-06 17:16:52 +00:00
phk
32e6520ae7 NBPG -> PAGE_SIZE 1996-05-02 09:23:36 +00:00
hsu
198573b62b From Lite2: proc and file LIST changes 1996-03-11 05:34:46 +00:00
peter
a87630bdaf If the two recently added sysctl variables exist, use those rather than
the statically compiled PS_STRINGS and USRSTACK variables.  This prevents
programs using setproctitle from coredumping if the kernel VM is increased,
and stops libkvm users (w, ps, etc) from needing to be recompiled if only
the VM layout changes.
1996-02-24 14:37:30 +00:00
peter
48bfdde0e0 Extract the login name when doing a ps on a dead kernel. 1996-01-01 17:08:17 +00:00
peter
1164bf6c74 Cosmetic cleanup and documentation of kvm_argv.. Hopefully the flow of
the routine can be much more easily understood now... :-)
1995-12-16 09:25:17 +00:00
peter
a1e82d1d70 Updates to read the extra indirection in ps_strings. Note that any
static executables that depend on this will need to be relinked (ie: do
this before 'ps'), but the dynamic linked stuff should be OK (ie: 'w')

Obtained from: NetBSD (not much point reinventing the wheel.. :-)
1995-12-09 04:42:51 +00:00
rgrimes
1c444a9f7e Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
joerg
1e23314df2 Cast the offset of one call to lseek() to off_t, as it's already done
in all other places here.

This is a hack, the interface should be changed to use off_t's
everywhere around, but this will require to update all the programs
that happen to use libkvm.
1995-03-19 13:33:05 +00:00
phk
afc9c60caa Remove some unused variables and fix two blatant core dump triggers. 1995-02-24 08:15:27 +00:00
dg
32181cd6a2 Fix from Gary Jennejohn - use 'cp' not 'buf' in read call. Oops. 1994-11-02 16:38:51 +00:00
sos
7fb01e22dc Added spare space on the usr stack. Used in ibcs2 emulation. 1994-10-09 22:03:58 +00:00
dg
fcf8611de4 Made kvm routines use procfs to get out process data such as argument
strings.
1994-08-11 13:38:23 +00:00
rgrimes
d520158db4 Fix kvm_i386.c just enough to make it compile and return lots of errors
when called.  Noop out swapread in kvm_proc.c as our vm system is
different.
1994-05-28 05:48:30 +00:00
rgrimes
be22b15ae2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00