FreeBSD/sys/kern/kern_rctl.c
/*
 * Remove all rules that match the filter.
 */
Remove all rules that match the filter.
Remove all rules that match the filter .
int
rctl_rule_remove(struct rctl_rule *filter)
{
	struct proc *p;
	int found = 0;
	ASSERT_RACCT_ENABLED();
	if (filter->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS &&
	    filter->rr_subject.rs_proc != NULL) {
		p = filter->rr_subject.rs_proc;
		RACCT_LOCK();
		found = rctl_racct_remove_rules(p->p_racct, filter);
		RACCT_UNLOCK();
		if (found)
			return (0);
		return (ESRCH);
	}
	loginclass_racct_foreach(rctl_rule_remove_callback,
	    rctl_rule_pre_callback, rctl_rule_post_callback,
	    filter, (void *)&found);
	ui_racct_foreach(rctl_rule_remove_callback,
	    rctl_rule_pre_callback, rctl_rule_post_callback,
	    filter, (void *)&found);
	prison_racct_foreach(rctl_rule_remove_callback,
	    rctl_rule_pre_callback, rctl_rule_post_callback,
	    filter, (void *)&found);
	sx_assert(&allproc_lock, SA_LOCKED);
	RACCT_LOCK();
	FOREACH_PROC_IN_SYSTEM(p) {
		found += rctl_racct_remove_rules(p->p_racct, filter);
	}
	RACCT_UNLOCK();
	if (found)
		return (0);
	return (ESRCH);
}
int rctl_rule_remove ( struct rctl_rule * filter ) { struct proc * p ; int found = 0 ; ASSERT_RACCT_ENABLED ( ) ; if ( filter -> rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS && filter -> rr_subject . rs_proc != NULL ) { p = filter -> rr_subject . rs_proc ; RACCT_LOCK ( ) ; found = rctl_racct_remove_rules ( p -> p_racct , filter ) ; RACCT_UNLOCK ( ) ; if ( found ) return ( 0 ) ; return ( ESRCH ) ; } loginclass_racct_foreach ( rctl_rule_remove_callback , rctl_rule_pre_callback , rctl_rule_post_callback , filter , ( void * ) & found ) ; ui_racct_foreach ( rctl_rule_remove_callback , rctl_rule_pre_callback , rctl_rule_post_callback , filter , ( void * ) & found ) ; prison_racct_foreach ( rctl_rule_remove_callback , rctl_rule_pre_callback , rctl_rule_post_callback , filter , ( void * ) & found ) ; sx_assert ( & allproc_lock , SA_LOCKED ) ; RACCT_LOCK ( ) ; FOREACH_PROC_IN_SYSTEM ( p ) { found += rctl_racct_remove_rules ( p -> p_racct , filter ) ; } RACCT_UNLOCK ( ) ; if ( found ) return ( 0 ) ; return ( ESRCH ) ; }
Remove all rules that match the filter.
Remove all rules that match the filter .