Changeset bfd1546 in mainline for kernel/generic/src/proc/program.c
- Timestamp:
- 2009-02-15T00:01:06Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08b777e
- Parents:
- 4cac212c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/program.c
r4cac212c rbfd1546 191 191 /** Syscall for creating a new loader instance from userspace. 192 192 * 193 * Creates a new task from the program loader image, connects a phone 194 * to it and stores the phone id into the provided buffer. 195 * 196 * @param uspace_phone_id Userspace address where to store the phone id. 193 * Creates a new task from the program loader image and sets 194 * the task name. 195 * 197 196 * @param name Name to set on the new task (typically the same 198 197 * as the command used to execute it). … … 200 199 * @return 0 on success or an error code from @ref errno.h. 201 200 */ 202 unative_t sys_program_spawn_loader(int *uspace_phone_id, char *uspace_name, 203 size_t name_len) 201 unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len) 204 202 { 205 203 program_t p; 206 int fake_id;207 204 int rc; 208 int phone_id;209 205 char namebuf[TASK_NAME_BUFLEN]; 210 211 fake_id = 0;212 213 /* Before we even try creating the task, see if we can write the id */214 rc = (unative_t) copy_to_uspace(uspace_phone_id, &fake_id,215 sizeof(fake_id));216 if (rc != 0)217 return rc;218 206 219 207 /* Cap length of name and copy it from userspace. */ … … 228 216 namebuf[name_len] = '\0'; 229 217 230 /* Allocate the phone for communicating with the new task. */231 232 phone_id = phone_alloc();233 if (phone_id < 0)234 return ELIMIT;235 236 218 /* Spawn the new task. */ 237 219 … … 240 222 return rc; 241 223 242 phone_connect(phone_id, &p.task->answerbox);243 244 /* No need to aquire lock before task_ready() */245 rc = (unative_t) copy_to_uspace(uspace_phone_id, &phone_id,246 sizeof(phone_id));247 if (rc != 0) {248 /* Ooops */249 ipc_phone_hangup(&TASK->phones[phone_id]);250 task_kill(p.task->taskid);251 return rc;252 }253 254 224 // FIXME: control the capabilities 255 225 cap_set(p.task, cap_get(TASK));
Note:
See TracChangeset
for help on using the changeset viewer.