-
Notifications
You must be signed in to change notification settings - Fork 8.2k
posix: device_io: implement fdopen(), fileno(), pread(), pselect(), pwrite() #76352
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
Merged
henrikbrixandersen
merged 13 commits into
zephyrproject-rtos:main
from
cfriedt:posix-device-io
Oct 14, 2024
Merged
posix: device_io: implement fdopen(), fileno(), pread(), pselect(), pwrite() #76352
henrikbrixandersen
merged 13 commits into
zephyrproject-rtos:main
from
cfriedt:posix-device-io
Oct 14, 2024
Conversation
This file contains hidden or 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
f20bb26 to
49d972d
Compare
2dd7407 to
67d92e9
Compare
28bacef to
a7935e1
Compare
0223863 to
fe801e3
Compare
9a6eaf9 to
0d6322f
Compare
Only invoke vtable methods read, write, and close if they are non-NULL. The close() vtable method is optional, so that should not return an error if zvfs_close() is called and that method is unimplemented. Otherwise, if zvfs_read() or zvfs_write() are called and the corresponding vtable method is unimplemented, fail setting errno to EIO. Signed-off-by: Chris Friedt <[email protected]>
The POSIX_DEVICE_IO Option Group requires a number of c89 functions mainly from stdio.h . Namely, clearerr(), fclose(), feof(), ferror(), fflush(), fetc(), fgets(), fprintf(), fputc(), fputs(), fread(), freopen(), fscanf(), fwrite(), getc(), getchar(), gets(), perror(), printf(), putc(), putchar(), puts(), scanf(), setbuf(), setvbuf(), ungetc(), vfprintf(), vfscanf(), vfprintf(), and vscanf(). Additionally, symbols stdin, stdout, and stderr should be provided. These should be provided by any conformant C library (not by the POSIX API). Signed-off-by: Chris Friedt <[email protected]>
Add pread() and pwrite() implementations, which are nearly identical to read() and write() but differ in that they do not update the file-descriptor offset and instead read from a specific file offset. Signed-off-by: Chris Friedt <[email protected]>
Move the implementation of zsock_poll to zvfs_poll. This allows other types of file descriptors to also make use of poll() functionality even when the network subsystem is not enabled. Additionally, it partially removes a dependency cycle between posix and networking by moving functionality into a mutual dependency. Signed-off-by: Chris Friedt <[email protected]>
Move the implementation of zsock_select() to zvfs_select(). This allows other types of file descriptors to also make use of select() functionality even when the network subsystem is not enabled. Additionally, it partially removes a dependency cycle between posix and networking by moving functionality into a mutual dependency. Signed-off-by: Chris Friedt <[email protected]>
Implement pselect() as it's required by POSIX_DEVICE_IO Signed-off-by: Chris Friedt <[email protected]>
Implement fdopen(), as required by the POSIX_DEVICE_IO Option Group. Signed-off-by: Chris Friedt <[email protected]>
Implement fileno() as required by the POSIX_DEVICE_IO Option Group. Signed-off-by: Chris Friedt <[email protected]>
Previously, we had only used the flags field and ignored mode with the open() function. Signed-off-by: Chris Friedt <[email protected]>
Mark the POSIX_DEVICE_IO Option Group as commplete. This Option Group is required for PSE51, PSE52, PSE53, PSE54, and most of the interesting applications involving file descriptors and sockets. Signed-off-by: Chris Friedt <[email protected]>
Several help prompts for non-user-selectable Kconfig options included the phrase "select 'y' here", which does not make any sense in this situation. Adjust the help sections to use more appropriate language. Signed-off-by: Chris Friedt <[email protected]>
Currently Zephyr depends on POSIX, which presents a dependency cycle. Newlib does not seem to like this dependency cycle so it requires that we re-declare off_t and ssize_t. We should really stop using off_t and ssize_t below the POSIX API line in Zephyr. Signed-off-by: Chris Friedt <[email protected]>
0d6322f to
cc89d21
Compare
|
CONFIG_ZVFS_POLL_MAX is now used to control the maximum number of poll() entires. Thereby, CONFIG_NET_SOCKETS_POLL_MAX is redundant and shall be deprecated. Modify the defaults for NET_SOCKETS_POLL_MAX and ZVS_POLL_MAX so that the deprecation actually makes sense instead of symbol removal. In case the application still sets the old config, it will modify the ZVS_POLL_MAX default. Signed-off-by: Robert Lubos <[email protected]> Signed-off-by: Chris Friedt <[email protected]>
cc89d21 to
d7ee8b3
Compare
|
rlubos
approved these changes
Oct 14, 2024
jukkar
approved these changes
Oct 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: Base OS
Base OS Library (lib/os)
area: LWM2M
area: Modem Drivers
area: Networking
area: POSIX
POSIX API Library
area: Samples
Samples
area: Sockets
Networking sockets
area: Tracing
Tracing
Release Notes
To be mentioned in the release notes
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 is a resubmission of #73978
Implement the remaining functions in the
POSIX_DEVICE_IOOption Group.This Option Group is requried for the PSE51, PSE52, PSE53, and PSE54 subprofiles and likely others.
Doc Preview
Fixes #24966
Fixes #66932
Fixes #66938
Fixes #66946
Fixes #66947
Fixes #66948