Skip to content

Ignore file creation flag in fcntl(F_SETFL) #4352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tiif opened this issue May 27, 2025 · 1 comment
Open

Ignore file creation flag in fcntl(F_SETFL) #4352

tiif opened this issue May 27, 2025 · 1 comment
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available

Comments

@tiif
Copy link
Member

tiif commented May 27, 2025

For fcntl(F_SETFL), some file creation flags supposed to be ignored:

  F_SETFL (int)
        Set the file status flags to the value specified by arg.
         File access mode (O_RDONLY, O_WRONLY, O_RDWR) and file
        creation flags (i.e., O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC)
         in arg are ignored.  On Linux, this operation can change
        only the O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, and
         O_NONBLOCK flags.  It is not possible to change the O_DSYNC
         and O_SYNC flags; see BUGS, below.

source: https://man7.org/linux/man-pages/man2/fcntl.2.html

There is a list of file creation flags in https://man7.org/linux/man-pages/man2/open.2.html.

To resolve this issue, we just need to ignore every file creation flag, except O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME and O_NONBLOCK.

@tiif
Copy link
Member Author

tiif commented May 27, 2025

@rustbot label +E-good-first-issue +A-shims +C-enhancement

@rustbot rustbot added A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available labels May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available
Projects
None yet
Development

No branches or pull requests

2 participants