Skip to content

lib: stub: readdir: Define readdir, not readir - #3

Merged
aoinoikaz merged 1 commit into
windows-pe32-ntcallfrom
stub-readdir-name
Nov 3, 2026
Merged

aoinoikaz merged 1 commit into
windows-pe32-ntcallfrom
stub-readdir-name

Conversation

@aoinoikaz

Copy link
Copy Markdown

lib/stub/readdir.c named its stub readir and returned an int, so a C library built with it, as libc is for mes_kernel=gnu and windows, had no readdir. Mes compiled by MesCC calls readdir for its readdir builtin (src/mescc-posix.c), and on Windows hex2 stopped linking mes with "Target label readdir is not valid". Linux is unaffected because it takes lib/linux/readdir.c. The misspelling is GNU Mes's own, from 800becf ("lib: Move directory reading to plain libc"), and is in 0.27.1.

The stub now has <dirent.h>'s signature and, as before, returns a null pointer with errno 0, the end of the directory.

The Windows CI builds mes-m2 with M2-Planet, which skips mescc-posix.c, so it shows only that nothing else changed; the link this fixes runs in nova-nix's Mes job.

lib/stub/readdir.c named its stub readir and returned an int, so a C
library built with it, as libc is for mes_kernel=gnu and windows, had no
readdir.  Mes compiled by MesCC calls readdir for its readdir builtin
(src/mescc-posix.c), and on Windows hex2 stopped linking mes with
"Target label readdir is not valid".  The stub now has <dirent.h>'s
signature and, as before, returns a null pointer with errno 0, the end of
the directory.  GNU Mes 0.27.1 has the misspelling.

* lib/stub/readdir.c (readdir): Rename from readir.  Take a DIR * and
return a struct dirent *.  Include <dirent.h> for them rather than
<unistd.h>.
@aoinoikaz
aoinoikaz merged commit d8c455e into windows-pe32-ntcall Nov 3, 2026
2 checks passed
@aoinoikaz
aoinoikaz deleted the stub-readdir-name branch November 3, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant