Skip to content

Conversation

@ycsin
Copy link
Member

@ycsin ycsin commented Jul 3, 2024

fixes #75319

@ycsin ycsin linked an issue Jul 3, 2024 that may be closed by this pull request
cfriedt
cfriedt previously approved these changes Jul 3, 2024
@cfriedt
Copy link
Member

cfriedt commented Jul 3, 2024

Weird - it looks like there are some edge cases where this header is still needed here in networking.

@ycsin ycsin added the bug The issue is a bug, or the PR is fixing a bug label Jul 10, 2024
cfriedt
cfriedt previously approved these changes Jul 10, 2024
@ycsin ycsin added this to the v3.7.0 milestone Jul 10, 2024
@ycsin ycsin marked this pull request as ready for review July 10, 2024 10:52
@zephyrbot zephyrbot added area: Networking size: XS A PR changing only a single line of code labels Jul 10, 2024
@rlubos
Copy link
Contributor

rlubos commented Jul 10, 2024

For consistency, shouldn't zephyr/posix/ be dropped from other header inclusions around too? As pointed out in the commit message, with CONFIG_POSIX_API enabled include/zephyr/posix should be added to the include path already.

@jukkar
Copy link
Member

jukkar commented Jul 10, 2024

A comment about using zephy/posix/ path, don't remember what socket file it was but for some reason host header file was incorrectly used if not having the zephyr/posix prefix, that is why I used the prefix in various places. This happened with native_sim/posix board. The culprit is perhaps already fixed and not having the prefix is ok now. This was around time I deprecated the posix net api kconfig option.

@cfriedt
Copy link
Member

cfriedt commented Jul 11, 2024

For consistency, shouldn't zephyr/posix/ be dropped from other header inclusions around too? As pointed out in the commit message, with CONFIG_POSIX_API enabled include/zephyr/posix should be added to the include path already.

Yes - technically, if CONFIG_POSIX_API is set, we shouldn't need the prefix.

I also sympathize with @jukkar - it was quite confusing with all of the native hacks previously.

If removing the other prefixes doesn't break anything, I think it should be ok, but it's hard to be certain.

@ycsin, maybe try it out in CI in another draft PR?

@ycsin
Copy link
Member Author

ycsin commented Jul 11, 2024

@ycsin, maybe try it out in CI in another draft PR?

I wonder if we actually want these POSIX headers to be generally available, even when CONFIG_POSIX_API=n? Otherwise I think we can probably move them out of the include folder, or namespace it with private/, and expose them via CMakeLists.txt only when CONFIG_POSIX_API=y

@ycsin
Copy link
Member Author

ycsin commented Jul 11, 2024

For consistency, shouldn't zephyr/posix/ be dropped from other header inclusions around too? As pointed out in the commit message, with CONFIG_POSIX_API enabled include/zephyr/posix should be added to the include path already.

Did a search and got 139 hits, sounds like a treewide change to me

@rlubos
Copy link
Contributor

rlubos commented Jul 11, 2024

For consistency, shouldn't zephyr/posix/ be dropped from other header inclusions around too? As pointed out in the commit message, with CONFIG_POSIX_API enabled include/zephyr/posix should be added to the include path already.

Did a search and got 139 hits, sounds like a treewide change to me

I'm not asking for a treewide change, I was referring to this header only, where all POSIX headers inclusions are within #if defined(CONFIG_POSIX_API) .

When building `native_sim` with CPP & POSIX enabled, the
POSIX's `unistd.h` header causes a compilation error as
`sys/_timespec.h` doesn't exist in host gcc lib.

Remove the 'zephyr/posix' prefix, and rely on
`CMakeLists.txt`s to do the routing accordingly:
- zephyr/lib/CMakeLists.txt:L11
- zephyr/lib/posix/options/CMakeLists.txt:L8

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this works this time, earlier I had to add the !defined checks to properly compile this code.

@nashif nashif merged commit 269729a into zephyrproject-rtos:main Jul 12, 2024
@ycsin ycsin deleted the pr/fix-75319-0 branch July 12, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Networking bug The issue is a bug, or the PR is fixing a bug size: XS A PR changing only a single line of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fatal error: sys/_timespec.h: No such file or directory with v3.7.0-rc2

6 participants