Changeset 012dd8e in mainline for uspace/lib/c/generic/task.c


Ignore:
Timestamp:
2019-08-07T09:15:30Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
e8747bd8
Parents:
780c8ce
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-11-01 00:08:04)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 09:15:30)
Message:

taskman: Handle INIT_TASKS as tasks spawned by loader

  • everyone is connected to its spawner, except for INIT_TASKS, they are connected to taskman (first binary)
  • taskman is now aware even of INIT_TASKS and taskman itself
  • refactored taskman handshake — NS session is created lazily
  • refactored async.c with usage of create_session
  • changed EINVAL to EINTR on lost waits
  • removed TODOs from taskman and related libc TODOs

Conflicts:

abi/include/abi/ipc/methods.h
boot/Makefile.common
uspace/lib/c/generic/async.c
uspace/lib/c/generic/libc.c
uspace/lib/c/generic/loader.c
uspace/lib/c/generic/ns.c
uspace/lib/c/generic/private/async.h
uspace/lib/c/generic/private/taskman.h
uspace/lib/c/generic/task.c
uspace/lib/c/include/async.h
uspace/lib/c/include/task.h
uspace/srv/loader/main.c
uspace/srv/ns/ns.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/task.c

    r780c8ce r012dd8e  
    4949#include <str.h>
    5050#include <task.h>
     51#include <taskman.h>
    5152#include <vfs/vfs.h>
    52 #include "private/ns.h"
     53
    5354#include "private/task.h"
    54 
    55 static async_sess_t *session_taskman = NULL;
     55#include "private/taskman.h"
    5656
    5757task_id_t task_get_id(void)
     
    6969}
    7070
    71 async_exch_t *taskman_exchange_begin(void)
    72 {
    73         /* Lazy connection */
    74         if (session_taskman == NULL) {
    75                 // TODO unify exchange mgmt with taskman_handshake/__init
    76                 session_taskman = service_connect_blocking(EXCHANGE_SERIALIZE,
    77                     SERVICE_TASKMAN,
    78                     TASKMAN_CONTROL,
    79                     0);
    80         }
    81 
    82         if (session_taskman == NULL) {
    83                 return NULL;
    84         }
    85 
    86         async_exch_t *exch = async_exchange_begin(session_taskman);
    87         return exch;
    88 }
    89 
    90 void taskman_exchange_end(async_exch_t *exch)
    91 {
    92         async_exchange_end(exch);
    93 }
    94 
    9571/** Set the task name.
    9672 *
     
    129105 *
    130106 * @return EOK on success, else error code.
    131  * @return TODO check this doesn't return EINVAL -- clash with task_wait
    132107 */
    133108static errno_t task_setup_wait(task_id_t id, task_wait_t *wait)
     
    393368 * (it can be reused, but must be reinitialized with task_setup_wait first)
    394369 *
    395  * @param wait   task_wait_t previously initialized by task_setup_wait.
    396  * @param texit  Store type of task exit here.
    397  * @param retval Store return value of the task here.
     370 * @param[in/out] wait   task_wait_t previously initialized by task_setup_wait
     371 *                       or returned by task_wait with non-zero flags. the
     372 *                       flags are updated so that they represent what can be
     373 *                       still waited for.
     374 * @param[out]    texit  Store type of task exit here.
     375 * @param[out]    retval Store return value of the task here.
    398376 *
    399377 * @return EOK on success
    400  * @return EINVAL on lost wait TODO other error codes
     378 * @return EINTR on lost wait
    401379 */
    402380errno_t task_wait(task_wait_t *wait, task_exit_t *texit, int *retval)
     
    405383        async_wait_for(wait->aid, &rc);
    406384
    407         if (rc == EOK || rc == EINVAL) {
     385        if (rc == EOK || rc == EINTR) {
    408386                if (wait->flags & TASK_WAIT_EXIT && texit)
    409387                        *texit = ipc_get_arg1(wait->result);
     
    471449}
    472450
    473 void __task_init(async_sess_t *sess)
    474 {
    475         assert(session_taskman == NULL);
    476         session_taskman = sess;
    477 }
    478 
    479451/** @}
    480452 */
Note: See TracChangeset for help on using the changeset viewer.