dev: read /dev/zero and /dev/urandom from them, not from the keyboard
consoleinit() put consoleread/consolewrite in devsw[1], over memread and memwrite. Major 1 holds the whole mem major (null, zero, full, random, urandom) and memread already sends the console's minors to the console, so the override only broke the others: a read of /dev/zero waited for a typed line. dd and head on either device hung, and `head -c 10 /dev/zero` only finished because it swallowed the next command. The console now installs just its open and close hooks. /dev/keyboard writes are discarded, as consolewrite used to do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
416aa52b09
commit
d90a72e6d3
3 changed files with 15 additions and 2 deletions
|
|
@ -170,6 +170,7 @@ memwrite(struct inode *ip, uint64 off, char *dst, int n)
|
|||
case 10: case 11: case 12: case 13: case 14: case 15: case 16:
|
||||
return consolewrite(ip, off, dst, n);
|
||||
case 7: return fullwrite(ip, off, dst, n); // /dev/full: always ENOSPC
|
||||
case 3: // /dev/keyboard: discarded
|
||||
case 2:
|
||||
case 5:
|
||||
case 8:
|
||||
|
|
|
|||
Loading…
Reference in a new issue