FreeBSD/sys/dev/vkbd/vkbd.c
/* Read one code from the input queue */
Read one code from the input queue
Read one code from the input queue
static int
vkbd_data_read(vkbd_state_t *state, int wait)
{
	vkbd_queue_t	*q = &state->ks_inq;
	int		 c;
	VKBD_LOCK_ASSERT(state, MA_OWNED);
	if (q->cc == 0)
		return (-1);
	q->cc --;
	c = q->q[q->head ++];
	if (q->head == nitems(q->q))
		q->head = 0;
	selwakeuppri(&state->ks_wsel, PZERO + 1);
	wakeup(q);
	return (c);
}
static int vkbd_data_read ( vkbd_state_t * state , int wait ) { vkbd_queue_t * q = & state -> ks_inq ; int c ; VKBD_LOCK_ASSERT ( state , MA_OWNED ) ; if ( q -> cc == 0 ) return ( -1 ) ; q -> cc -- ; c = q -> q [ q -> head ++ ] ; if ( q -> head == nitems ( q -> q ) ) q -> head = 0 ; selwakeuppri ( & state -> ks_wsel , PZERO + 1 ) ; wakeup ( q ) ; return ( c ) ; }
Read one code from the input queue
Read one code from the input queue
/* get first code from the queue */ /* wakeup ks_inq writers/poll()ers */