-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
No tests/samples covering socket read()/write() calls #25407
Comments
If build with full POSIX API, use read()/write() instead of recv()/send() calls for sockets. We have read()/write() support for a while, but no samples/tests actually performed at least a build test for it (so it will be done now). Fixes: zephyrproject-rtos#25407 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
If build with full POSIX API, use read()/write() instead of recv()/send() calls for sockets. We have read()/write() support for a while, but no samples/tests actually performed at least a build test for it (so it will be done now). Fixes: #25407 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Reopening, as there're more work to do (#25443). |
If build with full POSIX API, use read()/write() instead of recv()/send() calls for sockets. We have read()/write() support for a while, but no samples/tests actually performed at least a build test for it (so it will be done now). Fixes: zephyrproject-rtos#25407 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Fdtable is a kernel-level structure, so functions accessing it, like read(), write(), close(), should be syscalls. This conversion however emphasizes a difference between "syscall" and "C standard library function". C stdlib functions should be represented by just a standard linkage symbol, and can be used even without prototype. Syscall is however a special code sequence, which may require special attributes and thus a prototype for usage. To deal with these distinction, we define a convention that "sys_name" is a syscall, while "name" is a normal C function (implemented as a wrapper around syscall). (And we also need to define "_name" to interface with Newlib (actually, just "_write".)) Fixes: zephyrproject-rtos#25407 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Fdtable is a kernel-level structure, so functions accessing it, like read(), write(), close(), should be syscalls. This conversion however emphasizes a difference between "syscall" and "C standard library function". C stdlib functions should be represented by just a standard linkage symbol, and can be used even without prototype. Syscall is however a special code sequence, which may require special attributes and thus a prototype for usage. To deal with these distinction, we define a convention that "sys_name" is a syscall, while "name" is a normal C function (implemented as a wrapper around syscall). (And we also need to define "_name" to interface with Newlib (actually, just "_write".)) Fixes: zephyrproject-rtos#25407 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
I'll add a sample demonstrating read / write functionality. Thanks for the suggestion! |
This ticket actually goes far beyond simple examples (and IIRC, we do have examples of It raises the larger question. Do POSIX calls need to be system calls or is POSIX just a library? There is no kernel object associated with the global file descriptor table, so right now it's use is "free". Additionally, there are no system-call level checks ( That means, for systems with an MMU / MPU we'll just get a fault, but then for systems without an MMU / MPU, it will result in random corruption. However, that reflects the same behaviour for libraries today. I'm tempted to close this |
The Arch meeting was cancelled on the day this was supposed to be reviewed, so I'll just jot down some notes: I've converted the socketpair example to use read / write as well. Will close this issue. However, I think there are some valid concerns with Zephyr's
This relates back to how file descriptor tables operate on POSIX systems; each process has its own file descriptor table (they are just integers) that refer to kernel file descriptor objects, a specific set of file operations. That's a pretty heavyweight design though. Some might argue that Zephyr's view of running in a single address space / process space is fine for its intended purposes. Going to close this as done for now, but we can always reopen the topic in an architecture meeting. |
While support for POSIX read()/write() calls was implemented for some time (enabled by CONFIG_POSIX_API option), there're no tests or samples using this feature. This can lead to regressions and must be addressed.
The text was updated successfully, but these errors were encountered: