-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
posix: implement FILE_LOCKING, SYSTEM_DATABASE, SYSTEM_DATABASE_R #83368
Draft
cfriedt
wants to merge
13
commits into
zephyrproject-rtos:main
Choose a base branch
from
cfriedt:create-posix-system-database-option-group
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
posix: implement FILE_LOCKING, SYSTEM_DATABASE, SYSTEM_DATABASE_R #83368
cfriedt
wants to merge
13
commits into
zephyrproject-rtos:main
from
cfriedt:create-posix-system-database-option-group
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cfriedt
force-pushed
the
create-posix-system-database-option-group
branch
13 times, most recently
from
December 26, 2024 16:18
b69c332
to
0126d05
Compare
checkpatch false positives 🙄 int dirfd(DIR *dirp);
DIR *fdopendir(int fd); SPACING: need consistent spacing around '*' (ctx:WxV)
File:include/zephyr/posix/dirent.h
Line:22
SPACING: need consistent spacing around '*' (ctx:WxV)
File:include/zephyr/posix/dirent.h
Line:24 |
cfriedt
force-pushed
the
create-posix-system-database-option-group
branch
15 times, most recently
from
January 1, 2025 12:46
cca3776
to
fdbfb54
Compare
cfriedt
force-pushed
the
create-posix-system-database-option-group
branch
12 times, most recently
from
January 8, 2025 02:18
4e17db6
to
fb1cb22
Compare
cfriedt
force-pushed
the
create-posix-system-database-option-group
branch
from
January 10, 2025 03:34
fb1cb22
to
6b79e37
Compare
Newlib currently relies on calling stat() indirectly via _fstat_r() when performing certain stdio file operations (e.g. reading a file). However, that results in errno being set to 95 (EOPNOTSUPP) in unexpected places, which causes non-determinism and unpredictability, and it is inconsistent with both picolibc and the minimal libc. Normally, it would be a great opportunity to implement zvfs_stat() via fs_stat(). However, the current implementation of fs_stat() is not particularly useful to call from zvfs_stat() since fs_state() relies on an absolute path passed as the first parameter and it is currently _difficult_ to get that from an integer file descriptor. In the ideal world, it would be possible to extrapolate the absolute path of a filename from a fs_file_t oobject or some other filesystem subsystem API. Since it is not practical to modify Newlib to change the way it performs standard C I/O, simply add a no-op operations for the fs subsystem vtable. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Previously, there was an implicit assumption that Zephyr's internal struct fd_entry * was synonymous with FILE * from the C library. This is generally not the case and aliasing these two distinct types was preventing a fair bit of functionality from Just Working - namely stdio function calls like fgets() and fopen(). The problem can be seen directly when trying to use a function like zvfs_fdopen(). Instead of aliasing the two types, require that all Zephyr C libraries provide a z_libc_file_alloc() function that allocates and populates the required fields of a FILE object. Zephyr currently only provides the integer file descriptor to the C library for initializing FILE objects. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Provide an implementation for the POSIX_SYSTEM_DATABASE_R Option Group. This group is required for all conforming implementations and is therefore required for PSE51, PSE52, PSE53, PSE54, and all other possible subprofiles. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add a teststuite to exercise the POSIX_SYSTEM_DATABASE_R Option Group. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Mark the POSIX_SYSTEM_DATABASE_R Option Group as supported. This Option Group is required for all conformant implementations as part of the _POSIX_THREAD_SAFE_FUNCTIONS Option. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Provide an implementation for the POSIX_SYSTEM_DATABASE Option Group. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add a testsuite for the POSIX_SYSTEM_DATABASE Option Group Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Mark the POSIX_SYSTEM_DATABASE Option Group as supported. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Provide an implementation of the POSIX_FILE_LOCKING Option Group. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add a testsuite for the POSIX_FILE_LOCKING Option Group. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Mark POSIX_FILE_LOCKING as supported. This Option Group is part of the _POSIX_THREAD_SAFE_FUNCTIONS Option and is mandatory for all conforming implementations. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The functions associated with the _POSIX_THREAD_SAFE_FUNCTIONS Option are members of other POSIX Option Groups. Specifically, POSIX_C_LANG_SUPPORT_R, POSIX_FILE_LOCKING, POSIX_FILE_SYSTEM_R, and POSIX_SYSTEM_DATABASE_R. Moreover, _POSIX_THREAD_SAFE_FUNCTIONS is required to be available with any conforming implementation. Therefore, it does not make sense to have a Kconfig option to turn it off or on; it should be enabled or disabled based on whether the required POSIX Option Groups are active. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Mark the _POSIX_THREAD_SAFE_FUNCTIONS Option as supported. This Option is required mandatory for any conformant implementation and is comprised of functions belonging to the following Option Groups: - POSIX_C_LANG_SUPPORT_R - POSIX_FILE_LOCKING - POSIX_FILE_SYSTEM_R - POSIX_SYSTEM_DATABASE_R Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
cfriedt
force-pushed
the
create-posix-system-database-option-group
branch
from
January 29, 2025 12:21
6b79e37
to
e3a983e
Compare
This was referenced Jan 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will get split into multiple PRs.
Doc Preview
Addresses 81489, 74467, 74466, 74465, 74464, 74463, 74462, 74461, 74100, 74099, 74098, 74097.