Пример #1
0
void
lwkt_gettoken_hard(lwkt_token_t tok)
{
	lwkt_gettoken(tok);
	crit_enter_hard();
}
Пример #2
0
/*
 * Output character.  Buffer whitespace.
 *
 * Parameters:
 *     arg:	character to output
 */
static void
db_putchar(int c, void *arg)
{
	/*
	 * If not in the debugger, output data to both the console and
	 * the message buffer.
	 */
	if (!db_active) {
		if (c == '\r' || c == '\n' || c == '\t' ||
		    isprint(c)) {
			kprintf("%c", c);
		} else {
			kprintf("?");
		}
		if (!db_active)
			return;
		if (c == '\r' || c == '\n')
			db_check_interrupt();
		return;
	}

	crit_enter_hard();

	if (c > ' ' && c <= '~') {
	    /*
	     * Printing character.
	     * If we have spaces to print, print them first.
	     * Use tabs if possible.
	     */
	    db_force_whitespace();
	    cnputc(c);
	    db_output_position++;
	    db_last_non_space = db_output_position;
	}
	else if (c == '\n') {
	    /* Newline */
	    cnputc(c);
	    db_output_position = 0;
	    db_last_non_space = 0;
	    db_check_interrupt();
	}
	else if (c == '\r') {
	    /* Return */
	    cnputc(c);
	    db_output_position = 0;
	    db_last_non_space = 0;
	    db_check_interrupt();
	}
	else if (c == '\t') {
	    /* assume tabs every 8 positions */
	    db_output_position = NEXT_TAB(db_output_position);
	}
	else if (c == ' ') {
	    /* space */
	    db_output_position++;
	}
	else if (c == '\007') {
	    /* bell */
	    cnputc(c);
	}
	/* other characters are assumed non-printing */
	crit_exit_hard();
}