On 03/06/2017 05:24 PM, Sergiy Kibrik wrote:

    +    return _interface->in_cons != _interface->in_prod;
     }

     char XEN_Console::readch() {
    -    return '\0'; /*TODO: support input */
    +    XENCONS_RING_IDX cons;
    +    char c;
    +    assert(_interface);
    +    cons = _interface->in_cons;
    +    c = _interface->in[MASK_XENCONS_IDX(cons, _interface->in)];


I think you should gracefully handle the case where you had a false wakeup and called readch() when nothing is available, and return 0 in this case (as you can see, LineDiscipline::read_poll handles 0 being returned). I guess you need to check if cons is actually beyond prod?


I will do that.

Hi Nadav,
I've looked through LineDiscipline::read_poll() once more and can't figure out the 
possible case of false wake up — it looks like driver->input_ready() predicate 
should always be checked when thread is woken, shouldn't it?
Can you please describe how false readch() call can sneak in?

--
regards,
Sergiy


--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to