Changeset 7114d83 in mainline for uspace/srv/ns/task.c


Ignore:
Timestamp:
2009-07-06T16:02:27Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d96851
Parents:
d68e4d5
Message:

Allow task to return value (will be improved).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ns/task.c

    rd68e4d5 r7114d83  
    6464        link_t link;
    6565        task_id_t id;    /**< Task ID. */
     66        int retval;
    6667        bool destroyed;
    6768} hashed_task_t;
     
    174175               
    175176                if (!(pr->callid & IPC_CALLID_NOTIFICATION))
    176                         ipc_answer_0(pr->callid, EOK);
     177                        ipc_answer_1(pr->callid, EOK, ht->retval);
    177178               
    178179                hash_table_remove(&task_hash_table, keys, 2);
     
    222223                ht->id = id;
    223224                ht->destroyed = (et == TASK_CREATE) ? false : true;
     225                ht->retval = -1;
    224226                hash_table_insert(&task_hash_table, keys, &ht->link);
    225227        } else {
     
    262264out:
    263265        if (!(callid & IPC_CALLID_NOTIFICATION))
    264                 ipc_answer_0(callid, retval);
     266                ipc_answer_1(callid, retval, ht->retval);
     267}
     268
     269int ns_task_retval(ipc_call_t *call)
     270{
     271        task_id_t id;
     272        unsigned long keys[2];
     273
     274        id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
     275
     276        keys[0] = LOWER32(id);
     277        keys[1] = UPPER32(id);
     278       
     279        link_t *link = hash_table_find(&task_hash_table, keys);
     280        hashed_task_t *ht = (link != NULL) ?
     281            hash_table_get_instance(link, hashed_task_t, link) : NULL;
     282       
     283        if ((ht == NULL) || ht->destroyed)
     284                return EINVAL;
     285
     286        ht->retval = IPC_GET_ARG3(*call);
     287
     288        return EOK;
    265289}
    266290
Note: See TracChangeset for help on using the changeset viewer.