From 512676cb06179e033bd55892020c89391b59812b Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 31 Jan 2022 02:10:54 +0800 Subject: [PATCH] sched: Don't duplicate caller file handler when creating kernel thread kernel thread should have only the starndard file i/o just like idle thread Signed-off-by: Xiang Xiao --- sched/task/task_init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sched/task/task_init.c b/sched/task/task_init.c index a777c44b6a..fed1356717 100644 --- a/sched/task/task_init.c +++ b/sched/task/task_init.c @@ -105,7 +105,15 @@ int nxtask_init(FAR struct task_tcb_s *tcb, const char *name, int priority, /* Associate file descriptors with the new task */ - ret = group_setuptaskfiles(tcb); + if (ttype == TCB_FLAG_TTYPE_KERNEL) + { + ret = group_setupidlefiles(tcb); + } + else + { + ret = group_setuptaskfiles(tcb); + } + if (ret < 0) { goto errout_with_group;