FreeBSD/lib/libkvm/kvm_proc.c
/*
 * Build proc info array by reading in proc list from a crash dump.
 * Return number of procs read.  maxcnt is the max we will read.
 */
Build proc info array by reading in proc list from a crash dump.
Return number of procs read.  maxcnt is the max we will read.
Build proc info array by reading in proc list from a crash dump . Return number of procs read . maxcnt is the max we will read .
static int
kvm_deadprocs(kvm_t *kd, int what, int arg, u_long a_allproc,
    u_long a_zombproc, int maxcnt)
{
	struct kinfo_proc *bp = kd->procbase;
	int acnt, zcnt;
	struct proc *p;
	if (KREAD(kd, a_allproc, &p)) {
		_kvm_err(kd, kd->program, "cannot read allproc");
		return (-1);
	}
	acnt = kvm_proclist(kd, what, arg, p, bp, maxcnt);
	if (acnt < 0)
		return (acnt);
	if (KREAD(kd, a_zombproc, &p)) {
		_kvm_err(kd, kd->program, "cannot read zombproc");
		return (-1);
	}
	zcnt = kvm_proclist(kd, what, arg, p, bp + acnt, maxcnt - acnt);
	if (zcnt < 0)
		zcnt = 0;
	return (acnt + zcnt);
}
static int kvm_deadprocs ( kvm_t * kd , int what , int arg , u_long a_allproc , u_long a_zombproc , int maxcnt ) { struct kinfo_proc * bp = kd -> procbase ; int acnt , zcnt ; struct proc * p ; if ( KREAD ( kd , a_allproc , & p ) ) { _kvm_err ( kd , kd -> program , " " ) ; return ( -1 ) ; } acnt = kvm_proclist ( kd , what , arg , p , bp , maxcnt ) ; if ( acnt < 0 ) return ( acnt ) ; if ( KREAD ( kd , a_zombproc , & p ) ) { _kvm_err ( kd , kd -> program , " " ) ; return ( -1 ) ; } zcnt = kvm_proclist ( kd , what , arg , p , bp + acnt , maxcnt - acnt ) ; if ( zcnt < 0 ) zcnt = 0 ; return ( acnt + zcnt ) ; }
Build proc info array by reading in proc list from a crash dump.
Build proc info array by reading in proc list from a crash dump .