mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
fs: allocate file/socket dynamically
Change-Id: I8aea63eaf0275f47f21fc8d5482b51ffecd5c906 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user