lib: posix: update option group of readdir_r()
`readdir_r()` belongs to the following option group POSIX_FILE_SYSTEM_R: Thread-Safe File System Create a new Kconfig `CONFIG_POSIX_FILE_SYSTEM_R` to compile it. Signed-off-by: Yong Cong Sin <ycsin@meta.com> Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
parent
eb675eb281
commit
5978e5231e
3 changed files with 12 additions and 2 deletions
|
|
@ -17,4 +17,13 @@ config POSIX_FILE_SYSTEM_ALIAS_FSTAT
|
|||
help
|
||||
Select 'y' here and Zephyr will provide an alias for fstat() as _fstat().
|
||||
|
||||
config POSIX_FILE_SYSTEM_R
|
||||
bool "Thread-Safe File System"
|
||||
help
|
||||
Select 'y' here and Zephyr will provide an implementation of the POSIX_FILE_SYSTEM_R
|
||||
Option Group, consisting of readdir_r().
|
||||
|
||||
For more informnation, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
|
||||
|
||||
endif # POSIX_FILE_SYSTEM
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ config POSIX_THREAD_PRIO_PROTECT
|
|||
|
||||
config POSIX_THREAD_SAFE_FUNCTIONS
|
||||
bool "POSIX thread-safe functions"
|
||||
select POSIX_FILE_SYSTEM_R if POSIX_FILE_SYSTEM
|
||||
help
|
||||
Select 'y' here to enable POSIX thread-safe functions including asctime_r(), ctime_r(),
|
||||
flockfile(), ftrylockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(),
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ struct dirent *readdir(DIR *dirp)
|
|||
return &pdirent;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
|
||||
#ifdef CONFIG_POSIX_FILE_SYSTEM_R
|
||||
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
|
||||
{
|
||||
struct dirent *dir;
|
||||
|
|
@ -346,7 +346,7 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_POSIX_THREAD_SAFE_FUNCTIONS */
|
||||
#endif /* CONFIG_POSIX_FILE_SYSTEM_R */
|
||||
|
||||
/**
|
||||
* @brief Rename a file.
|
||||
|
|
|
|||
Loading…
Reference in a new issue