fs and unistd: increase OPEN_MAX by claiming a Kconfig.

Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
田昕 2022-03-31 21:28:35 +08:00 committed by Petro Karashchenko
parent 8a80a853b7
commit 463a437733
4 changed files with 14 additions and 3 deletions

View file

@ -71,7 +71,7 @@ static int files_extend(FAR struct filelist *list, size_t row)
return 0;
}
if (row * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK > _POSIX_OPEN_MAX)
if (row * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK > OPEN_MAX)
{
return -EMFILE;
}

View file

@ -203,7 +203,11 @@
#define NAME_MAX _POSIX_NAME_MAX
#define TTY_NAME_MAX _POSIX_NAME_MAX
#define NGROUPS_MAX _POSIX_NGROUPS_MAX
#define OPEN_MAX _POSIX_OPEN_MAX
#if CONFIG_OPEN_MAX < _POSIX_OPEN_MAX
# define OPEN_MAX _POSIX_OPEN_MAX
#else
# define OPEN_MAX CONFIG_OPEN_MAX
#endif
#define PATH_MAX _POSIX_PATH_MAX
#define PIPE_BUF _POSIX_PIPE_BUF
#define SIZE_MAX _POSIX_SIZE_MAX

View file

@ -143,3 +143,10 @@ config LIBC_HOSTNAME
default ""
---help---
A unique name to identify device on the network
config OPEN_MAX
int "OPEN_MAX for this device"
default 255
---help---
The maximum number of files that a process can have open
at any time. Must not be less than _POSIX_OPEN_MAX.

View file

@ -211,7 +211,7 @@ long sysconf(int name)
return CLOCKS_PER_SEC;
case _SC_OPEN_MAX:
return _POSIX_OPEN_MAX;
return OPEN_MAX;
case _SC_ATEXIT_MAX:
#ifdef CONFIG_SCHED_EXIT_MAX