fix(debug): report EVENT_READ in fevent when serial input is queued

The debug scheme's fevent always returned empty, relying solely on the
edge-triggered debug_notify(). A reader that registers with an event queue after
input has already arrived (fbcond's serial console) would miss it. Report
readable when the input queue is non-empty.
This commit is contained in:
2026-07-18 07:23:29 +09:00
parent 40e3c4911a
commit 229046c634
+13 -1
View File
@@ -109,7 +109,19 @@ impl KernelScheme for DebugScheme {
_flags: EventFlags,
token: &mut CleanLockToken,
) -> Result<EventFlags> {
let _handle = *HANDLES.read(token.token()).get(id)?;
let handle = *HANDLES.read(token.token()).get(id)?;
// Report readable when serial/debug input is already queued, so a reader
// that registers with an event queue AFTER input has arrived (e.g.
// fbcond's serial console feeding the getty) still learns it is
// readable, rather than relying solely on the edge-triggered
// debug_notify(). Non-input handles never report readable.
if handle.num != SpecialFds::DisableGraphicalDebug as usize
&& handle.num != SpecialFds::SchemeRoot as usize
&& !INPUT.is_currently_empty(token)
{
return Ok(EVENT_READ);
}
Ok(EventFlags::empty())
}