sched/group: Move files_initlist/lib_stream_initialize to group_alloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-02-28 15:34:03 +08:00 committed by Masayuki Ishikawa
parent 8caa496947
commit eb1cc02d09
4 changed files with 12 additions and 13 deletions

View File

@ -30,7 +30,9 @@
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/fs/fs.h>
#include <nuttx/kmalloc.h>
#include <nuttx/lib/lib.h>
#include <nuttx/semaphore.h>
#include <nuttx/sched.h>
#include <nuttx/tls.h>
@ -201,6 +203,16 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
goto errout_with_group;
}
/* Initialize file descriptors for the TCB */
files_initlist(&group->tg_filelist);
#ifdef CONFIG_FILE_STREAM
/* Initialize file streams for the task group */
lib_stream_initialize(group);
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Initialize the pthread join semaphore */

View File

@ -65,10 +65,6 @@ int group_setupidlefiles(FAR struct task_tcb_s *tcb)
DEBUGASSERT(group != NULL);
/* Initialize file descriptors for the TCB */
files_initlist(&group->tg_filelist);
/* Open stdin, dup to get stdout and stderr. This should always
* be the first file opened and, hence, should always get file
* descriptor 0.

View File

@ -30,7 +30,6 @@
#include <nuttx/fs/fs.h>
#include <nuttx/net/net.h>
#include <nuttx/lib/lib.h>
#include "group/group.h"
@ -57,10 +56,6 @@ int group_setupstreams(FAR struct task_tcb_s *tcb)
{
DEBUGASSERT(tcb && tcb->cmn.group);
/* Initialize file streams for the task group */
lib_stream_initialize(tcb->cmn.group);
/* fdopen to get the stdin, stdout and stderr streams. The following logic
* depends on the fact that the library layer will allocate FILEs in order.
*

View File

@ -68,10 +68,6 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb)
TCB_FLAG_TTYPE_PTHREAD);
#endif
/* Initialize file descriptors for the TCB */
files_initlist(&group->tg_filelist);
#ifndef CONFIG_FDCLONE_DISABLE
DEBUGASSERT(rtcb->group);