sys/vm/vm_meter.c
static int
do_vmtotal_callback(struct proc *p, void *data)
{
	struct vmtotal *totalp = data;
	struct lwp *lp;

	if (p->p_flags & P_SYSTEM)
		return(0);

	FOREACH_LWP_IN_PROC(lp, p) {
		switch (lp->lwp_stat) {
		case LSSTOP:
		case LSSLEEP:
			if ((p->p_flags & P_SWAPPEDOUT) == 0) {
				if ((lp->lwp_flags & LWP_SINTR) == 0)
					totalp->t_dw++;
				else if (lp->lwp_slptime < maxslp)
					totalp->t_sl++;
			} else if (lp->lwp_slptime < maxslp) {
				totalp->t_sw++;
			}
			if (lp->lwp_slptime >= maxslp)
				return(0);
			break;

		case LSRUN:
			if (p->p_flags & P_SWAPPEDOUT)
				totalp->t_sw++;
			else
				totalp->t_rq++;
			if (p->p_stat == SIDL)
				return(0);
			break;

		default:
			return (0);
		}

		/*
		 * Set while in vm_fault()
		 */
		if (lp->lwp_flags & LWP_PAGING)
			totalp->t_pw++;
	}
	return(0);
}
/*
 * The caller must hold proc_token.
 */
The caller must hold proc_token.
The caller must hold proc_token .
static int
do_vmtotal_callback(struct proc *p, void *data)
{
	struct vmtotal *totalp = data;
	struct lwp *lp;
	if (p->p_flags & P_SYSTEM)
		return(0);
	FOREACH_LWP_IN_PROC(lp, p) {
		switch (lp->lwp_stat) {
		case LSSTOP:
		case LSSLEEP:
			if ((p->p_flags & P_SWAPPEDOUT) == 0) {
				if ((lp->lwp_flags & LWP_SINTR) == 0)
					totalp->t_dw++;
				else if (lp->lwp_slptime < maxslp)
					totalp->t_sl++;
			} else if (lp->lwp_slptime < maxslp) {
				totalp->t_sw++;
			}
			if (lp->lwp_slptime >= maxslp)
				return(0);
			break;
		case LSRUN:
			if (p->p_flags & P_SWAPPEDOUT)
				totalp->t_sw++;
			else
				totalp->t_rq++;
			if (p->p_stat == SIDL)
				return(0);
			break;
		default:
			return (0);
		}
		if (lp->lwp_flags & LWP_PAGING)
			totalp->t_pw++;
	}
	return(0);
}
static int do_vmtotal_callback ( struct proc * p , void * data ) { struct vmtotal * totalp = data ; struct lwp * lp ; if ( p -> p_flags & P_SYSTEM ) return ( 0 ) ; FOREACH_LWP_IN_PROC ( lp , p ) { switch ( lp -> lwp_stat ) { case LSSTOP : case LSSLEEP : if ( ( p -> p_flags & P_SWAPPEDOUT ) == 0 ) { if ( ( lp -> lwp_flags & LWP_SINTR ) == 0 ) totalp -> t_dw ++ ; else if ( lp -> lwp_slptime < maxslp ) totalp -> t_sl ++ ; } else if ( lp -> lwp_slptime < maxslp ) { totalp -> t_sw ++ ; } if ( lp -> lwp_slptime >= maxslp ) return ( 0 ) ; break ; case LSRUN : if ( p -> p_flags & P_SWAPPEDOUT ) totalp -> t_sw ++ ; else totalp -> t_rq ++ ; if ( p -> p_stat == SIDL ) return ( 0 ) ; break ; default : return ( 0 ) ; } if ( lp -> lwp_flags & LWP_PAGING ) totalp -> t_pw ++ ; } return ( 0 ) ; }
The caller must hold proc_token.
The caller must hold proc_token .
/*
		 * Set while in vm_fault()
		 */