Commit Graph

4 Commits

Author SHA1 Message Date
LeandroLP23 d3011ae113 fix(libkernel): share the directory state between duplicated descriptors on Windows
dup and dup2 of a Windows directory descriptor threw. FreeBSD's
kern_dup makes both descriptors refer to one open file, so they share
the read position; the duplicate now points at the same DirectoryState,
which getdents and lseek go through, and keeps it after the original
is closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 21:01:33 +02:00
LeandroLP23 ce0239c940 fix(libkernel): return lseek errors for directory descriptors instead of throwing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 14:59:57 +02:00
Hussein Kadhim cb6dcbf844 fix(libkernel): keep directory lseek off the shared lock and report offset overflow
lseek on a non-directory descriptor no longer takes the directory table lock when no directory is open, and a listing is read under the descriptor's own lock. SEEK_CUR with offset 0 only reports the position, and an overflowing SEEK_CUR offset reports EOVERFLOW.
2026-10-11 14:59:57 +02:00
Hussein Kadhim 7a68e11ab4 fix(libkernel): rewind Windows directory descriptors on lseek
lseek on a directory descriptor returned 0 without moving the listing, so getdents after lseek(fd, 0, SEEK_SET) reported nothing.
2026-10-11 14:59:57 +02:00