Add directory stream wrappers #40

Merged
andrew merged 2 commits from 10 into main 2026-08-03 15:26:00 -04:00
Collaborator

Closes #10.

Summary:

  • add opendir, fdopendir, readdir, closedir, and rewinddir wrappers
  • copy directory entries into caller-owned storage and report end-of-directory as AKERR_EOF
  • document DT_UNKNOWN and the stat fallback
  • cover errno propagation, null guards, EOF, copied entry lifetime, fd ownership, rewind, and root-aware EACCES behavior
  • move scandir callback and ownership design to #14 as approved

Tests:

  • cmake -S . -B build; cmake --build build -j2; ctest --test-dir build --output-on-failure (21/21)
  • ASAN_OPTIONS=detect_leaks=0 ./build-asan/test_dir
  • cmake --build build-coverage --target coverage -j2 (src/dir.c: 100% lines and functions)
Closes #10. Summary: - add opendir, fdopendir, readdir, closedir, and rewinddir wrappers - copy directory entries into caller-owned storage and report end-of-directory as AKERR_EOF - document DT_UNKNOWN and the stat fallback - cover errno propagation, null guards, EOF, copied entry lifetime, fd ownership, rewind, and root-aware EACCES behavior - move scandir callback and ownership design to #14 as approved Tests: - cmake -S . -B build; cmake --build build -j2; ctest --test-dir build --output-on-failure (21/21) - ASAN_OPTIONS=detect_leaks=0 ./build-asan/test_dir - cmake --build build-coverage --target coverage -j2 (src/dir.c: 100% lines and functions)
logikoma added 1 commit 2026-08-03 13:05:26 -04:00
Add directory stream wrappers
All checks were successful
libakstdlib CI Build / cmake_build (push) Successful in 2m56s
libakstdlib CI Build / sanitizers (push) Successful in 2m53s
libakstdlib CI Build / coverage (push) Successful in 2m44s
libakstdlib CI Build / mutation_test (push) Successful in 13m17s
af5a4b861a
logikoma force-pushed 10 from af5a4b861a to d5e5e95c61 2026-08-03 13:46:41 -04:00 Compare
andrew requested changes 2026-08-03 14:03:14 -04:00
@@ -0,0 +5,4 @@
#include "aksl_internal.h"
akerr_ErrorContext AKERR_NOIGNORE *aksl_opendir(const char *pathname, DIR **dest)
Owner

None of these functions have man style comment blocks for context on their operations, the same way other sources in this library do.

None of these functions have `man` style comment blocks for context on their operations, the same way other sources in this library do.
andrew marked this conversation as resolved
tests/test_dir.c Outdated
@@ -0,0 +23,4 @@
DIR *dirp = (DIR *)1;
struct dirent entry;
AKSL_CHECK_STATUS(aksl_opendir("/nonexistent/aksl/dir", &dirp), ENOENT);
Owner

None of these checks have any comments explaining what the actual error cases are that they're testing

None of these checks have any comments explaining what the actual error cases are that they're testing
andrew marked this conversation as resolved
logikoma added 1 commit 2026-08-03 15:18:19 -04:00
Address directory wrapper review
All checks were successful
libakstdlib CI Build / cmake_build (push) Successful in 2m58s
libakstdlib CI Build / sanitizers (push) Successful in 2m57s
libakstdlib CI Build / coverage (push) Successful in 2m47s
libakstdlib CI Build / mutation_test (push) Successful in 13m26s
83ff77608f
andrew merged commit 4b22913c57 into main 2026-08-03 15:26:00 -04:00
Sign in to join this conversation.