Hi everybody, looking forward to receive a help regarding the problem below.
Recently 'ps' utility has crashed on one of servers that I work with. We are using custom BSD-based operating system, I'm not sure, but I think it's FreeBSD3 that our system is derived from.
here is a part of code from ps/print.c:
return (100.0 * fracmem); raised a floating point exception as I see in a crash dump, but I'm unable to see the value of fracmem and also I'm not a very proficient C programmer and I can't even suggest why floating point exception could have place here...
getpmem(k) is called from pmem(k, ve):
but pmem is called from ps/ps.c as a handler like it's described in ps/keyword.c:
I hope everything is described very precisely. Waiting for your comments, thanks in advance.
Recently 'ps' utility has crashed on one of servers that I work with. We are using custom BSD-based operating system, I'm not sure, but I think it's FreeBSD3 that our system is derived from.
here is a part of code from ps/print.c:
Code:
double
getpmem(k)
KINFO *k;
{
static int failure;
struct proc *p;
struct eproc *e;
double fracmem;
int szptudot;
if (!nlistread)
failure = donlist();
if (failure)
return (0.0);
p = KI_PROC(k);
e = KI_EPROC(k);
if ((p->p_flag & P_INMEM) == 0)
return (0.0);
#ifndef NEWVM
szptudot = UPAGES + clrnd(ctopt(p->p_dsize + p->p_ssize + e->e_xsize));
fracmem = ((float)p->p_rssize + szptudot)/CLSIZE/mempages;
if (p->p_textp && e->e_xccount)
fracmem += ((float)e->e_xrssize)/CLSIZE/e->e_xccount/mempages;
#else
/* XXX want pmap ptpages, segtab, etc. (per architecture) */
szptudot = UPAGES;
/* XXX don't have info about shared */
fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/mempages;
#endif
return (100.0 * fracmem);
}
return (100.0 * fracmem); raised a floating point exception as I see in a crash dump, but I'm unable to see the value of fracmem and also I'm not a very proficient C programmer and I can't even suggest why floating point exception could have place here...
getpmem(k) is called from pmem(k, ve):
Code:
void
pmem(k, ve)
KINFO *k;
VARENT *ve;
{
VAR *v;
v = ve->var;
(void)printf("%*.1f", v->width, getpmem(k));
}
but pmem is called from ps/ps.c as a handler like it's described in ps/keyword.c:
Code:
VAR var[] = {
...
{"%mem", "%MEM", NULL, 0, pmem, 4},
...
}
I hope everything is described very precisely. Waiting for your comments, thanks in advance.