Changeset 102f641 in mainline for uspace/srv/taskman


Ignore:
Timestamp:
2019-09-02T19:01:50Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
25697163
Parents:
241f1985
Message:

Correcting syntax according to ccheck

Location:
uspace/srv/taskman
Files:
4 edited

Legend:

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

    r241f1985 r102f641  
    167167                                async_answer_1(pr->icall, EINTR, t->exit);
    168168                        } else {
    169                                 /* Send both exit status and retval, caller
    170                                  * should know what is valid */
     169                                /*
     170                                 * Send both exit status and retval, caller
     171                                 * should know what is valid
     172                                 */
    171173                                async_answer_3(pr->icall, EOK, t->exit,
    172174                                    t->retval, rest);
     
    180182                }
    181183
    182                
    183184                list_remove(&pr->link);
    184185                free(pr);
     
    233234
    234235void wait_for_task(task_id_t id, int flags, ipc_call_t *icall,
    235      task_id_t waiter_id)
     236    task_id_t waiter_id)
    236237{
    237238        assert(!(flags & TASK_WAIT_BOTH) ||
     
    247248                return;
    248249        }
    249        
     250
    250251        if (t->exit != TASK_EXIT_RUNNING) {
    251252                //TODO are flags BOTH processed correctly here?
     
    253254                return;
    254255        }
    255        
     256
    256257        /*
    257258         * Add request to pending list or reuse existing item for a second
     
    274275                        goto finish;
    275276                }
    276        
     277
    277278                link_initialize(&pr->link);
    278279                pr->id = id;
     
    305306}
    306307
    307 
    308308errno_t task_set_retval(task_id_t sender, int retval, bool wait_for_exit)
    309309{
    310310        errno_t rc = EOK;
    311        
     311
    312312        fibril_rwlock_write_lock(&task_hash_table_lock);
    313313        task_t *t = task_get_by_id(sender);
     
    317317                goto finish;
    318318        }
    319        
     319
    320320        t->retval = retval;
    321321        t->retval_type = wait_for_exit ? RVAL_SET_EXIT : RVAL_SET;
    322        
     322
    323323        event_notify_all(t);
    324324        process_pending_wait();
    325        
     325
    326326finish:
    327327        fibril_rwlock_write_unlock(&task_hash_table_lock);
  • uspace/srv/taskman/main.c

    r241f1985 r102f641  
    5454#include "taskman.h"
    5555
    56 
    5756typedef struct {
    5857        link_t link;
     
    7473{
    7574        DPRINTF("%s:%i from %llu\n", __func__, __LINE__, icall->task_id);
    76         /* We don't accept the connection request, we forward it instead to
    77          * freshly spawned loader. */
     75        /*
     76         * We don't accept the connection request, we forward it instead to
     77         * freshly spawned loader.
     78         */
    7879        errno_t rc = loader_spawn("loader");
    79        
     80
    8081        if (rc != EOK) {
    8182                async_answer_0(icall, rc);
    8283                return;
    8384        }
    84        
     85
    8586        /* Wait until spawned task presents itself to us. */
    8687        link_t *link = prodcons_consume(&sess_queue);
     
    148149        /* Used only for connection forwarding -- atomic */
    149150        session_ns = async_callback_receive(EXCHANGE_ATOMIC);
    150        
     151
    151152        if (session_ns == NULL) {
    152153                rc = ENOENT;
     
    218219        // TODO check that loader is expected, would probably discard prodcons
    219220        //      scheme
    220        
     221
    221222        /* Preallocate session container */
    222223        sess_ref_t *sess_ref = malloc(sizeof(sess_ref_t));
     
    265266static bool handle_implicit_call(ipc_call_t *icall)
    266267{
    267         /*DPRINTF("%s:%i %i(%i) from %llu\n", __func__, __LINE__,
    268             IPC_GET_IMETHOD(*icall),
    269             IPC_GET_ARG1(*icall),
    270             icall->in_task_id);*/
    271 
    272268        if (ipc_get_imethod(icall) < IPC_FIRST_USER_METHOD) {
    273269                switch (ipc_get_arg1(icall)) {
     
    330326}
    331327
    332 
    333 
    334328int main(int argc, char *argv[])
    335329{
     
    358352                return rc;
    359353        }
    360        
     354
    361355        task_id_t self_id = task_get_id();
    362356        rc = task_intro(self_id);
  • uspace/srv/taskman/task.c

    r241f1985 r102f641  
    4646        void *arg;
    4747} walker_context_t;
    48        
     48
    4949/*
    5050 * Forwards
     
    5959static size_t ht_task_key_hash(const void *key)
    6060{
    61         return *(task_id_t*)key;
     61        return *(task_id_t *)key;
    6262}
    6363
     
    7171{
    7272        task_t *ht = hash_table_get_inst(item, task_t, link);
    73         return ht->id == *(task_id_t*)key;
     73        return ht->id == *(task_id_t *)key;
    7474}
    7575
     
    127127
    128128        fibril_rwlock_initialize(&task_hash_table_lock);
    129        
     129
    130130        return EOK;
    131131}
     
    145145                return NULL;
    146146        }
    147        
     147
    148148        task_t *t = hash_table_get_inst(link, task_t, link);
    149149        return t;
     
    202202                goto finish;
    203203        }
    204        
     204
    205205        t = malloc(sizeof(task_t));
    206206        if (t == NULL) {
     
    217217        hash_table_insert(&task_hash_table, &t->link);
    218218        DPRINTF("%s: %llu\n", __func__, t->id);
    219        
     219
    220220finish:
    221221        fibril_rwlock_write_unlock(&task_hash_table_lock);
     
    223223}
    224224
    225 
    226225/**
    227226 * @}
  • uspace/srv/taskman/task.h

    r241f1985 r102f641  
    4343/** What type of retval from the task we have */
    4444typedef enum {
    45         RVAL_UNSET,     /**< unset */
    46         RVAL_SET,       /**< retval set, e.g. by server */
    47         RVAL_SET_EXIT   /**< retval set, wait for expected task exit */
     45        /* unset */
     46        RVAL_UNSET,
     47
     48        /* retval set, e.g. by server */
     49        RVAL_SET,
     50
     51        /* retval set, wait for expected task exit */
     52        RVAL_SET_EXIT
    4853} retval_t;
    4954
     
    5156typedef struct {
    5257        ht_link_t link;
    53        
    54         task_id_t id;          /**< Task id. */
    55         task_exit_t exit;      /**< Task's uspace exit status. */
    56         bool failed;           /**< Task failed (task can exit unexpectedly
    57                                     even w/out failure). */
    58         retval_t retval_type;  /**< Task returned a value. */
    59         int retval;            /**< The return value. */
    6058
    61         link_t listeners;      /**< Link to listeners list. */
    62         async_sess_t *sess;    /**< Session for notifications to task. */
     59        /* Task id. */
     60        task_id_t id;
     61        /* Task's uspace exit status. */
     62        task_exit_t exit;
     63        /* Task failed (task can exit unexpectedly even w/out failure). */
     64        bool failed;
     65        /* Task returned a value. */
     66        retval_t retval_type;
     67        /* The return value. */
     68        int retval;
     69        /* Link to listeners list. */
     70        link_t listeners;
     71        /* Session for notifications to task. */
     72        async_sess_t *sess;
    6373} task_t;
    6474
    65 typedef bool (* task_walker_t)(task_t *, void *);
     75typedef bool (*task_walker_t)(task_t *, void *);
    6676
    6777extern fibril_rwlock_t task_hash_table_lock;
Note: See TracChangeset for help on using the changeset viewer.