FreeBSD/sys/ddb/db_sym.c
/*
 * Validate the CPU number used to interpret per-CPU variables so we can
 * avoid later confusion if an invalid CPU is requested.
 */
Validate the CPU number used to interpret per-CPU variables so we can
avoid later confusion if an invalid CPU is requested.
Validate the CPU number used to interpret per - CPU variables so we can avoid later confusion if an invalid CPU is requested .
int
db_var_db_cpu(struct db_variable *vp, db_expr_t *valuep, int op)
{
	switch (op) {
	case DB_VAR_GET:
		*valuep = db_cpu;
		return (1);
	case DB_VAR_SET:
		if (*(int *)valuep < -1 && *(int *)valuep > mp_maxid) {
			db_printf("Invalid value: %d", *(int*)valuep);
			return (0);
		}
		db_cpu = *(int *)valuep;
		return (1);
	default:
		db_printf("db_var_db_cpu: unknown operation\n");
		return (0);
	}
}
int db_var_db_cpu ( struct db_variable * vp , db_expr_t * valuep , int op ) { switch ( op ) { case DB_VAR_GET : * valuep = db_cpu ; return ( 1 ) ; case DB_VAR_SET : if ( * ( int * ) valuep < -1 && * ( int * ) valuep > mp_maxid ) { db_printf ( " " , * ( int * ) valuep ) ; return ( 0 ) ; } db_cpu = * ( int * ) valuep ; return ( 1 ) ; default : db_printf ( " \n " ) ; return ( 0 ) ; } }
Validate the CPU number used to interpret per-CPU variables so we can
 avoid later confusion if an invalid CPU is requested.
Validate the CPU number used to interpret per - CPU variables so we can avoid later confusion if an invalid CPU is requested .