Skip to content

Conversation

@cfriedt cfriedt requested a review from ycsin December 24, 2024 17:59
@cfriedt cfriedt force-pushed the create-posix-system-database-option-group branch 13 times, most recently from b69c332 to 0126d05 Compare December 26, 2024 16:18
@cfriedt
Copy link
Member Author

cfriedt commented Dec 26, 2024

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 cfriedt force-pushed the create-posix-system-database-option-group branch 15 times, most recently from cca3776 to fdbfb54 Compare January 1, 2025 12:46
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label May 27, 2025
@cfriedt cfriedt removed the Stale label May 27, 2025
cfriedt added 13 commits June 8, 2025 13:48
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 cfriedt force-pushed the create-posix-system-database-option-group branch from e3a983e to 694c739 Compare June 8, 2025 17:48
@cfriedt
Copy link
Member Author

cfriedt commented Jun 8, 2025

  • rebased
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ C)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link

github-actions bot commented Aug 8, 2025

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Aug 8, 2025
@cfriedt cfriedt removed the Stale label Aug 8, 2025
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Oct 8, 2025
@cfriedt cfriedt removed the Stale label Oct 8, 2025
@cfriedt cfriedt added the area: POSIX POSIX API Library label Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: POSIX POSIX API Library

1 participant