Changeset 984a9ba in mainline for uspace/srv/ns/task.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

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

    r76f566d r984a9ba  
    145145typedef struct {
    146146        link_t link;
    147         task_id_t id;               ///< Task ID
    148         cap_call_handle_t chandle;  ///< Call handle waiting for the connection
     147        task_id_t id;     /**< Task ID */
     148        ipc_call_t call;  /**< Call waiting for the connection */
    149149} pending_wait_t;
    150150
     
    184184                texit = ht->have_rval ? TASK_EXIT_NORMAL :
    185185                    TASK_EXIT_UNEXPECTED;
    186                 async_answer_2(pr->chandle, EOK, texit, ht->retval);
     186                async_answer_2(&pr->call, EOK, texit, ht->retval);
    187187
    188188                list_remove(&pr->link);
     
    192192}
    193193
    194 void wait_for_task(task_id_t id, ipc_call_t *call, cap_call_handle_t chandle)
     194void wait_for_task(task_id_t id, ipc_call_t *call)
    195195{
    196196        ht_link_t *link = hash_table_find(&task_hash_table, &id);
     
    200200        if (ht == NULL) {
    201201                /* No such task exists. */
    202                 async_answer_0(chandle, ENOENT);
     202                async_answer_0(call, ENOENT);
    203203                return;
    204204        }
     
    207207                task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL :
    208208                    TASK_EXIT_UNEXPECTED;
    209                 async_answer_2(chandle, EOK, texit, ht->retval);
     209                async_answer_2(call, EOK, texit, ht->retval);
    210210                return;
    211211        }
     
    215215            (pending_wait_t *) malloc(sizeof(pending_wait_t));
    216216        if (!pr) {
    217                 async_answer_0(chandle, ENOMEM);
     217                async_answer_0(call, ENOMEM);
    218218                return;
    219219        }
     
    221221        link_initialize(&pr->link);
    222222        pr->id = id;
    223         pr->chandle = chandle;
     223        pr->call = *call;
    224224        list_append(&pr->link, &pending_wait);
    225225}
Note: See TracChangeset for help on using the changeset viewer.