# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

source "lib/posix/getopt/Kconfig"

config POSIX_MAX_FDS
	int "Maximum number of open file descriptors"
	default 16 if POSIX_API
	default 4
	help
	  Maximum number of open file descriptors, this includes
	  files, sockets, special devices, etc.

config POSIX_API
	depends on !ARCH_POSIX
	bool "POSIX APIs"
	help
	  Enable mostly-standards-compliant implementations of
	  various POSIX (IEEE 1003.1) APIs.

config PTHREAD_IPC
	bool "POSIX pthread IPC API"
	default y if POSIX_API
	depends on POSIX_CLOCK
	help
	  This enables a mostly-standards-compliant implementation of
	  the pthread mutex, condition variable and barrier IPC
	  mechanisms.

if PTHREAD_IPC
config MAX_PTHREAD_COUNT
	int "Maximum simultaneously active pthread count in POSIX application"
	default 5
	range 0 255
	help
	  Maximum number of simultaneously active threads in a POSIX application.

config MAX_PTHREAD_MUTEX_COUNT
	int "Maximum simultaneously active mutex count in POSIX application"
	default 5
	range 0 255
	help
	  Maximum number of simultaneously active mutexes in a POSIX application.

config MAX_PTHREAD_COND_COUNT
	int "Maximum simultaneously active condition variables in a POSIX application"
	default 5
	range 0 255
	help
	  Maximum number of simultaneously active condition variables in a POSIX application.

config MAX_PTHREAD_KEY_COUNT
	int "Maximum simultaneously active keys in a POSIX application"
	default 5
	range 0 255
	help
	  Maximum number of simultaneously active keys in a POSIX application.

config SEM_VALUE_MAX
	int "Maximum semaphore limit"
	default 32767
	range 1 32767
	help
	  Maximum semaphore count in POSIX compliant Application.

endif # PTHREAD_IPC

config POSIX_CLOCK
	bool "POSIX clock, timer, and sleep APIs"
	default y if POSIX_API
	help
	  This enables POSIX clock\_\*(), timer\_\*(), and \*sleep()
	  functions.

config MAX_TIMER_COUNT
	int "Maximum timer count in POSIX application"
	default 5
	range 0 255
	help
	  Mention maximum number of timers in POSIX compliant application.

config TIMER_CREATE_WAIT
	int "Time to wait for timer availability (in msec) in POSIX application"
	default 100
	range 0 1000
	help
	  This controls how long to wait for resources to come available to create
	  a new timer in POSIX compliant application

config POSIX_MQUEUE
	bool "POSIX message queue"
	default y if POSIX_API
	help
	  This enabled POSIX message queue related APIs.

if POSIX_MQUEUE
config MSG_COUNT_MAX
	int "Maximum number of messages in message queue"
	default 16
	help
	  Mention maximum number of messages in message queue in POSIX compliant
	  application.

config MSG_SIZE_MAX
	int "Maximum size of a message"
	default 16
	help
	  Mention maximum size of message in bytes.

config MQUEUE_NAMELEN_MAX
	int "Maximum size of a name length"
	default 16
	range 2 255
	help
	  Mention length of message queue name in number of characters.

endif

config POSIX_FS
	bool "POSIX file system API support"
	default y if POSIX_API
	depends on FILE_SYSTEM
	help
	  This enables POSIX style file system related APIs.

config POSIX_MAX_OPEN_FILES
	int "Maximum number of open file descriptors"
	default 16
	depends on POSIX_FS
	help
	  Maximum number of open files. Note that this setting
	  is additionally bounded by CONFIG_POSIX_MAX_FDS.

# The name of this option is mandated by zephyr_interface_library_named
# cmake directive.
config APP_LINK_WITH_POSIX_SUBSYS
	bool "Make POSIX headers available to application"
	default y
	depends on POSIX_API
	help
	  Add POSIX subsystem header files to the 'app' include path.

config EVENTFD
	bool "Support for eventfd"
	depends on !ARCH_POSIX
	default y if POSIX_API
	help
	  Enable support for event file descriptors, eventfd. An eventfd can
	  be used as an event wait/notify mechanism together with POSIX calls
	  like read, write and poll.

config EVENTFD_MAX
	int "Maximum number of eventfd's"
	depends on EVENTFD
	default 1
	range 1 4096
	help
	  The maximum number of supported event file descriptors.
