Skip to content

feat: add O_TMPFILE availability probe with OnceLock caching - #2890

Merged
oferchen merged 2 commits into
masterfrom
feat/o-tmpfile-probe
Mar 21, 2026
Merged

oferchen merged 2 commits into
masterfrom
feat/o-tmpfile-probe

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds o_tmpfile_available(path) to crates/fast_io/ that probes O_TMPFILE support (Linux 3.11+)
  • Uses OnceLock for per-process caching - first call probes, subsequent calls are O(1)
  • On Linux: attempts open(path, O_TMPFILE | O_WRONLY, 0o600), closes fd on success
  • On non-Linux: stub always returns false
  • Includes tests for no-panic, caching consistency, nonexistent path, and null-byte handling

Test plan

  • CI passes on Linux (real O_TMPFILE syscall)
  • CI passes on macOS and Windows (stub returns false)
  • cargo nextest run -p fast_io --all-features -E 'test(o_tmpfile)' passes

@oferchen
oferchen force-pushed the feat/o-tmpfile-probe branch from 5e64f90 to aa6efaf Compare March 21, 2026 20:02
@github-actions github-actions Bot added the enhancement New feature or request label Mar 21, 2026
@oferchen
oferchen merged commit 48eca01 into master Mar 21, 2026
30 of 31 checks passed
@oferchen
oferchen deleted the feat/o-tmpfile-probe branch March 22, 2026 09:00
oferchen added a commit that referenced this pull request May 1, 2026
* feat: add O_TMPFILE availability probe with OnceLock caching

* fix: correct O_TMPFILE probe for cross-platform builds
oferchen added a commit that referenced this pull request May 5, 2026
* feat: add O_TMPFILE availability probe with OnceLock caching

* fix: correct O_TMPFILE probe for cross-platform builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant