posix: deprecate POSIX_MQUEUE in favour of POSIX_MESSAGE_PASSING

This change deprecates CONFIG_POSIX_MQUEUE in favour of
CONFIG_POSIX_MESSAGE_PASSING, which maps directly to the name of the
standard POSIX Option.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt 2024-05-22 18:33:38 -04:00 committed by David Leach
commit f270de7362
12 changed files with 46 additions and 23 deletions

View file

@ -109,7 +109,7 @@ The *Realtime Controller System Profile* (PSE52) includes all features from PSE5
:header: Symbol, Support, Remarks
:widths: 50, 10, 50
:ref:`_POSIX_MESSAGE_PASSING <posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MQUEUE`
:ref:`_POSIX_MESSAGE_PASSING <posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MESSAGE_PASSING`
_POSIX_TRACE, -1,
_POSIX_TRACE_EVENT_FILTER, -1,
_POSIX_TRACE_LOG, -1,

View file

@ -86,7 +86,7 @@ POSIX System Interfaces
_POSIX_IPV6, 200809L, :kconfig:option:`CONFIG_NET_IPV6`
_POSIX_MEMLOCK, -1,
_POSIX_MEMLOCK_RANGE, -1,
:ref:`_POSIX_MESSAGE_PASSING<posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MQUEUE`
:ref:`_POSIX_MESSAGE_PASSING<posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MESSAGE_PASSING`
:ref:`_POSIX_MONOTONIC_CLOCK<posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
_POSIX_PRIORITIZED_IO, -1,
:ref:`_POSIX_PRIORITY_SCHEDULING<posix_option_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_POSIX_PRIORITY_SCHEDULING`

View file

@ -17,7 +17,7 @@ implementation of the POSIX API.
* :kconfig:option:`CONFIG_MAX_PTHREAD_MUTEX_COUNT`
* :kconfig:option:`CONFIG_MAX_PTHREAD_SPINLOCK_COUNT`
* :kconfig:option:`CONFIG_MQUEUE_NAMELEN_MAX`
* :kconfig:option:`CONFIG_MSG_COUNT_MAX`
* :kconfig:option:`CONFIG_POSIX_MQ_OPEN_MAX`
* :kconfig:option:`CONFIG_MSG_SIZE_MAX`
* :kconfig:option:`CONFIG_NET_SOCKETPAIR`
* :kconfig:option:`CONFIG_NET_SOCKETS`
@ -26,7 +26,6 @@ implementation of the POSIX API.
* :kconfig:option:`CONFIG_POSIX_FS`
* :kconfig:option:`CONFIG_ZVFS_OPEN_MAX`
* :kconfig:option:`CONFIG_POSIX_OPEN_MAX`
* :kconfig:option:`CONFIG_POSIX_MQUEUE`
* :kconfig:option:`CONFIG_POSIX_RTSIG_MAX`
* :kconfig:option:`CONFIG_POSIX_SIGNAL`
* :kconfig:option:`CONFIG_POSIX_SIGNAL_STRING_DESC`

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_POSIX_MQUEUE_H_
#define ZEPHYR_INCLUDE_POSIX_MQUEUE_H_
#ifndef ZEPHYR_INCLUDE_POSIX_MESSAGE_PASSING_H_
#define ZEPHYR_INCLUDE_POSIX_MESSAGE_PASSING_H_
#include <zephyr/kernel.h>
#include <zephyr/posix/time.h>
@ -47,4 +47,4 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification);
}
#endif
#endif /* ZEPHYR_INCLUDE_POSIX_MQUEUE_H_ */
#endif /* ZEPHYR_INCLUDE_POSIX_MESSAGE_PASSING_H_ */

View file

@ -53,7 +53,7 @@
/* #define _POSIX_MEMLOCK_RANGE (-1L) */
/* #define _POSIX_MEMORY_PROTECTION (-1L) */
#ifdef CONFIG_POSIX_MQUEUE
#ifdef CONFIG_POSIX_MESSAGE_PASSING
#define _POSIX_MESSAGE_PASSING _POSIX_VERSION
#endif
@ -207,7 +207,7 @@
#define _POSIX_MAX_CANON (255)
#define _POSIX_MAX_INPUT (255)
#define _POSIX_MQ_OPEN_MAX \
COND_CODE_1(CONFIG_POSIX_MQUEUE, (CONFIG_MSG_COUNT_MAX), (0))
COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0))
#define _POSIX_MQ_PRIO_MAX (32)
#define _POSIX_NAME_MAX (14)
#define _POSIX_NGROUPS_MAX (8)

View file

@ -158,7 +158,7 @@ enum {
#define __z_posix_sysconf_SC_MEMLOCK_RANGE (-1L)
#define __z_posix_sysconf_SC_MEMORY_PROTECTION (-1L)
#define __z_posix_sysconf_SC_MESSAGE_PASSING \
COND_CODE_1(CONFIG_POSIX_MQUEUE, (_POSIX_MESSAGE_PASSING), (-1L))
COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (_POSIX_MESSAGE_PASSING), (-1L))
#define __z_posix_sysconf_SC_MONOTONIC_CLOCK \
COND_CODE_1(CONFIG_POSIX_MONOTONIC_CLOCK, (_POSIX_MONOTONIC_CLOCK), (-1L))
#define __z_posix_sysconf_SC_PRIORITIZED_IO (-1L)

View file

@ -25,7 +25,7 @@ if(CONFIG_POSIX_SIGNAL)
endif()
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_TIMERS OR
CONFIG_POSIX_MQUEUE OR CONFIG_POSIX_FS OR CONFIG_EVENTFD OR CONFIG_GETOPT OR
CONFIG_POSIX_MESSAGE_PASSING OR CONFIG_POSIX_FS OR CONFIG_EVENTFD OR CONFIG_GETOPT OR
CONFIG_POSIX_SINGLE_PROCESS)
# This is a temporary workaround so that Newlib declares the appropriate
# types for us. POSIX features to be formalized as part of #51211
@ -49,7 +49,7 @@ zephyr_library_sources_ifdef(CONFIG_POSIX_FD_MGMT
fd_mgmt.c
)
zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_MESSAGE_PASSING mqueue.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_MULTI_PROCESS
sleep.c
)

View file

@ -15,6 +15,15 @@ config MAX_TIMER_COUNT
Please use CONFIG_POSIX_TIMER_MAX instead.
config MSG_COUNT_MAX
int "Maximum number of messages in a POSIX message queue [DEPRECATED]"
default POSIX_MQ_OPEN_MAX if POSIX_MESSAGE_PASSING
default 0
help
This option is deprecated.
Please use CONFIG_POSIX_MQ_OPEN_MAX instead.
config POSIX_CLOCK
bool "clock and sleep APIs [DEPRECATED]"
select DEPRECATED
@ -75,6 +84,15 @@ config POSIX_MAX_OPEN_FILES
See also CONFIG_ZVFS_OPEN_MAX.
config POSIX_MQUEUE
bool "Message queue support [DEPRECATED]"
select DEPRECATED
select POSIX_MESSAGE_PASSING
help
This option is deprecated.
Please use CONFIG_POSIX_MESSAGE_PASSING instead.
config POSIX_SYSCONF
bool "Support for sysconf() [DEPRECATED]"
select DEPRECATED

View file

@ -2,33 +2,39 @@
#
# SPDX-License-Identifier: Apache-2.0
menuconfig POSIX_MQUEUE
bool "Message queue support"
menuconfig POSIX_MESSAGE_PASSING
bool "POSIX message queue support"
default y if POSIX_API
help
This enabled POSIX message queue related APIs.
if POSIX_MQUEUE
if POSIX_MESSAGE_PASSING
config MSG_COUNT_MAX
int "Maximum number of messages in message queue"
config POSIX_MQ_OPEN_MAX
int "Maximum number of messages in a POSIX message queue"
default 16
help
Mention maximum number of messages in message queue in POSIX compliant
application.
config POSIX_MQ_PRIO_MAX
int "Maximum number of POSIX message priorities"
default 32
help
Maximum number of message priorities supported by the implementation.
config MSG_SIZE_MAX
int "Maximum size of a message"
int "Maximum size of a POSIX message"
default 16
help
Mention maximum size of message in bytes.
config MQUEUE_NAMELEN_MAX
int "Maximum size of a name length"
int "Maximum POSIX message queue name size"
default 16
range 2 255
help
Mention length of message queue name in number of characters.
Mention size of message queue name in number of characters.
config HEAP_MEM_POOL_ADD_SIZE_MQUEUE
def_int 1024

View file

@ -118,7 +118,7 @@ mqd_t mq_open(const char *name, int oflags, ...)
/* Check for message quantity and size in message queue */
if (attrs->mq_msgsize > CONFIG_MSG_SIZE_MAX &&
attrs->mq_maxmsg > CONFIG_MSG_COUNT_MAX) {
attrs->mq_maxmsg > CONFIG_POSIX_MQ_OPEN_MAX) {
goto free_mq_desc;
}

View file

@ -3,7 +3,7 @@ CONFIG_POSIX_API=y
CONFIG_MAX_PTHREAD_COUNT=6
CONFIG_ZTEST=y
CONFIG_SEM_VALUE_MAX=32767
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MESSAGE_PASSING=y
CONFIG_POSIX_PRIORITY_SCHEDULING=y
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_THREAD_NAME=y

View file

@ -17,6 +17,6 @@ CONFIG_NET_SOCKETPAIR=y
CONFIG_PTHREAD_IPC=y
CONFIG_POSIX_FS=y
CONFIG_POSIX_TIMERS=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MESSAGE_PASSING=y
CONFIG_EVENTFD=y
CONFIG_GETOPT=y