DragonFly users List (threaded) for 2007-08
DragonFly BSD
DragonFly users List (threaded) for 2007-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: libgtop2 and xorg break


From: "Pieter Dumon" <pieter.dumon@xxxxxxxxx>
Date: Tue, 14 Aug 2007 13:03:07 +0200

On 8/13/07, Simon 'corecode' Schubert <corecode@fs.ei.tum.de> wrote:
> Nothing at all -- the vmspace is not being exported.  You might want to be interested in some memory statistics though.  All fields should be documented in /usr/include/sys/kinfo.h.
>
> If you're in doubt, just list what the old code is using and I'll help you find a suitable replacement.

Is this right ? (old => should become)

kp_eproc.e_ucred.cr_ruid => kp_ruid
kp_eproc.e_ucred.cr_svuid => kp_svuid
kp_eproc.e_ucred.cr_rgid => kp_rgid
kp_eproc.e_ucred.cr_svgid => kp_svgid
kp_eproc.e_ppid => kp_ppid
kp_eproc.e_pgid => kp_pgid
kp_eproc.e_tpgid => kp_tpgid
kp_proc.p_nice => kp_nice

kp_proc.p_pid => kp_pid

kp_thread.td_comm => kp_comm
kp_thread.td_wchan => kp_lwp.kl_wchan
kp_thread.td_wmesg => kp_lwp.kl_wmesg

kp_eproc.e_uticks => kp_lwp.kl_uticks
kp_eproc.e_sticks => kp_lwp.kl_sticks

kp_proc.p_flag => kp_flags ?
  current code checks vs P_SWAPPEDOUT

kp_proc.p_stat => kp_stat or kp_lwp.kl_stat ?
  the current code checks vs SRUN, so the stat of the lwp should be checked ?

For the proc's memory stats, it wants to run through the mmap entry
list amongst other things. Here is an excerpt of the original code. As
I know about nothing about this, it's a bit too difficult to patch :-)

<snip>
#define        PROC_VMSPACE   kp_proc.p_vmspace

	if (kvm_read (server->machine.kd,
		      (unsigned long) pinfo [0].PROC_VMSPACE,
		      (char *) &plimit, sizeof (plimit)) != sizeof (plimit)) {
		glibtop_warn_io_r (server, "kvm_read (plimit)");
		return;
	}

	buf->rss_rlim = (guint64)
		(plimit.pl_rlimit [RLIMIT_RSS].rlim_cur);

	vms = &pinfo [0].kp_eproc.e_vm;

	buf->vsize = buf->size = (guint64) pagetok
		(vms->vm_tsize + vms->vm_dsize + vms->vm_ssize) << LOG1024;

	buf->resident = buf->rss = (guint64) pagetok
		(vms->vm_rssize) << LOG1024;
#endif

	/* Now we get the shared memory. */

	if (kvm_read (server->machine.kd,
		      (unsigned long) pinfo [0].PROC_VMSPACE,
		      (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) {
		glibtop_warn_io_r (server, "kvm_read (vmspace)");
		return;
	}

	first = vmspace.vm_map.header.next;

	if (kvm_read (server->machine.kd,
		      (unsigned long) vmspace.vm_map.header.next,
		      (char *) &entry, sizeof (entry)) != sizeof (entry)) {
		glibtop_warn_io_r (server, "kvm_read (entry)");
		return;
	}

	/* Walk through the `vm_map_entry' list ... */

	/* I tested this a few times with `mmap'; as soon as you write
	 * to the mmap'ed area, the object type changes from OBJT_VNODE
	 * to OBJT_DEFAULT so if seems this really works. */

	while (entry.next != first) {
<snip>
Some things in this loop were already patched for Dfly.
</snip>
            }
</snip>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]