Changeset 4470e26 in mainline for uspace/lib/libc/generic


Ignore:
Timestamp:
2008-09-24T10:57:21Z (17 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0993087
Parents:
45454e9b
Message:

Separate load and run commands for loader. Update tracer - no events get missed on startup anymore.

Location:
uspace/lib/libc/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/loader.c

    r45454e9b r4470e26  
    206206}
    207207
     208/** Instruct loader to load the program.
     209 *
     210 * If this function succeeds, the program has been successfully loaded
     211 * and is ready to be executed.
     212 *
     213 * @param ldr           Loader connection structure.
     214 * @return              Zero on success or negative error code.
     215 */
     216int loader_load_program(loader_t *ldr)
     217{
     218        int rc;
     219
     220        rc = async_req_0_0(ldr->phone_id, LOADER_LOAD);
     221        if (rc != EOK)
     222                return rc;
     223
     224        return EOK;
     225}
     226
    208227/** Instruct loader to execute the program.
     228 *
     229 * Note that this function blocks until the loader actually replies
     230 * so you cannot expect this function to return if you are debugging
     231 * the task and its thread is stopped.
    209232 *
    210233 * After using this function, no further operations must be performed
     
    214237 * @return              Zero on success or negative error code.
    215238 */
    216 int loader_start_program(loader_t *ldr)
     239int loader_run(loader_t *ldr)
    217240{
    218241        int rc;
     
    222245                return rc;
    223246
    224         ipc_hangup(ldr->phone_id);
    225247        return EOK;
    226248}
  • uspace/lib/libc/generic/task.c

    r45454e9b r4470e26  
    6464        int rc;
    6565
    66         /* Spawn a program loader */   
     66        /* Spawn a program loader. */   
    6767        ldr = loader_spawn();
    6868        if (ldr == NULL)
     
    7474                goto error;
    7575
    76         /* Send program pathname */
     76        /* Send program pathname. */
    7777        rc = loader_set_pathname(ldr, path);
    7878        if (rc != EOK)
    7979                goto error;
    8080
    81         /* Send arguments */
     81        /* Send arguments. */
    8282        rc = loader_set_args(ldr, argv);
    8383        if (rc != EOK)
    8484                goto error;
    8585
    86         /* Request loader to start the program */       
    87         rc = loader_start_program(ldr);
     86        /* Load the program. */
     87        rc = loader_load_program(ldr);
     88        if (rc != EOK)
     89                goto error;
     90
     91        /* Run it. */
     92        /* Load the program. */
     93        rc = loader_run(ldr);
    8894        if (rc != EOK)
    8995                goto error;
    9096
    9197        /* Success */
     98
     99        free(ldr);
    92100        return task_id;
    93101
     
    95103error:
    96104        loader_abort(ldr);
     105        free(ldr);
     106
    97107        return 0;
    98108}
Note: See TracChangeset for help on using the changeset viewer.