FreeBSD/sys/dev/filemon/filemon.c
/*
 * Invalidate the passed filemon in all processes.
 */
Invalidate the passed filemon in all processes.
Invalidate the passed filemon in all processes .
static void
filemon_untrack_processes(struct filemon *filemon)
{
	struct proc *p;
	sx_assert(&filemon->lock, SA_XLOCKED);
	if (filemon->proccnt == 0)
		return;
	sx_slock(&allproc_lock);
	FOREACH_PROC_IN_SYSTEM(p) {
		if (p->p_filemon == filemon)
			filemon_proc_drop(p);
	}
	sx_sunlock(&allproc_lock);
	KASSERT(filemon->refcnt > 0, ("%s: filemon %p should have "
	    "references still.", __func__, filemon));
	KASSERT(filemon->proccnt == 0, ("%s: filemon %p should not have "
	    "attached procs still.", __func__, filemon));
}
static void filemon_untrack_processes ( struct filemon * filemon ) { struct proc * p ; sx_assert ( & filemon -> lock , SA_XLOCKED ) ; if ( filemon -> proccnt == 0 ) return ; sx_slock ( & allproc_lock ) ; FOREACH_PROC_IN_SYSTEM ( p ) { if ( p -> p_filemon == filemon ) filemon_proc_drop ( p ) ; } sx_sunlock ( & allproc_lock ) ; KASSERT ( filemon -> refcnt > 0 , ( " " " " , __func__ , filemon ) ) ; KASSERT ( filemon -> proccnt == 0 , ( " " " " , __func__ , filemon ) ) ; }
Invalidate the passed filemon in all processes.
Invalidate the passed filemon in all processes .
/* Avoid allproc loop if there is no need. */ /*
	 * Processes in this list won't go away while here since
	 * filemon_event_process_exit() will lock on filemon->lock
	 * which we hold.
	 */ /*
		 * No PROC_LOCK is needed to compare here since it is
		 * guaranteed to not change since we have its filemon
		 * locked.  Everything that changes this p_filemon will
		 * be locked on it.
		 */ /*
	 * It's possible some references were acquired but will be
	 * dropped shortly as they are restricted from being
	 * inherited.  There is at least the reference in cdevpriv remaining.
	 */