Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 rd96d9bc  
    5252 * @param name Symbolic name to set on the newly created task.
    5353 *
    54  * @return Error code.
    55  */
    56 errno_t loader_spawn(const char *name)
    57 {
    58         return (errno_t) __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
     54 * @return Pointer to the loader connection structure (should be
     55 *         deallocated using free() after use).
     56 *
     57 */
     58int loader_spawn(const char *name)
     59{
     60        return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
    5961            (sysarg_t) name, str_size(name));
    6062}
     
    8486 * @param task_id Points to a variable where the ID should be stored.
    8587 *
    86  * @return Zero on success or an error code.
    87  *
    88  */
    89 errno_t loader_get_task_id(loader_t *ldr, task_id_t *task_id)
     88 * @return Zero on success or negative error code.
     89 *
     90 */
     91int loader_get_task_id(loader_t *ldr, task_id_t *task_id)
    9092{
    9193        /* Get task ID. */
     
    9496        ipc_call_t answer;
    9597        aid_t req = async_send_0(exch, LOADER_GET_TASKID, &answer);
    96         errno_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
     98        sysarg_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
    9799       
    98100        async_exchange_end(exch);
     
    100102        if (rc != EOK) {
    101103                async_forget(req);
    102                 return (errno_t) rc;
     104                return (int) rc;
    103105        }
    104106       
    105107        async_wait_for(req, &rc);
    106         return (errno_t) rc;
     108        return (int) rc;
    107109}
    108110
     
    113115 * @param ldr  Loader connection structure.
    114116 *
    115  * @return Zero on success or an error code.
    116  *
    117  */
    118 errno_t loader_set_cwd(loader_t *ldr)
     117 * @return Zero on success or negative error code.
     118 *
     119 */
     120int loader_set_cwd(loader_t *ldr)
    119121{
    120122        char *cwd = (char *) malloc(MAX_PATH_LEN + 1);
     
    131133        ipc_call_t answer;
    132134        aid_t req = async_send_0(exch, LOADER_SET_CWD, &answer);
    133         errno_t rc = async_data_write_start(exch, cwd, len);
     135        sysarg_t rc = async_data_write_start(exch, cwd, len);
    134136       
    135137        async_exchange_end(exch);
     
    138140        if (rc != EOK) {
    139141                async_forget(req);
    140                 return (errno_t) rc;
     142                return (int) rc;
    141143        }
    142144       
    143145        async_wait_for(req, &rc);
    144         return (errno_t) rc;
     146        return (int) rc;
    145147}
    146148
     
    151153 * @param file Program file.
    152154 *
    153  * @return Zero on success or an error code.
    154  *
    155  */
    156 errno_t loader_set_program(loader_t *ldr, const char *name, int file)
     155 * @return Zero on success or negative error code.
     156 *
     157 */
     158int loader_set_program(loader_t *ldr, const char *name, int file)
    157159{
    158160        async_exch_t *exch = async_exchange_begin(ldr->sess);
     
    161163        aid_t req = async_send_0(exch, LOADER_SET_PROGRAM, &answer);
    162164
    163         errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
     165        sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1);
    164166        if (rc == EOK) {
    165167                async_exch_t *vfs_exch = vfs_exchange_begin();
     
    172174        if (rc != EOK) {
    173175                async_forget(req);
    174                 return (errno_t) rc;
     176                return (int) rc;
    175177        }
    176178
    177179        async_wait_for(req, &rc);
    178         return (errno_t) rc;
     180        return (int) rc;
    179181}
    180182
     
    184186 * @param path Program path.
    185187 *
    186  * @return Zero on success or an error code.
    187  *
    188  */
    189 errno_t loader_set_program_path(loader_t *ldr, const char *path)
     188 * @return Zero on success or negative error code.
     189 *
     190 */
     191int loader_set_program_path(loader_t *ldr, const char *path)
    190192{
    191193        const char *name = str_rchr(path, '/');
     
    196198        }
    197199       
    198         int fd;
    199         errno_t rc = vfs_lookup(path, 0, &fd);
    200         if (rc != EOK) {
    201                 return rc;
    202         }
    203        
    204         rc = loader_set_program(ldr, name, fd);
     200        int fd = vfs_lookup(path, 0);
     201        if (fd < 0) {
     202                return fd;
     203        }
     204       
     205        int rc = loader_set_program(ldr, name, fd);
    205206        vfs_put(fd);
    206207        return rc;
     
    217218 * @param argv NULL-terminated array of pointers to arguments.
    218219 *
    219  * @return Zero on success or an error code.
    220  *
    221  */
    222 errno_t loader_set_args(loader_t *ldr, const char *const argv[])
     220 * @return Zero on success or negative error code.
     221 *
     222 */
     223int loader_set_args(loader_t *ldr, const char *const argv[])
    223224{
    224225        /*
     
    252253        ipc_call_t answer;
    253254        aid_t req = async_send_0(exch, LOADER_SET_ARGS, &answer);
    254         errno_t rc = async_data_write_start(exch, (void *) arg_buf,
     255        sysarg_t rc = async_data_write_start(exch, (void *) arg_buf,
    255256            buffer_size);
    256257       
     
    260261        if (rc != EOK) {
    261262                async_forget(req);
    262                 return (errno_t) rc;
     263                return (int) rc;
    263264        }
    264265       
    265266        async_wait_for(req, &rc);
    266         return (errno_t) rc;
     267        return (int) rc;
    267268}
    268269
     
    273274 * @param file       The file's descriptor.
    274275 *
    275  * @return Zero on success or an error code.
    276  *
    277  */
    278 errno_t loader_add_inbox(loader_t *ldr, const char *name, int file)
     276 * @return Zero on success or negative error code.
     277 *
     278 */
     279int loader_add_inbox(loader_t *ldr, const char *name, int file)
    279280{
    280281        async_exch_t *exch = async_exchange_begin(ldr->sess);
     
    283284        aid_t req = async_send_0(exch, LOADER_ADD_INBOX, NULL);
    284285       
    285         errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
     286        sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1);
    286287        if (rc == EOK) {
    287288                rc = vfs_pass_handle(vfs_exch, file, exch);
     
    297298        }
    298299       
    299         return (errno_t) rc;
     300        return (int) rc;
    300301}
    301302
     
    307308 * @param ldr Loader connection structure.
    308309 *
    309  * @return Zero on success or an error code.
    310  *
    311  */
    312 errno_t loader_load_program(loader_t *ldr)
    313 {
    314         async_exch_t *exch = async_exchange_begin(ldr->sess);
    315         errno_t rc = async_req_0_0(exch, LOADER_LOAD);
     310 * @return Zero on success or negative error code.
     311 *
     312 */
     313int loader_load_program(loader_t *ldr)
     314{
     315        async_exch_t *exch = async_exchange_begin(ldr->sess);
     316        int rc = async_req_0_0(exch, LOADER_LOAD);
    316317        async_exchange_end(exch);
    317318       
     
    330331 * @param ldr Loader connection structure.
    331332 *
    332  * @return Zero on success or an error code.
    333  *
    334  */
    335 errno_t loader_run(loader_t *ldr)
    336 {
    337         async_exch_t *exch = async_exchange_begin(ldr->sess);
    338         errno_t rc = async_req_0_0(exch, LOADER_RUN);
     333 * @return Zero on success or negative error code.
     334 *
     335 */
     336int loader_run(loader_t *ldr)
     337{
     338        async_exch_t *exch = async_exchange_begin(ldr->sess);
     339        int rc = async_req_0_0(exch, LOADER_RUN);
    339340        async_exchange_end(exch);
    340341       
     
    356357 * @param ldr Loader connection structure.
    357358 *
    358  * @return Zero on success or an error code.
     359 * @return Zero on success or negative error code.
    359360 *
    360361 */
Note: See TracChangeset for help on using the changeset viewer.