Commit Graph
9 Commits
Author SHA1 Message Date
Adrià 4b4385cb7f Merge pull request #6201 from bruceblake/libkernel-getdtablesize
feat(libkernel): implement getdtablesize
2026-10-18 21:26:33 +02:00
pushkarreddyy 2de10e35ff feat(libkernel): allow lowering rlim_cur for RLIMIT_NOFILE in setrlimit 2026-10-16 20:33:46 +05:30
Bruce Blake 873fbe99aa fix(libkernel): cap getdtablesize at the host descriptor table size
On macOS the RLIMIT_NOFILE soft limit is not a bound on the descriptor table: setrlimit accepts soft limits above kern.maxfilesperproc, RLIM_INFINITY included, and getrlimit reports what was set, so returning the guest soft limit alone could report up to INT_MAX for a table of about 122880 descriptors, and a closefrom-style loop up to that value would run billions of iterations instead of about 122k. Return the smaller of the guest soft limit and the host's ::getdtablesize(), which is the FreeBSD sys_getdtablesize result. The guest test derives its expectation from the host call instead of the implementation's formula, and the debt entry no longer claims the limit is raised when libkernel loads outside Linux. Reported by jotitadev in review of the getdtablesize implementation.
2026-10-15 10:35:04 -04:00
Bruce Blake b6c9bd7f33 feat(libkernel): implement getdtablesize
Return the RLIMIT_NOFILE soft limit that getrlimit reports, capped at INT_MAX: FreeBSD sys_getdtablesize returns the smaller of that limit and maxfilesperproc, and the guest limit never exceeds the hard limit that bounds it here. The guest test now asserts the value instead of the throw, and the debt entry records the semantics.
2026-10-14 22:24:10 -04:00
p3nicillinandClaude Opus 5.5 1aaec9728d feat(libkernel): report RLIMIT_NOFILE through getrlimit
XPSemu (PPSA97358) queries RLIMIT_NOFILE at start-up in QEMU's
os_setup_limits and stopped on the unsupported resource. It reports the
descriptor count after which AnyPS5 fails with EMFILE: the C runtime's
8192 low-level descriptors on Windows and the host limit on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 08:12:33 +01:00
p3nicillinandClaude Opus 5.5 9be93156be feat(libkernel): add getdtablesize
VLC (PPSA85300) fails to load on the missing getdtablesize import now that
readdir_r is in. Its only call is in a spawn child that never runs, and the
console's descriptor limit is unknown, so the export throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 22:48:54 +01:00
Xabilimon1andClaude Opus 5.5 aa88949e2e fix(libkernel): build the fcntl status flags and the getrlimit test on macOS
InitialEntry reads O_DIRECT from the host status flags, and macOS has
no O_DIRECT, so libkernel did not compile there. It is now read only
where the host defines it. GuestGetrlimit iterates over braced lists
without including <initializer_list>, which libc++ requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:33:37 +02:00
pushkarreddyy 2781077ace feat(libkernel): answer getrlimit for FreeBSD resources 2026-10-12 12:09:41 +05:30
Renan Pires 851f3b7a10 feat(libkernel): implement getrlimit for RLIMIT_DATA 2026-10-08 23:52:33 -03:00