]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Flesh out the state and flags args to sccnopen(). Set state flags to
authorBruce Evans <bde@FreeBSD.org>
Wed, 24 Aug 2016 18:59:24 +0000 (18:59 +0000)
committerBruce Evans <bde@FreeBSD.org>
Wed, 24 Aug 2016 18:59:24 +0000 (18:59 +0000)
commite866ca565f902f8f70555f9ffd12a6e40930fa91
tree81325b020c5536112302230e1a7c146c3cb8347d
parent2078bf6ef0ec0f21dd8e84caa3323ae156a08f63
Flesh out the state and flags args to sccnopen().  Set state flags to
indicate (potentially partial) success of the open.  Use these to
decide what to close in sccnclose().  Only grab/ungrab use open/close
so far.

Add a per-sc variable to count successful keyboard opens and use
this instead of the grab count to decide if the keyboad state has
been switched.

Start fixing the locking by using atomic ops for the most important
counter -- the grab level one.  Other racy counting will eventually
be fixed by normal mutex or kdb locking in most cases.

Use a 2-entry per-sc stack of states for grabbing.  2 is just enough
to debug grabbing, e.g., for gets().  gets() grabs once and might not
be able to do a full (or any) state switch.  ddb grabs again and has
a better chance of doing a full state switch and needs a place to
stack the previous state.  For more than 3 levels, grabbing just
changes the count.  Console drivers should try to switch on every i/o
in case lower levels of nesting failed to switch but the current level
succeeds, but then the switch (back) must be completed on every i/o
and this flaps the state unless the switch is null.  The main point
of grabbing is to make it null quite often.  Syscons grabbing also
does a carefully chosen screen focus that is not done on every i/o.

Add a large comment about grabbing.

Restore some small lost comments.
sys/dev/syscons/syscons.c
sys/dev/syscons/syscons.h