Changeset ed5367b in mainline for uspace/srv/sysman/units/unit_svc.c


Ignore:
Timestamp:
2019-08-07T10:01:13Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
a097c50
Parents:
68ae40a
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-11-05 01:52:07)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 10:01:13)
Message:

sysman: Implement stopping units

Currently fails service monitoring because of taskman flawed event flags.
However, job closure works well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/units/unit_svc.c

    r68ae40a red5367b  
    112112}
    113113
     114static int unit_svc_stop(unit_t *unit)
     115{
     116        unit_svc_t *u_svc = CAST_SVC(unit);
     117        assert(u_svc);
     118
     119       
     120        // TODO think about unit's lifecycle (is STOPPED only acceptable?)
     121        // note: May change when job cancellation is possible.
     122        assert(unit->state == STATE_STARTED);
     123
     124        int rc = task_kill(u_svc->main_task_id);
     125
     126        if (rc != EOK) {
     127                /* Task may still be running, but be conservative about unit's
     128                 * state. */
     129                unit->state = STATE_FAILED;
     130                return rc;
     131        }
     132
     133        unit->state = STATE_STOPPING;
     134
     135        return EOK;
     136}
     137
     138
    114139static void unit_svc_exposee_created(unit_t *unit)
    115140{
Note: See TracChangeset for help on using the changeset viewer.