Changeset 2f44fafd in mainline for uspace/srv/taskman/main.c


Ignore:
Timestamp:
2019-08-07T04:33:20Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
e0e7eba
Parents:
62273d1
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-10-12 21:58:23)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 04:33:20)
Message:

taskman: Implement task_wait API to pass all tests

  • different behavior for different wait flags
  • add locking to fibril code in taskman

Conflicts:

uspace/lib/c/generic/libc.c
uspace/lib/c/generic/task.c

File:
1 edited

Legend:

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

    r62273d1 r2f44fafd  
    5858static void connect_to_loader(ipc_callid_t iid, ipc_call_t *icall)
    5959{
    60         //TODO explain why we don't explicitly accept connection request
    61         /* Spawn a loader. */
     60        /* We don't accept the connection request, we forward it instead to
     61         * freshly spawned loader. */
    6262        int rc = loader_spawn("loader");
    6363       
     
    7979        async_exchange_end(exch);
    8080
    81         // TODO leak? what happens with referenced sessions
     81        /* After forward we can dispose all session-related resources */
     82        async_hangup(sess_ref->sess);
    8283        free(sess_ref);
    8384
     
    153154static void control_connection(ipc_callid_t iid, ipc_call_t *icall)
    154155{
     156        /* TODO remove/redesign the workaround
     157         * Call task_intro here for boot-time tasks,
     158         * probably they should announce themselves explicitly
     159         * or taskman should detect them from kernel's list of tasks.
     160         */
     161        int rc = task_intro(icall, false);
     162
    155163        /* First, accept connection */
    156         async_answer_0(iid, EOK);
    157 
    158         // TODO register task to hash table
     164        async_answer_0(iid, rc);
     165
     166        if (rc != EOK) {
     167                return;
     168        }
     169
    159170        control_connection_loop();
    160171}
     
    174185        sess_ref->sess = async_callback_receive_start(EXCHANGE_ATOMIC, icall);
    175186        if (sess_ref->sess == NULL) {
    176                 //TODO different error code?
    177187                async_answer_0(iid, EINVAL);
    178188                return;
     
    180190
    181191        /* Remember task_id */
    182         int rc = task_id_intro(icall);
     192        int rc = task_intro(icall, true);
    183193
    184194        if (rc != EOK) {
     
    222232        case TASKMAN_LOADER_CALLBACK:
    223233                loader_callback(iid, icall);
    224                 // TODO register task to hashtable
    225234                control_connection_loop();
    226235                break;
     
    245254        }
    246255
    247         rc = async_event_subscribe(EVENT_EXIT, task_exit_event, (void *)EVENT_EXIT);
     256        rc = async_event_subscribe(EVENT_EXIT, task_exit_event, (void *)TASK_EXIT_NORMAL);
    248257        if (rc != EOK) {
    249258                printf("Cannot register for exit events (%i).\n", rc);
     
    251260        }
    252261
    253         rc = async_event_subscribe(EVENT_FAULT, task_exit_event, (void *)EVENT_FAULT);
     262        rc = async_event_subscribe(EVENT_FAULT, task_exit_event, (void *)TASK_EXIT_UNEXPECTED);
    254263        if (rc != EOK) {
    255264                printf("Cannot register for fault events (%i).\n", rc);
Note: See TracChangeset for help on using the changeset viewer.