Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Aug 31, 2025

The files pwd.c and grp.c both had incorrect preprocessor guards around the stubs that they were implementing. Functions were surrounded by

#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
..
#endif

which is not at all accurate, since that subprofiling option group is (CONFIG_)POSIX_SYSTEM_DATABASE_R.

https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html

Remove the guards, since they are invalid anyway, and at least allow applications to link properly.

Required by #88547

@cfriedt cfriedt requested review from ycsin and loicpoulain August 31, 2025 13:36
@cfriedt cfriedt added the area: POSIX POSIX API Library label Aug 31, 2025
@cfriedt cfriedt added this to the v4.3.0 milestone Aug 31, 2025
Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

Looks like the commit message is unrelated the actual change, unless I'm missing something.

@cfriedt
Copy link
Member Author

cfriedt commented Sep 8, 2025

@JarmouniA - I forgot to fill in a part of the commit message, but it is the right one. Let me update

Edit: oh, actually - the #ifdef lines were stripped from the commit message. That's why it looks like something is missing.

pwd.c and grp.c both had incorrect preprocessor guards around the stubs
that they were implementing. Functions were surrounded by

```cpp
ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
..
endif /* CONFIG_POSIX_THREAD_SAFE_FUNCTIONS */
```

Which is not at all accurate, since that subprofiling option group is
`(CONFIG_)POSIX_SYSTEM_DATABASE_R` (which is a PR that is in-draft).

Remove the guards, since they are invalid anyway, and at most an
application will link properly. We don't really need the guards anyway,
since conditional compilation will be used to link the files into the
build.

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt
Copy link
Member Author

cfriedt commented Sep 8, 2025

For reference, the PRs that will add POSIX_SYSTEM_DATABASE and POSIX_SYSTEM_DATABASE_R functionality are below.
#84859
#84858

@cfriedt cfriedt force-pushed the posix-system-database-r-remove-invalid-preprocessor-guards branch from e86abfe to 563f892 Compare September 8, 2025 16:47
Copy link

sonarqubecloud bot commented Sep 8, 2025

@JarmouniA
Copy link
Contributor

We don't really need the guards anyway, since conditional compilation will be used to link the files into the build.

Are you referring to this?

zephyr_library_sources_ifdef(CONFIG_POSIX_THREADS

@cfriedt
Copy link
Member Author

cfriedt commented Sep 8, 2025

We don't really need the guards anyway, since conditional compilation will be used to link the files into the build.

Are you referring to this?

Not exactly. This from #84858

if (NOT CONFIG_TC_PROVIDES_POSIX_SYSTEM_DATABASE_R)
  zephyr_library_sources_ifdef(CONFIG_POSIX_SYSTEM_DATABASE_R
    system_database_priv.c
    system_database_r.c
  )
endif()

@cfriedt cfriedt requested a review from JarmouniA September 8, 2025 19:11
@kartben kartben merged commit 86eca47 into zephyrproject-rtos:main Sep 9, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants