FreeBSD/sys/kern/kern_time.c
/* Clean up timers when some process events are being triggered. */
Clean up timers when some process events are being triggered.
Clean up timers when some process events are being triggered .
static void
itimers_event_hook_exit(void *arg, struct proc *p)
{
	struct itimers *its;
	struct itimer *it;
	int event = (int)(intptr_t)arg;
	int i;
	if (p->p_itimers != NULL) {
		its = p->p_itimers;
		for (i = 0; i < MAX_CLOCKS; ++i) {
			if (posix_clocks[i].event_hook != NULL)
				CLOCK_CALL(i, event_hook, (p, i, event));
		}
		if (event == ITIMER_EV_EXEC)
			i = 3;
		else if (event == ITIMER_EV_EXIT)
			i = 0;
		else
			panic("unhandled event");
		for (; i < TIMER_MAX; ++i) {
			if ((it = its->its_timers[i]) != NULL)
				kern_ktimer_delete(curthread, i);
		}
		if (its->its_timers[0] == NULL &&
		    its->its_timers[1] == NULL &&
		    its->its_timers[2] == NULL) {
			free(its, M_SUBPROC);
			p->p_itimers = NULL;
		}
	}
}
static void itimers_event_hook_exit ( void * arg , struct proc * p ) { struct itimers * its ; struct itimer * it ; int event = ( int ) ( intptr_t ) arg ; int i ; if ( p -> p_itimers != NULL ) { its = p -> p_itimers ; for ( i = 0 ; i < MAX_CLOCKS ; ++ i ) { if ( posix_clocks [ i ] . event_hook != NULL ) CLOCK_CALL ( i , event_hook , ( p , i , event ) ) ; } if ( event == ITIMER_EV_EXEC ) i = 3 ; else if ( event == ITIMER_EV_EXIT ) i = 0 ; else panic ( " " ) ; for ( ; i < TIMER_MAX ; ++ i ) { if ( ( it = its -> its_timers [ i ] ) != NULL ) kern_ktimer_delete ( curthread , i ) ; } if ( its -> its_timers [ 0 ] == NULL && its -> its_timers [ 1 ] == NULL && its -> its_timers [ 2 ] == NULL ) { free ( its , M_SUBPROC ) ; p -> p_itimers = NULL ; } } }
Clean up timers when some process events are being triggered.
Clean up timers when some process events are being triggered .
/*
		 * According to susv3, XSI interval timers should be inherited
		 * by new image.
		 */