Changeset e8747bd8 in mainline


Ignore:
Timestamp:
2019-08-07T09:20:54Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
2df7d824
Parents:
012dd8e
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-11-01 15:43:57)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 09:20:54)
Message:

sysman: Use taskman API to detect successful server start

Conflicts:

uspace/srv/logger/main.c

Location:
uspace/srv
Files:
2 added
9 edited

Legend:

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

    r012dd8e re8747bd8  
    8383
    8484        printf("%s: Accepting connections\n", NAME);
     85
     86        task_retval(EOK);
    8587        async_manager();
    8688
  • uspace/srv/sysman/Makefile

    r012dd8e re8747bd8  
    5050        units/unit_tgt.c \
    5151        units/unit_svc.c \
     52        sm_task.c \
    5253        util.c
    5354
  • uspace/srv/sysman/configuration.c

    r012dd8e re8747bd8  
    3838#include "log.h"
    3939
     40// TODO rename to repository (dynamic nature of units storage, and do not name it godlike Manager :-)
     41
    4042LIST_INITIALIZE(units);
    4143
  • uspace/srv/sysman/connection_ctl.c

    r012dd8e re8747bd8  
    3838
    3939
     40// TODO possibly provide as type-safe function + macro in sysman.h for generic boxing
    4041static ipc_callid_t *box_callid(ipc_callid_t iid)
    4142{
  • uspace/srv/sysman/main.c

    r012dd8e re8747bd8  
    4444#include "log.h"
    4545#include "sysman.h"
     46#include "sm_task.h"
    4647#include "unit.h"
    4748
     
    208209         * Initialize global structures
    209210         */
     211        // TODO check return values and abort start
    210212        configuration_init();
    211213        sysman_events_init();
    212214        job_queue_init();
     215        sm_task_init();
    213216
    214217        /*
     
    230233
    231234        sysman_log(LVL_DEBUG, "Debugging pause...\n");
    232         async_usleep(10 * 1000000);
     235        async_usleep(1 * 1000000);
     236        sysman_log(LVL_DEBUG, "Debugging pause ended.\n");
    233237        /* Queue first job from sequence */
    234238        prepare_and_run_job(&target_sequence[0]);
  • uspace/srv/sysman/sysman.c

    r012dd8e re8747bd8  
    3535#include "log.h"
    3636#include "sysman.h"
     37#include "task.h"
    3738#include "unit.h"
    3839
     
    401402void sysman_event_unit_exposee_created(void *data)
    402403{
    403         unit_t *unit = data;
    404         unit_exposee_created(unit);
     404        unit_exposee_created(data);
    405405}
    406406
    407407void sysman_event_unit_failed(void *data)
    408408{
    409         unit_t *unit = data;
    410         unit_fail(unit);
     409        unit_fail(data);
    411410}
    412411
     
    415414        notify_observers(data);
    416415}
     416
  • uspace/srv/sysman/sysman.h

    r012dd8e re8747bd8  
    4747extern size_t sysman_observers_count(void *);
    4848
     49// TODO move particular events to separate file? (or move event impl there?)
    4950
    5051extern void sysman_event_job_process(void *);
  • uspace/srv/sysman/units/unit_svc.c

    r012dd8e re8747bd8  
    8585        assert(unit->state == STATE_STOPPED);
    8686
    87         int rc = task_spawnv(NULL, NULL, u_svc->exec_start.path,
     87        int rc = task_spawnv(&u_svc->main_task_id, NULL, u_svc->exec_start.path,
    8888            u_svc->exec_start.argv);
    8989
     
    9696
    9797        /*
    98          * This is temporary workaround, until proper reporting from brokers
    99          * about exposees will work. We assume the service succesfully starts
    100          * in a moment. Applies to naming service only.
    101          */
    102         if (str_cmp(unit->name, "devman.svc") == 0 ||
    103             str_cmp(unit->name, "logger.svc") == 0 ||
    104             str_cmp(unit->name, "irc.svc") == 0) {
    105                 async_usleep(100000);
    106                 unit->state = STATE_STARTED;
    107         }
    108 
    109         /*
    11098         * Workaround to see log output even after devman starts (and overrides
    11199         * kernel's frame buffer.
     100         * TODO move to task retval/exposee created handler
    112101         */
    113102        if (str_cmp(unit->name, "devman.svc") == 0) {
     
    128117        assert(unit->state == STATE_STOPPED || unit->state == STATE_STARTING || unit->state==STATE_STARTED);
    129118
    130         unit->state = STATE_STARTED;
    131         unit_notify_state(unit);
     119        /* Exposee itself doesn't represent started unit. */
     120        //unit->state = STATE_STARTED;
     121        //unit_notify_state(unit);
    132122}
    133123
  • uspace/srv/sysman/units/unit_svc.h

    r012dd8e re8747bd8  
    3030#define SYSMAN_UNIT_SVC_H
    3131
     32#include <task.h>
     33
    3234#include "unit.h"
    3335#include "util.h"
     
    3739
    3840        command_t exec_start;
     41
     42        task_id_t main_task_id;
    3943} unit_svc_t;
    4044
Note: See TracChangeset for help on using the changeset viewer.