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

Function spawn_execattrs

sched/task/task_spawnparms.c:146–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 ****************************************************************************/
145
146int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr)
147{
148 struct sched_param param;
149 int ret = OK;
150
151 DEBUGASSERT(attr);
152
153 /* Now set the attributes. Note that we ignore all of the return values
154 * here because we have already successfully started the task. If we
155 * return an error value, then we would also have to stop the task.
156 */
157
158 /* Firstly, set the signal mask if requested to do so */
159
160#ifndef CONFIG_DISABLE_ALL_SIGNALS
161 if ((attr->flags & POSIX_SPAWN_SETSIGMASK) != 0u)
162 {
163 FAR struct tcb_s *tcb = nxsched_get_tcb(pid);
164 if (tcb)
165 {
166 tcb->sigprocmask = attr->sigmask;
167 }
168 }
169#endif
170
171 /* If we are only setting the priority, then call sched_setparm()
172 * to set the priority of the of the new task.
173 */
174
175 if ((attr->flags & POSIX_SPAWN_SETSCHEDPARAM) != 0u)
176 {
177#ifdef CONFIG_SCHED_SPORADIC
178 /* Get the current sporadic scheduling parameters. Those will not be
179 * modified.
180 */
181
182 ret = nxsched_get_param(pid, &param);
183#endif
184
185 if (ret == OK)
186 {
187 /* Get the priority from the attributes */
188
189 param.sched_priority = attr->priority;
190
191 /* If we are setting *both* the priority and the scheduler,
192 * then we will call nxsched_set_scheduler() below.
193 */
194
195 if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) == 0u)
196 {
197 sinfo("Setting priority=%d for pid=%d\n",
198 param.sched_priority, pid);
199
200 ret = nxsched_set_param(pid, &param);
201 }
202 }
203 }

Callers 2

nxtask_spawn_createFunction · 0.85
exec_moduleFunction · 0.85

Calls 4

nxsched_get_tcbFunction · 0.85
nxsched_get_paramFunction · 0.85
nxsched_set_paramFunction · 0.85
nxsched_set_schedulerFunction · 0.85

Tested by

no test coverage detected