Changeset 694253c in mainline for uspace/srv/sysman/unit.c


Ignore:
Timestamp:
2019-08-03T07:35:41Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
c0c388d2
Parents:
f42ee6f
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-03-13 02:06:30)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-03 07:35:41)
Message:

Skeleton for sysman (unit) jobs control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/unit.c

    rf42ee6f r694253c  
    11#include <assert.h>
     2#include <errno.h>
     3#include <fibril_synch.h>
    24#include <mem.h>
     5#include <stdio.h>
    36#include <stdlib.h>
    47
     
    912        assert(unit);
    1013
    11         memset(unit, 0, sizeof(unit));
     14        link_initialize(&unit->units);
     15       
     16        unit->type = type;
     17        unit->state = STATE_EMBRYO;
     18        fibril_mutex_initialize(&unit->state_mtx);
     19        fibril_condvar_initialize(&unit->state_cv);
    1220
    13         link_initialize(&unit->units);
    1421        list_initialize(&unit->dependants);
    1522        list_initialize(&unit->dependencies);
    16 
    17         unit->type = type;
    18         unit->state = STATE_EMBRYO;
    1923}
    2024
     
    4246        *unit = NULL;
    4347}
     48
     49/** Issue request to restarter to start a unit
     50 *
     51 * Return from this function only means start request was issued.
     52 * If you need to wait for real start of the unit, use waiting on state_cv.
     53 */
     54int unit_start(unit_t *unit)
     55{
     56        // TODO actually start the unit
     57        printf("Starting unit of type %i\n", unit->type);
     58        return EOK;
     59}
Note: See TracChangeset for help on using the changeset viewer.