Changeset 241f1985 in mainline for uspace/srv/taskman/event.c


Ignore:
Timestamp:
2019-08-31T10:45:17Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
102f641
Parents:
f92b315
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-08-23 22:04:34)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-31 10:45:17)
Message:

Correcting failure from previous merge

The commits from Michal Koutný from the branch system-daemon
where built on a old version of Helenos. Because of this
many types and API functions have changed. This commit
upgrades the merge code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/taskman/event.c

    rf92b315 r241f1985  
    4949        task_id_t id;         /**< Task ID who we wait for. */
    5050        task_id_t waiter_id;  /**< Task ID who waits. */
    51         ipc_callid_t callid;  /**< Call ID waiting for the event. */
     51        ipc_call_t *icall;  /**< Call ID waiting for the event. */
    5252        int flags;            /**< Wait flags. */
    5353} pending_wait_t;
     
    5959static FIBRIL_RWLOCK_INITIALIZE(listeners_lock);
    6060
    61 int event_init(void)
     61errno_t event_init(void)
    6262{
    6363        list_initialize(&pending_waits);
     
    150150                int match = notify_flags & pr->flags;
    151151                // TODO why do I even accept such calls?
    152                 bool answer = !(pr->callid & IPC_CALLID_NOTIFICATION);
     152                bool answer = !(pr->icall->flags & IPC_CALL_NOTIF);
    153153
    154154                if (match == 0) {
     
    156156                                /* Nothing to wait for anymore */
    157157                                if (answer) {
    158                                         async_answer_0(pr->callid, EINTR);
     158                                        async_answer_0(pr->icall, EINTR);
    159159                                }
    160160                        } else {
     
    165165                        if ((pr->flags & TASK_WAIT_BOTH) && match == TASK_WAIT_EXIT) {
    166166                                /* No sense to wait for both anymore */
    167                                 async_answer_1(pr->callid, EINTR, t->exit);
     167                                async_answer_1(pr->icall, EINTR, t->exit);
    168168                        } else {
    169169                                /* Send both exit status and retval, caller
    170170                                 * should know what is valid */
    171                                 async_answer_3(pr->callid, EOK, t->exit,
     171                                async_answer_3(pr->icall, EOK, t->exit,
    172172                                    t->retval, rest);
    173173                        }
     
    195195
    196196void event_register_listener(task_id_t id, bool past_events, async_sess_t *sess,
    197     ipc_callid_t iid)
    198 {
    199         int rc = EOK;
     197    ipc_call_t *icall)
     198{
     199        errno_t rc = EOK;
    200200        /*
    201201         * We have lock of tasks structures so that we can guarantee
     
    219219         * while we dump events.
    220220         */
    221         async_answer_0(iid, rc);
     221        async_answer_0(icall, rc);
    222222        if (past_events) {
    223223                task_foreach(&dump_walker, t->sess);
     
    228228        fibril_rwlock_write_unlock(&task_hash_table_lock);
    229229        if (rc != EOK) {
    230                 async_answer_0(iid, rc);
    231         }
    232 }
    233 
    234 void wait_for_task(task_id_t id, int flags, ipc_callid_t callid,
     230                async_answer_0(icall, rc);
     231        }
     232}
     233
     234void wait_for_task(task_id_t id, int flags, ipc_call_t *icall,
    235235     task_id_t waiter_id)
    236236{
     
    244244        if (t == NULL) {
    245245                /* No such task exists. */
    246                 async_answer_0(callid, ENOENT);
     246                async_answer_0(icall, ENOENT);
    247247                return;
    248248        }
     
    250250        if (t->exit != TASK_EXIT_RUNNING) {
    251251                //TODO are flags BOTH processed correctly here?
    252                 async_answer_3(callid, EOK, t->exit, t->retval, 0);
     252                async_answer_3(icall, EOK, t->exit, t->retval, 0);
    253253                return;
    254254        }
     
    267267        }
    268268
    269         int rc = EOK;
     269        errno_t rc = EOK;
    270270        if (pr == NULL) {
    271271                pr = malloc(sizeof(pending_wait_t));
     
    279279                pr->waiter_id = waiter_id;
    280280                pr->flags = flags;
    281                 pr->callid = callid;
     281                pr->icall = icall;
    282282
    283283                list_append(&pr->link, &pending_waits);
     
    288288                 * fibril).
    289289                 */
    290                 rc = EEXISTS;
     290                rc = EEXIST;
    291291        } else {
    292292                /*
     
    294294                 */
    295295                pr->flags &= ~TASK_WAIT_BOTH; // TODO maybe new flags should be set?
    296                 pr->callid = callid;
     296                pr->icall = icall;
    297297        }
    298298
     
    300300        fibril_rwlock_write_unlock(&pending_wait_lock);
    301301        // TODO why IPC_CALLID_NOTIFICATION? explain!
    302         if (rc != EOK && !(callid & IPC_CALLID_NOTIFICATION)) {
    303                 async_answer_0(callid, rc);
    304         }
    305 }
    306 
    307 
    308 int task_set_retval(task_id_t sender, int retval, bool wait_for_exit)
    309 {
    310         int rc = EOK;
     302        if (rc != EOK && !(icall->flags & IPC_CALL_NOTIF)) {
     303                async_answer_0(icall, rc);
     304        }
     305}
     306
     307
     308errno_t task_set_retval(task_id_t sender, int retval, bool wait_for_exit)
     309{
     310        errno_t rc = EOK;
    311311       
    312312        fibril_rwlock_write_lock(&task_hash_table_lock);
Note: See TracChangeset for help on using the changeset viewer.