posix: deprecate POSIX_FS for POSIX_FILE_SYSTEM
This change deprecates CONFIG_POSIX_FS in favour of CONFIG_POSIX_FILE_SYSTEM, which maps directly to the name of the standard POSIX Option Group. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
2bc722a97e
commit
9f6590c7b7
16 changed files with 102 additions and 24 deletions
|
@ -65,7 +65,7 @@ The *Minimal Realtime System Profile* (PSE51) includes all of the
|
||||||
:ref:`_POSIX_MEMLOCK_RANGE <posix_option_memlock_range>`, -1,
|
:ref:`_POSIX_MEMLOCK_RANGE <posix_option_memlock_range>`, -1,
|
||||||
:ref:`_POSIX_MONOTONIC_CLOCK <posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
|
:ref:`_POSIX_MONOTONIC_CLOCK <posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
|
||||||
:ref:`_POSIX_SHARED_MEMORY_OBJECTS <posix_shared_memory_objects>`, -1,
|
:ref:`_POSIX_SHARED_MEMORY_OBJECTS <posix_shared_memory_objects>`, -1,
|
||||||
:ref:`_POSIX_SYNCHRONIZED_IO <posix_option_synchronized_io>`, -1,
|
:ref:`_POSIX_SYNCHRONIZED_IO <posix_option_synchronized_io>`, -1, :kconfig:option:`CONFIG_POSIX_SYNCHRONIZED_IO`
|
||||||
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||||
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||||
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||||
|
@ -103,7 +103,7 @@ The *Realtime Controller System Profile* (PSE52) includes all features from PSE5
|
||||||
|
|
||||||
:ref:`POSIX_C_LANG_MATH <posix_option_group_c_lang_math>`, yes,
|
:ref:`POSIX_C_LANG_MATH <posix_option_group_c_lang_math>`, yes,
|
||||||
:ref:`POSIX_FD_MGMT <posix_option_group_fd_mgmt>`,, :kconfig:option:`CONFIG_POSIX_FD_MGMT`
|
:ref:`POSIX_FD_MGMT <posix_option_group_fd_mgmt>`,, :kconfig:option:`CONFIG_POSIX_FD_MGMT`
|
||||||
:ref:`POSIX_FILE_SYSTEM <posix_option_group_file_system>`,,
|
:ref:`POSIX_FILE_SYSTEM <posix_option_group_file_system>`,, :kconfig:option:`CONFIG_POSIX_FILE_SYSTEM`
|
||||||
|
|
||||||
.. csv-table:: PSE52 Option Requirements
|
.. csv-table:: PSE52 Option Requirements
|
||||||
:header: Symbol, Support, Remarks
|
:header: Symbol, Support, Remarks
|
||||||
|
|
|
@ -94,7 +94,7 @@ POSIX System Interfaces
|
||||||
_POSIX_SHARED_MEMORY_OBJECTS, -1,
|
_POSIX_SHARED_MEMORY_OBJECTS, -1,
|
||||||
_POSIX_SPAWN, -1, :ref:`†<posix_undefined_behaviour>`
|
_POSIX_SPAWN, -1, :ref:`†<posix_undefined_behaviour>`
|
||||||
_POSIX_SPORADIC_SERVER, -1, :ref:`†<posix_undefined_behaviour>`
|
_POSIX_SPORADIC_SERVER, -1, :ref:`†<posix_undefined_behaviour>`
|
||||||
_POSIX_SYNCHRONIZED_IO, -1,
|
:ref:`_POSIX_SYNCHRONIZED_IO <posix_option_synchronized_io>`, -1, :kconfig:option:`CONFIG_POSIX_SYNCHRONIZED_IO`
|
||||||
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||||
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||||
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||||
|
|
|
@ -21,7 +21,6 @@ implementation of the POSIX API.
|
||||||
* :kconfig:option:`CONFIG_NET_SOCKETS`
|
* :kconfig:option:`CONFIG_NET_SOCKETS`
|
||||||
* :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX`
|
* :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX`
|
||||||
* :kconfig:option:`CONFIG_POSIX_API`
|
* :kconfig:option:`CONFIG_POSIX_API`
|
||||||
* :kconfig:option:`CONFIG_POSIX_FS`
|
|
||||||
* :kconfig:option:`CONFIG_ZVFS_OPEN_MAX`
|
* :kconfig:option:`CONFIG_ZVFS_OPEN_MAX`
|
||||||
* :kconfig:option:`CONFIG_POSIX_OPEN_MAX`
|
* :kconfig:option:`CONFIG_POSIX_OPEN_MAX`
|
||||||
* :kconfig:option:`CONFIG_POSIX_RTSIG_MAX`
|
* :kconfig:option:`CONFIG_POSIX_RTSIG_MAX`
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "posix_types.h"
|
#include "posix_types.h"
|
||||||
|
|
||||||
#ifdef CONFIG_POSIX_FS
|
#ifdef CONFIG_POSIX_FILE_SYSTEM
|
||||||
#include <zephyr/fs/fs.h>
|
#include <zephyr/fs/fs.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -32,6 +32,6 @@ struct dirent *readdir(DIR *dirp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_POSIX_FS */
|
#endif /* CONFIG_POSIX_FILE_SYSTEM */
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_POSIX_DIRENT_H_ */
|
#endif /* ZEPHYR_INCLUDE_POSIX_DIRENT_H_ */
|
||||||
|
|
|
@ -107,6 +107,7 @@ config NEWLIB_LIBC
|
||||||
imply POSIX_DEVICE_IO_ALIAS_READ
|
imply POSIX_DEVICE_IO_ALIAS_READ
|
||||||
imply POSIX_DEVICE_IO_ALIAS_WRITE
|
imply POSIX_DEVICE_IO_ALIAS_WRITE
|
||||||
imply POSIX_FD_MGMT_ALIAS_LSEEK
|
imply POSIX_FD_MGMT_ALIAS_LSEEK
|
||||||
|
imply POSIX_FILE_SYSTEM_ALIAS_FSTAT
|
||||||
help
|
help
|
||||||
Build with newlib library. The newlib library is expected to be
|
Build with newlib library. The newlib library is expected to be
|
||||||
part of the SDK in this case.
|
part of the SDK in this case.
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <zephyr/kernel/mm.h>
|
#include <zephyr/kernel/mm.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
int _fstat(int fd, struct stat *st);
|
||||||
int _read(int fd, void *buf, int nbytes);
|
int _read(int fd, void *buf, int nbytes);
|
||||||
int _write(int fd, const void *buf, int nbytes);
|
int _write(int fd, const void *buf, int nbytes);
|
||||||
int _open(const char *name, int mode);
|
int _open(const char *name, int mode);
|
||||||
|
@ -272,6 +273,7 @@ int _getpid(void)
|
||||||
}
|
}
|
||||||
__weak FUNC_ALIAS(_getpid, getpid, int);
|
__weak FUNC_ALIAS(_getpid, getpid, int);
|
||||||
|
|
||||||
|
#ifndef CONFIG_POSIX_FILE_SYSTEM
|
||||||
int _fstat(int file, struct stat *st)
|
int _fstat(int file, struct stat *st)
|
||||||
{
|
{
|
||||||
st->st_mode = S_IFCHR;
|
st->st_mode = S_IFCHR;
|
||||||
|
|
|
@ -349,8 +349,7 @@ int zvfs_close(int fd)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_POSIX_FSYNC
|
int zvfs_fsync(int fd)
|
||||||
int fsync(int fd)
|
|
||||||
{
|
{
|
||||||
if (_check_fd(fd) < 0) {
|
if (_check_fd(fd) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -358,8 +357,6 @@ int fsync(int fd)
|
||||||
|
|
||||||
return z_fdtable_call_ioctl(fdtable[fd].vtable, fdtable[fd].obj, ZFD_IOCTL_FSYNC);
|
return z_fdtable_call_ioctl(fdtable[fd].vtable, fdtable[fd].obj, ZFD_IOCTL_FSYNC);
|
||||||
}
|
}
|
||||||
FUNC_ALIAS(fsync, _fsync, int);
|
|
||||||
#endif /* CONFIG_POSIX_FSYNC */
|
|
||||||
|
|
||||||
off_t zvfs_lseek(int fd, off_t offset, int whence)
|
off_t zvfs_lseek(int fd, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,8 @@ if(CONFIG_POSIX_SIGNAL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_TIMERS OR
|
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_TIMERS OR
|
||||||
CONFIG_POSIX_MESSAGE_PASSING OR CONFIG_POSIX_FS OR CONFIG_EVENTFD OR CONFIG_POSIX_C_LIB_EXT OR
|
CONFIG_POSIX_MESSAGE_PASSING OR CONFIG_POSIX_FILE_SYSTEM OR CONFIG_EVENTFD OR
|
||||||
CONFIG_POSIX_SINGLE_PROCESS)
|
CONFIG_POSIX_C_LIB_EXT OR CONFIG_POSIX_SINGLE_PROCESS)
|
||||||
# This is a temporary workaround so that Newlib declares the appropriate
|
# This is a temporary workaround so that Newlib declares the appropriate
|
||||||
# types for us. POSIX features to be formalized as part of #51211
|
# types for us. POSIX features to be formalized as part of #51211
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:-D_POSIX_THREADS>)
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:-D_POSIX_THREADS>)
|
||||||
|
@ -51,7 +51,8 @@ zephyr_library_sources_ifdef(CONFIG_POSIX_DEVICE_IO
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_FD_MGMT
|
zephyr_library_sources_ifdef(CONFIG_POSIX_FD_MGMT
|
||||||
fd_mgmt.c
|
fd_mgmt.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
|
zephyr_library_sources_ifdef(CONFIG_POSIX_FILE_SYSTEM fs.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_POSIX_FSYNC fsync.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_MESSAGE_PASSING mqueue.c)
|
zephyr_library_sources_ifdef(CONFIG_POSIX_MESSAGE_PASSING mqueue.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_MULTI_PROCESS
|
zephyr_library_sources_ifdef(CONFIG_POSIX_MULTI_PROCESS
|
||||||
sleep.c
|
sleep.c
|
||||||
|
|
|
@ -44,6 +44,7 @@ rsource "Kconfig.semaphore"
|
||||||
rsource "Kconfig.signal"
|
rsource "Kconfig.signal"
|
||||||
rsource "Kconfig.spinlock"
|
rsource "Kconfig.spinlock"
|
||||||
rsource "Kconfig.stropts"
|
rsource "Kconfig.stropts"
|
||||||
|
rsource "Kconfig.sync_io"
|
||||||
rsource "Kconfig.syslog"
|
rsource "Kconfig.syslog"
|
||||||
rsource "Kconfig.timer"
|
rsource "Kconfig.timer"
|
||||||
rsource "Kconfig.xsi"
|
rsource "Kconfig.xsi"
|
||||||
|
|
|
@ -82,6 +82,15 @@ config POSIX_ENV
|
||||||
|
|
||||||
Please use CONFIG_POSIX_SINGLE_PROCESS instead.
|
Please use CONFIG_POSIX_SINGLE_PROCESS instead.
|
||||||
|
|
||||||
|
config POSIX_FS
|
||||||
|
bool "Support for environ, getenv(), getenv_r(), setenv(), and unsetenv() [DEPRECATED]"
|
||||||
|
select DEPRECATED
|
||||||
|
select POSIX_FILE_SYSTEM
|
||||||
|
help
|
||||||
|
This option is deprecated.
|
||||||
|
|
||||||
|
Please use CONFIG_POSIX_FILE_SYSTEM instead.
|
||||||
|
|
||||||
config POSIX_LIMITS_RTSIG_MAX
|
config POSIX_LIMITS_RTSIG_MAX
|
||||||
int "_POSIX_RTSIG_MAX value in limits.h [DEPRECATED]"
|
int "_POSIX_RTSIG_MAX value in limits.h [DEPRECATED]"
|
||||||
default POSIX_RTSIG_MAX if POSIX_REALTIME_SIGNALS
|
default POSIX_RTSIG_MAX if POSIX_REALTIME_SIGNALS
|
||||||
|
|
|
@ -2,20 +2,19 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
menuconfig POSIX_FS
|
menuconfig POSIX_FILE_SYSTEM
|
||||||
bool "POSIX file system API support"
|
bool "POSIX file system API support"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
depends on FILE_SYSTEM
|
select FILE_SYSTEM
|
||||||
select FDTABLE
|
select FDTABLE
|
||||||
help
|
help
|
||||||
This enables POSIX style file system related APIs.
|
This enables POSIX style file system related APIs.
|
||||||
|
|
||||||
if POSIX_FS
|
if POSIX_FILE_SYSTEM
|
||||||
|
|
||||||
config POSIX_FSYNC
|
config POSIX_FILE_SYSTEM_ALIAS_FSTAT
|
||||||
bool "Support for fsync()"
|
bool
|
||||||
default y
|
|
||||||
help
|
help
|
||||||
This enables fsync() support.
|
Select 'y' here and Zephyr will provide an alias for fstat() as _fstat().
|
||||||
|
|
||||||
endif # POSIX_FS
|
endif # POSIX_FILE_SYSTEM
|
||||||
|
|
39
lib/posix/options/Kconfig.sync_io
Normal file
39
lib/posix/options/Kconfig.sync_io
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Copyright (c) 2024 Tenstorrent AI ULC
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "POSIX synchronized I/O"
|
||||||
|
|
||||||
|
config POSIX_FSYNC
|
||||||
|
bool "Support for fsync()"
|
||||||
|
help
|
||||||
|
Select 'y' here and Zephyr will provide an implementation of fsync().
|
||||||
|
|
||||||
|
For more information, please see
|
||||||
|
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html
|
||||||
|
|
||||||
|
|
||||||
|
config POSIX_SYNCHRONIZED_IO
|
||||||
|
bool "POSIX synchronized I/O"
|
||||||
|
select POSIX_FSYNC
|
||||||
|
help
|
||||||
|
Select 'y' here and Zephyr will provide an implementation of fdatasync(), fsync(),
|
||||||
|
and msync().
|
||||||
|
|
||||||
|
For more information, please see
|
||||||
|
https://pubs.opengroup.org/onlinepubs/9699919799/functions/msync.html
|
||||||
|
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html
|
||||||
|
|
||||||
|
if POSIX_FSYNC
|
||||||
|
|
||||||
|
# These options are intended to be used for compatibility with external POSIX
|
||||||
|
# implementations such as those in Newlib or Picolibc.
|
||||||
|
|
||||||
|
config POSIX_FILE_SYSTEM_ALIAS_FSYNC
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Select 'y' here and Zephyr will provide an alias for fsync() as _fsync().
|
||||||
|
|
||||||
|
endif # POSIX_FSYNC
|
||||||
|
|
||||||
|
endmenu
|
|
@ -429,3 +429,15 @@ int zvfs_ftruncate(int fd, off_t length)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fstat(int fildes, struct stat *buf)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(fildes);
|
||||||
|
ARG_UNUSED(buf);
|
||||||
|
|
||||||
|
errno = ENOTSUP;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_POSIX_FILE_SYSTEM_ALIAS_FSTAT
|
||||||
|
FUNC_ALIAS(fstat, _fstat, int);
|
||||||
|
#endif
|
||||||
|
|
18
lib/posix/options/fsync.c
Normal file
18
lib/posix/options/fsync.c
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Tenstorrent AI ULC
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/posix/unistd.h>
|
||||||
|
|
||||||
|
/* prototypes for external, not-yet-public, functions in fdtable.c */
|
||||||
|
int zvfs_fsync(int fd);
|
||||||
|
|
||||||
|
int fsync(int fd)
|
||||||
|
{
|
||||||
|
return zvfs_fsync(fd);
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_POSIX_FILE_SYSTEM_ALIAS_FSYNC
|
||||||
|
FUNC_ALIAS(fsync, _fsync, int);
|
||||||
|
#endif
|
|
@ -2,7 +2,7 @@ CONFIG_FILE_SYSTEM=y
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
CONFIG_FAT_FILESYSTEM_ELM=y
|
CONFIG_FAT_FILESYSTEM_ELM=y
|
||||||
CONFIG_POSIX_API=y
|
CONFIG_POSIX_API=y
|
||||||
CONFIG_POSIX_FS=y
|
CONFIG_POSIX_FILE_SYSTEM=y
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_MAIN_STACK_SIZE=4096
|
CONFIG_MAIN_STACK_SIZE=4096
|
||||||
CONFIG_EVENTFD=n
|
CONFIG_EVENTFD=n
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
CONFIG_POSIX_API=y
|
CONFIG_POSIX_API=y
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
|
||||||
# for POSIX_FS
|
# for POSIX_FILESYSTEM
|
||||||
CONFIG_FILE_SYSTEM=y
|
CONFIG_FILE_SYSTEM=y
|
||||||
|
|
||||||
# for select to work
|
# for select to work
|
||||||
|
@ -15,7 +15,7 @@ CONFIG_NET_SOCKETPAIR=y
|
||||||
|
|
||||||
# for when CONFIG_POSIX_API is not selected
|
# for when CONFIG_POSIX_API is not selected
|
||||||
CONFIG_PTHREAD_IPC=y
|
CONFIG_PTHREAD_IPC=y
|
||||||
CONFIG_POSIX_FS=y
|
CONFIG_POSIX_FILE_SYSTEM=y
|
||||||
CONFIG_POSIX_TIMERS=y
|
CONFIG_POSIX_TIMERS=y
|
||||||
CONFIG_POSIX_MESSAGE_PASSING=y
|
CONFIG_POSIX_MESSAGE_PASSING=y
|
||||||
CONFIG_EVENTFD=y
|
CONFIG_EVENTFD=y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue