Changes in uspace/srv/ns/task.c [7b616e2:234f47e] in mainline


Ignore:
File:
1 edited

Legend:

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

    r7b616e2 r234f47e  
    3232 */
    3333
     34#include <ipc/ipc.h>
    3435#include <adt/hash_table.h>
    35 #include <async.h>
    3636#include <stdbool.h>
    3737#include <errno.h>
     
    182182                        continue;
    183183               
    184                 texit = ht->have_rval ? TASK_EXIT_NORMAL :
    185                     TASK_EXIT_UNEXPECTED;
    186                 async_answer_2(pr->callid, EOK, texit, ht->retval);
     184                if (!(pr->callid & IPC_CALLID_NOTIFICATION)) {
     185                        texit = ht->have_rval ? TASK_EXIT_NORMAL :
     186                            TASK_EXIT_UNEXPECTED;
     187                        ipc_answer_2(pr->callid, EOK, texit,
     188                            ht->retval);
     189                }
    187190               
    188191                list_remove(&pr->link);
     
    200203        if (ht == NULL) {
    201204                /* No such task exists. */
    202                 async_answer_0(callid, ENOENT);
     205                ipc_answer_0(callid, ENOENT);
    203206                return;
    204207        }
     
    207210                task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL :
    208211                    TASK_EXIT_UNEXPECTED;
    209                 async_answer_2(callid, EOK, texit, ht->retval);
     212                ipc_answer_2(callid, EOK, texit, ht->retval);
    210213                return;
    211214        }
     
    215218            (pending_wait_t *) malloc(sizeof(pending_wait_t));
    216219        if (!pr) {
    217                 async_answer_0(callid, ENOMEM);
     220                if (!(callid & IPC_CALLID_NOTIFICATION))
     221                        ipc_answer_0(callid, ENOMEM);
    218222                return;
    219223        }
     
    278282int ns_task_retval(ipc_call_t *call)
    279283{
    280         task_id_t id = call->in_task_id;
    281        
    282         ht_link_t *link = hash_table_find(&task_hash_table, &id);
    283         hashed_task_t *ht = (link != NULL) ?
    284             hash_table_get_inst(link, hashed_task_t, link) : NULL;
    285        
    286         if ((ht == NULL) || (ht->finished))
    287                 return EINVAL;
    288        
    289         ht->finished = true;
    290         ht->have_rval = true;
    291         ht->retval = IPC_GET_ARG1(*call);
    292        
    293         process_pending_wait();
    294        
    295         return EOK;
    296 }
    297 
    298 int ns_task_disconnect(ipc_call_t *call)
    299 {
    300284        task_id_t id;
    301285        int rc = get_id_by_phone(call->in_phone_hash, &id);
     
    303287                return rc;
    304288       
     289        ht_link_t *link = hash_table_find(&task_hash_table, &id);
     290        hashed_task_t *ht = (link != NULL) ?
     291            hash_table_get_inst(link, hashed_task_t, link) : NULL;
     292       
     293        if ((ht == NULL) || (ht->finished))
     294                return EINVAL;
     295       
     296        ht->finished = true;
     297        ht->have_rval = true;
     298        ht->retval = IPC_GET_ARG1(*call);
     299       
     300        process_pending_wait();
     301       
     302        return EOK;
     303}
     304
     305int ns_task_disconnect(ipc_call_t *call)
     306{
     307        task_id_t id;
     308        int rc = get_id_by_phone(call->in_phone_hash, &id);
     309        if (rc != EOK)
     310                return rc;
     311       
    305312        /* Delete from phone-to-id map. */
    306313        hash_table_remove(&phone_to_id, &call->in_phone_hash);
Note: See TracChangeset for help on using the changeset viewer.