diff --git a/include/zephyr/posix/dirent.h b/include/zephyr/posix/dirent.h index 0ffe875606f01fb..948bb6671a6f2b4 100644 --- a/include/zephyr/posix/dirent.h +++ b/include/zephyr/posix/dirent.h @@ -6,7 +6,7 @@ #ifndef ZEPHYR_INCLUDE_POSIX_DIRENT_H_ #define ZEPHYR_INCLUDE_POSIX_DIRENT_H_ -#include +#include #include diff --git a/include/zephyr/posix/limits.h b/include/zephyr/posix/limits.h new file mode 100644 index 000000000000000..81f20899fcdc758 --- /dev/null +++ b/include/zephyr/posix/limits.h @@ -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 + +#include + +#endif /* ZEPHYR_POSIX_LIMITS_H_ */ diff --git a/include/zephyr/posix/posix_features.h b/include/zephyr/posix/posix_features.h index e4a91c6fc92cec4..7fe0bc87d2838a2 100644 --- a/include/zephyr/posix/posix_features.h +++ b/include/zephyr/posix/posix_features.h @@ -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_ */ diff --git a/include/zephyr/posix/signal.h b/include/zephyr/posix/signal.h index e106642f6f1a72f..1de2a35b89da8b2 100644 --- a/include/zephyr/posix/signal.h +++ b/include/zephyr/posix/signal.h @@ -10,6 +10,8 @@ #include #include "posix_features.h" +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/include/zephyr/posix/sys/limits.h b/include/zephyr/posix/sys/limits.h new file mode 100644 index 000000000000000..83c3d171b6b9d4a --- /dev/null +++ b/include/zephyr/posix/sys/limits.h @@ -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 /* CONFIG_* */ +#include /* 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 +#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_ */ diff --git a/include/zephyr/posix/sys/limits_undef.h b/include/zephyr/posix/sys/limits_undef.h new file mode 100644 index 000000000000000..8721b2295ffeb9e --- /dev/null +++ b/include/zephyr/posix/sys/limits_undef.h @@ -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_ */