fix: align POSIX stdio and argument handling, clarify Intel iwlwifi licensing

This commit is contained in:
2026-08-09 10:42:09 +02:00
parent a06ef0192d
commit 771c3a5a98
15 changed files with 197 additions and 19 deletions
+11 -2
View File
@@ -714,8 +714,17 @@ namespace Ipc {
g_handleTableLocks[slot].Acquire();
uint64_t& bm0 = g_handleBitmaps[slot][0];
uint64_t& bm1 = g_handleBitmaps[slot][1];
// Find first zero bit in bitmap (free slot)
uint64_t bits0 = ~bm0;
// Find first zero bit in bitmap (free slot).
//
// Handles 0, 1 and 2 are never allocated: to POSIX code those numbers
// ARE stdin/stdout/stderr, and the libc routes read()/write() on them
// to the terminal (SYS_GETCHAR/SYS_PUTCHAR) rather than to this table.
// Handing them out as file handles makes the two meanings collide --
// a program's third open() would own "stderr", and every write(2, ...)
// it made would land in that file instead of on screen. Reserving them
// here rather than at process setup keeps the rule in one place and
// immune to a stale bitmap.
uint64_t bits0 = ~bm0 & ~0x7ULL;
uint64_t bits1 = ~bm1;
if (bits0) {
int i = __builtin_ctzll(bits0);