FreeBSD/sys/kern/kern_tc.c
/* Report or change the active timecounter hardware. */
Report or change the active timecounter hardware.
Report or change the active timecounter hardware .
static int
sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS)
{
	char newname[32];
	struct timecounter *newtc, *tc;
	int error;
	tc = timecounter;
	strlcpy(newname, tc->tc_name, sizeof(newname));
	error = sysctl_handle_string(oidp, &newname[0], sizeof(newname), req);
	if (error != 0 || req->newptr == NULL)
		return (error);
	tc_chosen = 1;
	if (strcmp(newname, tc->tc_name) == 0)
		return (0);
	for (newtc = timecounters; newtc != NULL; newtc = newtc->tc_next) {
		if (strcmp(newname, newtc->tc_name) != 0)
			continue;
		(void)newtc->tc_get_timecount(newtc);
		(void)newtc->tc_get_timecount(newtc);
		timecounter = newtc;
		return (0);
	}
	return (EINVAL);
}
static int sysctl_kern_timecounter_hardware ( SYSCTL_HANDLER_ARGS ) { char newname [ 32 ] ; struct timecounter * newtc , * tc ; int error ; tc = timecounter ; strlcpy ( newname , tc -> tc_name , sizeof ( newname ) ) ; error = sysctl_handle_string ( oidp , & newname [ 0 ] , sizeof ( newname ) , req ) ; if ( error != 0 || req -> newptr == NULL ) return ( error ) ; tc_chosen = 1 ; if ( strcmp ( newname , tc -> tc_name ) == 0 ) return ( 0 ) ; for ( newtc = timecounters ; newtc != NULL ; newtc = newtc -> tc_next ) { if ( strcmp ( newname , newtc -> tc_name ) != 0 ) continue ; ( void ) newtc -> tc_get_timecount ( newtc ) ; ( void ) newtc -> tc_get_timecount ( newtc ) ; timecounter = newtc ; return ( 0 ) ; } return ( EINVAL ) ; }
Report or change the active timecounter hardware.
Report or change the active timecounter hardware .
/* Record that the tc in use now was specifically chosen. */ /* Warm up new timecounter. */ /*
		 * The vdso timehands update is deferred until the next
		 * 'tc_windup()'.
		 *
		 * This is prudent given that 'timekeep_push_vdso()' does not
		 * use any locking and that it can be called in hard interrupt
		 * context via 'tc_windup()'.
		 */