Changeset f1fae414 in mainline for uspace/lib/c/generic/task.c


Ignore:
Timestamp:
2011-06-22T01:34:53Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d7e82c1, cac458f
Parents:
72ec8cc (diff), bf172825 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/task.c

    r72ec8cc rf1fae414  
    101101int task_spawnv(task_id_t *id, const char *path, const char *const args[])
    102102{
    103         /* Connect to a program loader. */
    104         loader_t *ldr = loader_connect();
    105         if (ldr == NULL)
    106                 return EREFUSED;
    107        
    108         /* Get task ID. */
    109         task_id_t task_id;
    110         int rc = loader_get_task_id(ldr, &task_id);
    111         if (rc != EOK)
    112                 goto error;
    113        
    114         /* Send spawner's current working directory. */
    115         rc = loader_set_cwd(ldr);
    116         if (rc != EOK)
    117                 goto error;
    118        
    119         /* Send program pathname. */
    120         rc = loader_set_pathname(ldr, path);
    121         if (rc != EOK)
    122                 goto error;
    123        
    124         /* Send arguments. */
    125         rc = loader_set_args(ldr, args);
    126         if (rc != EOK)
    127                 goto error;
    128        
    129103        /* Send default files */
    130104        fdi_node_t *files[4];
     
    150124        files[3] = NULL;
    151125       
     126        return task_spawnvf(id, path, args, files);
     127}
     128
     129/** Create a new task by running an executable from the filesystem.
     130 *
     131 * This is really just a convenience wrapper over the more complicated
     132 * loader API. Arguments are passed as a null-terminated array of strings.
     133 * Files are passed as null-terminated array of pointers to fdi_node_t.
     134 *
     135 * @param id    If not NULL, the ID of the task is stored here on success.
     136 * @param path  Pathname of the binary to execute.
     137 * @param argv  Command-line arguments.
     138 * @param files Standard files to use.
     139 *
     140 * @return Zero on success or negative error code.
     141 *
     142 */
     143int task_spawnvf(task_id_t *id, const char *path, const char *const args[],
     144    fdi_node_t *const files[])
     145{
     146        /* Connect to a program loader. */
     147        loader_t *ldr = loader_connect();
     148        if (ldr == NULL)
     149                return EREFUSED;
     150       
     151        /* Get task ID. */
     152        task_id_t task_id;
     153        int rc = loader_get_task_id(ldr, &task_id);
     154        if (rc != EOK)
     155                goto error;
     156       
     157        /* Send spawner's current working directory. */
     158        rc = loader_set_cwd(ldr);
     159        if (rc != EOK)
     160                goto error;
     161       
     162        /* Send program pathname. */
     163        rc = loader_set_pathname(ldr, path);
     164        if (rc != EOK)
     165                goto error;
     166       
     167        /* Send arguments. */
     168        rc = loader_set_args(ldr, args);
     169        if (rc != EOK)
     170                goto error;
     171       
     172        /* Send files */
    152173        rc = loader_set_files(ldr, files);
    153174        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.