feat: libc - add SYS_GETCHAR_NB and a non-blocking stdin readiness probe

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NQRTGoYgnZQsh7uCh6Jsxm
This commit is contained in:
2026-08-08 14:42:38 +02:00
co-authored by Claude Opus 5
parent fe10216f8b
commit e8407afcdb
11 changed files with 125 additions and 17 deletions
+1
View File
@@ -189,6 +189,7 @@ extern "C" {
#define MTK_SYS_WIFI_RESULTS 163
#define MTK_SYS_WIFI_CONNECT_ASYNC 164
#define MTK_SYS_NETIFS 165
#define MTK_SYS_GETCHAR_NB 166
/* @SYSCALLS-END */
#define MTK_SOCK_TCP 1
+11
View File
@@ -95,6 +95,17 @@ int ungetc(int c, FILE *stream);
char *fgets(char *s, int size, FILE *stream);
int fputs(const char *s, FILE *stream);
/* MontaukOS extension: non-blocking readiness probe for stdin.
Returns 1 when a complete line is buffered, so a following fgets/fgetc on
stdin returns without blocking; 0 otherwise. Partially typed input is kept.
This is what a select()-style poll over stdin has to be built on -- stdio
descriptors are not waitable kernel objects. */
int montauk_stdin_ready(void);
/* Blocks until a complete line is buffered on stdin, then returns 1. Same
buffer as montauk_stdin_ready(); nothing is consumed either way. */
int montauk_stdin_wait(void);
void perror(const char *s);
FILE *tmpfile(void);
char *tmpnam(char *s);