llvm / llvm/llvm-project

[libc] add x and e modes to fopen()

Open
#223,070 3 comments 0 reactions 1 assignee Claimed by @JihyeonJeong129 View on GitHub
libc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The C standard describes fopen as having an extra flag `x` flag that represents an exclusive file: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf#page=341. Currently this is represented at the [OS generic File level](https://github.com/llvm/llvm-project/blob/f77ec648706b957698a61e54a715bd69042ce491/libc/src/__support/File/file.h#L92) but on linux the `O_EXCL` isn't appropriately added to the [list of flags](https://github.com/llvm/llvm-project/blob/f77ec648706b957698a61e54a715bd69042ce491/libc/src/__support/File/linux/file.cpp#L71).

The `e` flag is POSIX specific: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fopen.html, it should be marked as an extension in the OS generic File and passed appropriately to the list of flags as well.

This issue should wait until after #220906 merges to avoid conflicts.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.