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

Function exec_module

binfmt/binfmt_execmodule.c:152–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 ****************************************************************************/
151
152int exec_module(FAR struct binary_s *binp,
153 FAR const char *filename, FAR char * const *argv,
154 FAR char * const *envp,
155 FAR const posix_spawn_file_actions_t *actions,
156 FAR const posix_spawnattr_t *attr,
157 bool spawn)
158{
159 FAR struct tcb_s *tcb;
160#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
161 FAR struct arch_addrenv_s *addrenv = &binp->addrenv->addrenv;
162 FAR void *vheap;
163 char name[PATH_MAX];
164#endif
165 FAR void *stackaddr = NULL;
166 pid_t pid;
167 int ret;
168
169 /* Sanity checking */
170
171#ifdef CONFIG_DEBUG_FEATURES
172 if (!binp || !binp->entrypt || binp->stacksize <= 0)
173 {
174 return -EINVAL;
175 }
176#endif
177
178 binfo("Executing %s\n", filename);
179
180 /* Allocate a TCB for the new task. */
181
182 tcb = kmm_zalloc(sizeof(struct tcb_s));
183 if (!tcb)
184 {
185 return -ENOMEM;
186 }
187
188 ret = binfmt_copyargv(&argv, argv);
189 if (ret < 0)
190 {
191 goto errout_with_tcb;
192 }
193
194 /* Make a copy of the environment here */
195
196 if (envp == NULL)
197 {
198 envp = environ;
199 }
200
201 ret = binfmt_copyenv(&envp, envp);
202 if (ret < 0)
203 {
204 goto errout_with_args;
205 }
206
207 ret = binfmt_copyactions(&actions, actions);
208 if (ret < 0)
209 {

Callers 1

exec_internalFunction · 0.85

Calls 15

kmm_zallocFunction · 0.85
binfmt_copyargvFunction · 0.85
binfmt_copyactionsFunction · 0.85
addrenv_selectFunction · 0.85
nxtask_initFunction · 0.85
binfmt_freeactionsFunction · 0.85
binfmt_freeargvFunction · 0.85
addrenv_attachFunction · 0.85
exec_swapFunction · 0.85
this_taskFunction · 0.85
addrenv_restoreFunction · 0.85
spawn_execattrsFunction · 0.85

Tested by

no test coverage detected