MCPcopy Create free account
hub / github.com/apache/nuttx / nxtask_init

Function nxtask_init

sched/task/task_init.c:88–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 ****************************************************************************/
87
88int nxtask_init(FAR struct tcb_s *tcb, const char *name, int priority,
89 FAR void *stack, uint32_t stack_size,
90 main_t entry, FAR char * const argv[],
91 FAR char * const envp[],
92 FAR const posix_spawn_file_actions_t *actions)
93{
94 uint8_t ttype = tcb->flags & TCB_FLAG_TTYPE_MASK;
95 int ret;
96
97 sched_trace_begin();
98
99#ifndef CONFIG_DISABLE_PTHREAD
100 /* Only tasks and kernel threads can be initialized in this way */
101
102 DEBUGASSERT(tcb && ttype != TCB_FLAG_TTYPE_PTHREAD);
103#endif
104
105#ifdef CONFIG_ARCH_ADDRENV
106 /* Kernel threads do not own any address environment */
107
108 if (ttype == TCB_FLAG_TTYPE_KERNEL)
109 {
110 tcb->addrenv_own = NULL;
111 }
112#endif
113
114 /* Create a new task group */
115
116 ret = group_allocate(tcb, tcb->flags);
117 if (ret < 0)
118 {
119 sched_trace_end();
120 return ret;
121 }
122
123#ifndef CONFIG_DISABLE_PTHREAD
124 /* Initialize the task join */
125
126 nxtask_joininit(tcb);
127#endif
128
129 /* Duplicate the parent tasks environment */
130
131 ret = env_dup(tcb->group, envp);
132 if (ret < 0)
133 {
134 goto errout_with_group;
135 }
136
137 /* Associate file descriptors with the new task */
138
139 ret = group_setuptaskfiles(tcb, actions, true);
140 if (ret < 0)
141 {
142 goto errout_with_group;
143 }
144
145 /* Set the task name */

Calls 15

group_allocateFunction · 0.85
nxtask_joininitFunction · 0.85
env_dupFunction · 0.85
group_setuptaskfilesFunction · 0.85
nxtask_setup_nameFunction · 0.85
nxtask_setup_schedulerFunction · 0.85
tls_init_infoFunction · 0.85
nxtask_setup_stackargsFunction · 0.85
group_initializeFunction · 0.85
nxtask_joindestroyFunction · 0.85
group_leaveFunction · 0.85
up_use_stackFunction · 0.50

Tested by

no test coverage detected