Files
carlos 325fb535c7 kernel: raise the open-file limit on POSIX hosts
A macOS app launched from Finder starts with a soft RLIMIT_NOFILE of 256,
but a title may keep one file open per Z: cache entry (363 for one title
I run). Its open of about the 247th file failed with EMFILE, the HLE
answered "not found", and the title went on with INVALID_HANDLE_VALUE.

- xbox_kernel_init raises the soft limit to min(hard, 65536) before the
  title opens anything; on macOS it is also capped at
  kern.maxfilesperproc, falling back to OPEN_MAX. The cap keeps select()
  and fd sweeps in children sane on hosts with huge hard limits.
- EMFILE/ENFILE (and Win32 ERROR_TOO_MANY_OPEN_FILES) map to
  STATUS_TOO_MANY_OPENED_FILES, with one stderr line the first time, and
  the failed open's IO_STATUS_BLOCK carries the same status as the return
  value instead of a fixed OBJECT_NAME_NOT_FOUND.
- New standalone ctest kernel_fd_limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:12:01 -07:00
..