fs: allocate file/socket dynamically

Change-Id: I8aea63eaf0275f47f21fc8d5482b51ffecd5c906
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2021-03-16 20:13:02 +08:00
committed by Xiang Xiao
parent 59eb4fa8d6
commit e96c8b9283
35 changed files with 760 additions and 599 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ int posix_spawn_file_actions_addclose(
{
FAR struct spawn_close_file_action_s *entry;
DEBUGASSERT(file_actions && fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS);
DEBUGASSERT(file_actions && fd >= 0);
/* Allocate the action list entry */
+1 -3
View File
@@ -65,9 +65,7 @@ int posix_spawn_file_actions_adddup2(
{
FAR struct spawn_dup2_file_action_s *entry;
DEBUGASSERT(file_actions &&
fd1 >= 0 && fd1 < CONFIG_NFILE_DESCRIPTORS &&
fd2 >= 0 && fd2 < CONFIG_NFILE_DESCRIPTORS);
DEBUGASSERT(file_actions && fd1 >= 0 && fd2 >= 0);
/* Allocate the action list entry */
+8 -7
View File
@@ -79,16 +79,16 @@
*
****************************************************************************/
int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions,
int fd, FAR const char *path, int oflags,
mode_t mode)
int posix_spawn_file_actions_addopen(
FAR posix_spawn_file_actions_t *file_actions,
int fd, FAR const char *path, int oflags,
mode_t mode)
{
FAR struct spawn_open_file_action_s *entry;
size_t len;
size_t alloc;
DEBUGASSERT(file_actions && path &&
fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS);
DEBUGASSERT(file_actions && path && fd >= 0);
/* Get the size of the action including storage for the path plus its NUL
* terminating character.
@@ -111,10 +111,11 @@ int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_action
entry->fd = fd;
entry->oflags = oflags;
entry->mode = mode;
strncpy(entry->path, path, len+1);
strncpy(entry->path, path, len + 1);
/* And add it to the file action list */
add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry);
add_file_action(file_actions,
(FAR struct spawn_general_file_action_s *)entry);
return OK;
}
+1 -1
View File
@@ -208,7 +208,7 @@ long sysconf(int name)
switch (name)
{
case _SC_OPEN_MAX:
return CONFIG_NFILE_DESCRIPTORS;
return _POSIX_OPEN_MAX;
case _SC_ATEXIT_MAX:
#ifdef CONFIG_SCHED_EXIT_MAX