Skip to content

Commit

Permalink
posix: move limit definitions to posix/sys/limits.h
Browse files Browse the repository at this point in the history
Rather than defining values that should appear in limits.h in
posix_features.h, move them to a separate file.

Undefine any externally defined POSIX limits, since Zephyr
would prefer to define those based on Kconfig values.

Signed-off-by: Chris Friedt <[email protected]>
  • Loading branch information
cfriedt committed Oct 26, 2024
1 parent 4a8a035 commit 97e71ee
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 111 deletions.
2 changes: 1 addition & 1 deletion include/zephyr/posix/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef ZEPHYR_INCLUDE_POSIX_DIRENT_H_
#define ZEPHYR_INCLUDE_POSIX_DIRENT_H_

#include <limits.h>
#include <zephyr/posix/limits.h>

#include <zephyr/posix/posix_types.h>

Expand Down
14 changes: 14 additions & 0 deletions include/zephyr/posix/limits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Tenstorrent AI ULC
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef ZEPHYR_POSIX_LIMITS_H_
#define ZEPHYR_POSIX_LIMITS_H_

#include_next <limits.h>

#include <zephyr/posix/sys/limits.h>

#endif /* ZEPHYR_POSIX_LIMITS_H_ */
110 changes: 0 additions & 110 deletions include/zephyr/posix/posix_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,114 +234,4 @@
/* #define _XOPEN_UNIX (-1L) */
/* #define _XOPEN_UUCP (-1L) */

/* Maximum values */
#define _POSIX_CLOCKRES_MIN (20000000L)

/* Minimum values */
#define _POSIX_AIO_LISTIO_MAX (2)
#define _POSIX_AIO_MAX (1)
#define _POSIX_ARG_MAX (4096)
#define _POSIX_CHILD_MAX (25)
#define _POSIX_DELAYTIMER_MAX \
COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0))
#define _POSIX_HOST_NAME_MAX \
COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0))
#define _POSIX_LINK_MAX (8)
#define _POSIX_LOGIN_NAME_MAX (9)
#define _POSIX_MAX_CANON (255)
#define _POSIX_MAX_INPUT (255)
#define _POSIX_MQ_OPEN_MAX \
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)
#define _POSIX_OPEN_MAX CONFIG_POSIX_OPEN_MAX
#define _POSIX_PATH_MAX (256)
#define _POSIX_PIPE_BUF (512)
#define _POSIX_RE_DUP_MAX (255)
#define _POSIX_RTSIG_MAX \
COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0))
#define _POSIX_SEM_NSEMS_MAX \
COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0))
#define _POSIX_SEM_VALUE_MAX \
COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0))
#define _POSIX_SIGQUEUE_MAX (32)
#define _POSIX_SSIZE_MAX (32767)
#define _POSIX_SS_REPL_MAX (4)
#define _POSIX_STREAM_MAX (8)
#define _POSIX_SYMLINK_MAX (255)
#define _POSIX_SYMLOOP_MAX (8)
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS (4)
#define _POSIX_THREAD_KEYS_MAX \
COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0))
#define _POSIX_THREAD_THREADS_MAX \
COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0))
#define _POSIX_TIMER_MAX \
COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))
#define _POSIX_TRACE_EVENT_NAME_MAX (30)
#define _POSIX_TRACE_NAME_MAX (8)
#define _POSIX_TRACE_SYS_MAX (8)
#define _POSIX_TRACE_USER_EVENT_MAX (32)
#define _POSIX_TTY_NAME_MAX (9)
#define _POSIX_TZNAME_MAX (6)
#define _POSIX2_BC_BASE_MAX (99)
#define _POSIX2_BC_DIM_MAX (2048)
#define _POSIX2_BC_SCALE_MAX (99)
#define _POSIX2_BC_STRING_MAX (1000)
#define _POSIX2_CHARCLASS_NAME_MAX (14)
#define _POSIX2_COLL_WEIGHTS_MAX (2)
#define _POSIX2_EXPR_NEST_MAX (32)
#define _POSIX2_LINE_MAX (2048)
#define _XOPEN_IOV_MAX (16)
#define _XOPEN_NAME_MAX (255)
#define _XOPEN_PATH_MAX (1024)

/* Other invariant values */
#define NL_LANGMAX (14)
#define NL_MSGMAX (32767)
#define NL_SETMAX (255)
#define NL_TEXTMAX (_POSIX2_LINE_MAX)
#define NZERO (20)

/* Runtime invariant values */
#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
#define AIO_MAX _POSIX_AIO_MAX
#define AIO_PRIO_DELTA_MAX (0)
#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX
#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX

#ifndef ATEXIT_MAX
#define ATEXIT_MAX 8
#endif

#define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE
#define PAGESIZE PAGE_SIZE

#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
#define RTSIG_MAX _POSIX_RTSIG_MAX
#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX
#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX
#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
#define STREAM_MAX _POSIX_STREAM_MAX
#define SYMLOOP_MAX _POSIX_SYMLOOP_MAX
#define TIMER_MAX _POSIX_TIMER_MAX
#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
#ifndef TZNAME_MAX
#define TZNAME_MAX _POSIX_TZNAME_MAX
#endif

/* Pathname variable values */
#define FILESIZEBITS (32)
#define POSIX_ALLOC_SIZE_MIN (256)
#define POSIX_REC_INCR_XFER_SIZE (1024)
#define POSIX_REC_MAX_XFER_SIZE (32767)
#define POSIX_REC_MIN_XFER_SIZE (1)
#define POSIX_REC_XFER_ALIGN (4)
#define SYMLINK_MAX _POSIX_SYMLINK_MAX

#endif /* INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ */
2 changes: 2 additions & 0 deletions include/zephyr/posix/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <zephyr/posix/posix_types.h>
#include "posix_features.h"

#include <zephyr/posix/limits.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
122 changes: 122 additions & 0 deletions include/zephyr/posix/sys/limits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Copyright (c) 2024 BayLibre SAS
* Copyright (c) 2024 Tenstorrent AI ULC
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef ZEPHYR_POSIX_SYS_LIMITS_H_
#define ZEPHYR_POSIX_SYS_LIMITS_H_

#include <zephyr/autoconf.h> /* CONFIG_* */
#include <zephyr/sys/util_macro.h> /* COND_CODE_1() */

#include "limits_undef.h"

/* Maximum values */
#define _POSIX_CLOCKRES_MIN (20000000L)

/* Minimum values */
#define _POSIX_AIO_LISTIO_MAX (2)
#define _POSIX_AIO_MAX (1)
#define _POSIX_ARG_MAX (4096)
#define _POSIX_CHILD_MAX (25)
#define _POSIX_DELAYTIMER_MAX (32)
#define _POSIX_HOST_NAME_MAX (255)
#define _POSIX_LINK_MAX (8)
#define _POSIX_LOGIN_NAME_MAX (9)
#define _POSIX_MAX_CANON (255)
#define _POSIX_MAX_INPUT (255)
#define _POSIX_MQ_OPEN_MAX (8)
#define _POSIX_MQ_PRIO_MAX (32)
#define _POSIX_NAME_MAX (14)
#define _POSIX_NGROUPS_MAX (8)
#define _POSIX_OPEN_MAX (20)
#define _POSIX_PATH_MAX (256)
#define _POSIX_PIPE_BUF (512)
#define _POSIX_RE_DUP_MAX (255)
#define _POSIX_RTSIG_MAX (8)
#define _POSIX_SEM_NSEMS_MAX (256)
#define _POSIX_SEM_VALUE_MAX (32767)
#define _POSIX_SIGQUEUE_MAX (32)
#define _POSIX_SSIZE_MAX (32767)
#define _POSIX_SS_REPL_MAX (4)
#define _POSIX_STREAM_MAX (8)
#define _POSIX_SYMLINK_MAX (255)
#define _POSIX_SYMLOOP_MAX (8)
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS (4)
#define _POSIX_THREAD_KEYS_MAX (128)
#define _POSIX_THREAD_THREADS_MAX (64)
#define _POSIX_TIMER_MAX (32)
#define _POSIX_TRACE_EVENT_NAME_MAX (30)
#define _POSIX_TRACE_NAME_MAX (8)
#define _POSIX_TRACE_SYS_MAX (8)
#define _POSIX_TRACE_USER_EVENT_MAX (32)
#define _POSIX_TTY_NAME_MAX (9)
#define _POSIX_TZNAME_MAX (6)
#define _POSIX2_BC_BASE_MAX (99)
#define _POSIX2_BC_DIM_MAX (2048)
#define _POSIX2_BC_SCALE_MAX (99)
#define _POSIX2_BC_STRING_MAX (1000)
#define _POSIX2_CHARCLASS_NAME_MAX (14)
#define _POSIX2_COLL_WEIGHTS_MAX (2)
#define _POSIX2_EXPR_NEST_MAX (32)
#define _POSIX2_LINE_MAX (2048)
#define _XOPEN_IOV_MAX (16)
#define _XOPEN_NAME_MAX (255)
#define _XOPEN_PATH_MAX (1024)

/* Other invariant values */
#define NL_LANGMAX (14)
#define NL_MSGMAX (32767)
#define NL_SETMAX (255)
#define NL_TEXTMAX (_POSIX2_LINE_MAX)
#define NZERO (20)

/* Runtime invariant values */
#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
#define AIO_MAX _POSIX_AIO_MAX
#define AIO_PRIO_DELTA_MAX (0)
#define ARG_MAX _POSIX_ARG_MAX
#define ATEXIT_MAX (32)
#define DELAYTIMER_MAX \
COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0))
#define HOST_NAME_MAX \
COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0))
#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
#define MQ_OPEN_MAX \
COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0))
#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
#define OPEN_MAX CONFIG_POSIX_OPEN_MAX
#define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE
#define PAGESIZE CONFIG_POSIX_PAGE_SIZE
#define PATH_MAX _POSIX_PATH_MAX
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_KEYS_MAX \
COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0))
#define PTHREAD_THREADS_MAX \
COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0))
#define RTSIG_MAX \
COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0))
#define SEM_NSEMS_MAX \
COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0))
#define SEM_VALUE_MAX \
COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0))
#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
#define STREAM_MAX _POSIX_STREAM_MAX
#define SYMLOOP_MAX _POSIX_SYMLOOP_MAX
#define TIMER_MAX \
COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))
#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX

Check notice on line 110 in include/zephyr/posix/sys/limits.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/posix/sys/limits.h:110 -#define DELAYTIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) -#define HOST_NAME_MAX \ - COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) +#define DELAYTIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) +#define HOST_NAME_MAX COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -#define MQ_OPEN_MAX \ - COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) +#define MQ_OPEN_MAX COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) #define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX #define OPEN_MAX CONFIG_POSIX_OPEN_MAX #define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE #define PAGESIZE CONFIG_POSIX_PAGE_SIZE #define PATH_MAX _POSIX_PATH_MAX #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_KEYS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) -#define PTHREAD_THREADS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) -#define RTSIG_MAX \ - COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) -#define SEM_NSEMS_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) -#define SEM_VALUE_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) +#define PTHREAD_KEYS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) +#define PTHREAD_THREADS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) +#define RTSIG_MAX COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) +#define SEM_NSEMS_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) +#define SEM_VALUE_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) #define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX #define STREAM_MAX _POSIX_STREAM_MAX #define SYMLOOP_MAX _POSIX_SYMLOOP_MAX -#define TIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0)) +#define TIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))

Check notice on line 110 in include/zephyr/posix/sys/limits.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/posix/sys/limits.h:110 -#define DELAYTIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) -#define HOST_NAME_MAX \ - COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) +#define DELAYTIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) +#define HOST_NAME_MAX COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -#define MQ_OPEN_MAX \ - COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) +#define MQ_OPEN_MAX COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) #define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX #define OPEN_MAX CONFIG_POSIX_OPEN_MAX #define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE #define PAGESIZE CONFIG_POSIX_PAGE_SIZE #define PATH_MAX _POSIX_PATH_MAX #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_KEYS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) -#define PTHREAD_THREADS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) -#define RTSIG_MAX \ - COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) -#define SEM_NSEMS_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) -#define SEM_VALUE_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) +#define PTHREAD_KEYS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) +#define PTHREAD_THREADS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) +#define RTSIG_MAX COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) +#define SEM_NSEMS_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) +#define SEM_VALUE_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) #define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX #define STREAM_MAX _POSIX_STREAM_MAX #define SYMLOOP_MAX _POSIX_SYMLOOP_MAX -#define TIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0)) +#define TIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))

Check notice on line 110 in include/zephyr/posix/sys/limits.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/posix/sys/limits.h:110 -#define DELAYTIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) -#define HOST_NAME_MAX \ - COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) +#define DELAYTIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0)) +#define HOST_NAME_MAX COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0)) #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -#define MQ_OPEN_MAX \ - COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) +#define MQ_OPEN_MAX COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0)) #define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX #define OPEN_MAX CONFIG_POSIX_OPEN_MAX #define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE #define PAGESIZE CONFIG_POSIX_PAGE_SIZE #define PATH_MAX _POSIX_PATH_MAX #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_KEYS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) -#define PTHREAD_THREADS_MAX \ - COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) -#define RTSIG_MAX \ - COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) -#define SEM_NSEMS_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) -#define SEM_VALUE_MAX \ - COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) +#define PTHREAD_KEYS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0)) +#define PTHREAD_THREADS_MAX COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0)) +#define RTSIG_MAX COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0)) +#define SEM_NSEMS_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0)) +#define SEM_VALUE_MAX COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0)) #define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX #define STREAM_MAX _POSIX_STREAM_MAX #define SYMLOOP_MAX _POSIX_SYMLOOP_MAX -#define TIMER_MAX \ - COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0)) +#define TIMER_MAX COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))
#define TZNAME_MAX _POSIX_TZNAME_MAX

/* Pathname variable values */
#define FILESIZEBITS (32)
#define POSIX_ALLOC_SIZE_MIN (256)
#define POSIX_REC_INCR_XFER_SIZE (1024)
#define POSIX_REC_MAX_XFER_SIZE (32767)
#define POSIX_REC_MIN_XFER_SIZE (1)
#define POSIX_REC_XFER_ALIGN (4)
#define SYMLINK_MAX _POSIX_SYMLINK_MAX

#endif /* ZEPHYR_POSIX_SYS_LIMITS_H_ */
107 changes: 107 additions & 0 deletions include/zephyr/posix/sys/limits_undef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2024 Tenstorrent AI ULC
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef ZEPHYR_POSIX_SYS_LIMITS_UNDEF_H_
#define ZEPHYR_POSIX_SYS_LIMITS_UNDEF_H_

/* Maximum values */
#undef _POSIX_CLOCKRES_MIN

/* Minimum values */
#undef _POSIX_AIO_LISTIO_MAX
#undef _POSIX_AIO_MAX
#undef _POSIX_ARG_MAX
#undef _POSIX_CHILD_MAX
#undef _POSIX_DELAYTIMER_MAX
#undef _POSIX_HOST_NAME_MAX
#undef _POSIX_LINK_MAX
#undef _POSIX_LOGIN_NAME_MAX
#undef _POSIX_MAX_CANON
#undef _POSIX_MAX_INPUT
#undef _POSIX_MQ_OPEN_MAX
#undef _POSIX_MQ_PRIO_MAX
#undef _POSIX_NAME_MAX
#undef _POSIX_NGROUPS_MAX
#undef _POSIX_OPEN_MAX
#undef _POSIX_PATH_MAX
#undef _POSIX_PIPE_BUF
#undef _POSIX_RE_DUP_MAX
#undef _POSIX_RTSIG_MAX
#undef _POSIX_SEM_NSEMS_MAX
#undef _POSIX_SEM_VALUE_MAX
#undef _POSIX_SIGQUEUE_MAX
#undef _POSIX_SSIZE_MAX
#undef _POSIX_SS_REPL_MAX
#undef _POSIX_STREAM_MAX
#undef _POSIX_SYMLINK_MAX
#undef _POSIX_SYMLOOP_MAX
#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#undef _POSIX_THREAD_KEYS_MAX
#undef _POSIX_THREAD_THREADS_MAX
#undef _POSIX_TIMER_MAX
#undef _POSIX_TRACE_EVENT_NAME_MAX
#undef _POSIX_TRACE_NAME_MAX
#undef _POSIX_TRACE_SYS_MAX
#undef _POSIX_TRACE_USER_EVENT_MAX
#undef _POSIX_TTY_NAME_MAX
#undef _POSIX_TZNAME_MAX
#undef _POSIX2_BC_BASE_MAX
#undef _POSIX2_BC_DIM_MAX
#undef _POSIX2_BC_SCALE_MAX
#undef _POSIX2_BC_STRING_MAX
#undef _POSIX2_CHARCLASS_NAME_MAX
#undef _POSIX2_COLL_WEIGHTS_MAX
#undef _POSIX2_EXPR_NEST_MAX
#undef _POSIX2_LINE_MAX
#undef _XOPEN_IOV_MAX
#undef _XOPEN_NAME_MAX
#undef _XOPEN_PATH_MAX

/* Other invariant values */
#undef NL_LANGMAX
#undef NL_MSGMAX
#undef NL_SETMAX
#undef NL_TEXTMAX
#undef NZERO

/* Runtime invariant values */
#undef AIO_LISTIO_MAX
#undef AIO_MAX
#undef AIO_PRIO_DELTA_MAX
#undef ARG_MAX
#undef ATEXIT_MAX
#undef DELAYTIMER_MAX
#undef HOST_NAME_MAX
#undef LOGIN_NAME_MAX
#undef MQ_OPEN_MAX
#undef MQ_PRIO_MAX
#undef OPEN_MAX
#undef PAGE_SIZE
#undef PAGESIZE
#undef PATH_MAX
#undef PTHREAD_DESTRUCTOR_ITERATIONS
#undef PTHREAD_KEYS_MAX
#undef PTHREAD_THREADS_MAX
#undef RTSIG_MAX
#undef SEM_NSEMS_MAX
#undef SEM_VALUE_MAX
#undef SIGQUEUE_MAX
#undef STREAM_MAX
#undef SYMLOOP_MAX
#undef TIMER_MAX
#undef TTY_NAME_MAX
#undef TZNAME_MAX

/* Pathname variable values */
#undef FILESIZEBITS
#undef POSIX_ALLOC_SIZE_MIN
#undef POSIX_REC_INCR_XFER_SIZE
#undef POSIX_REC_MAX_XFER_SIZE
#undef POSIX_REC_MIN_XFER_SIZE
#undef POSIX_REC_XFER_ALIGN
#undef SYMLINK_MAX

#endif /* ZEPHYR_POSIX_SYS_LIMITS_UNDEF_H_ */

0 comments on commit 97e71ee

Please sign in to comment.