FreeBSD/sys/kern/kern_clocksource.c
/*
 * Report or change the active event timers hardware.
 */
Report or change the active event timers hardware.
Report or change the active event timers hardware .
static int
sysctl_kern_eventtimer_timer(SYSCTL_HANDLER_ARGS)
{
	char buf[32];
	struct eventtimer *et;
	int error;
	ET_LOCK();
	et = timer;
	snprintf(buf, sizeof(buf), "%s", et->et_name);
	ET_UNLOCK();
	error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
	ET_LOCK();
	et = timer;
	if (error != 0 || req->newptr == NULL ||
	    strcasecmp(buf, et->et_name) == 0) {
		ET_UNLOCK();
		return (error);
	}
	et = et_find(buf, 0, 0);
	if (et == NULL) {
		ET_UNLOCK();
		return (ENOENT);
	}
	configtimer(0);
	et_free(timer);
	if (et->et_flags & ET_FLAGS_C3STOP)
		cpu_disable_c3_sleep++;
	if (timer->et_flags & ET_FLAGS_C3STOP)
		cpu_disable_c3_sleep--;
	periodic = want_periodic;
	timer = et;
	et_init(timer, timercb, NULL, NULL);
	configtimer(1);
	ET_UNLOCK();
	return (error);
}
static int sysctl_kern_eventtimer_timer ( SYSCTL_HANDLER_ARGS ) { char buf [ 32 ] ; struct eventtimer * et ; int error ; ET_LOCK ( ) ; et = timer ; snprintf ( buf , sizeof ( buf ) , " " , et -> et_name ) ; ET_UNLOCK ( ) ; error = sysctl_handle_string ( oidp , buf , sizeof ( buf ) , req ) ; ET_LOCK ( ) ; et = timer ; if ( error != 0 || req -> newptr == NULL || strcasecmp ( buf , et -> et_name ) == 0 ) { ET_UNLOCK ( ) ; return ( error ) ; } et = et_find ( buf , 0 , 0 ) ; if ( et == NULL ) { ET_UNLOCK ( ) ; return ( ENOENT ) ; } configtimer ( 0 ) ; et_free ( timer ) ; if ( et -> et_flags & ET_FLAGS_C3STOP ) cpu_disable_c3_sleep ++ ; if ( timer -> et_flags & ET_FLAGS_C3STOP ) cpu_disable_c3_sleep -- ; periodic = want_periodic ; timer = et ; et_init ( timer , timercb , NULL , NULL ) ; configtimer ( 1 ) ; ET_UNLOCK ( ) ; return ( error ) ; }
Report or change the active event timers hardware.
Report or change the active event timers hardware .