Changeset ed5367b in mainline for uspace/lib


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.

Location:
uspace/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/sysman.h

    r68ae40a red5367b  
    4444        SYSMAN_BROKER_EXP_ADDED,
    4545        SYSMAN_BROKER_EXP_REMOVED,
     46        SYSMAN_CTL_UNIT_HANDLE,
    4647        SYSMAN_CTL_UNIT_START,
     48        SYSMAN_CTL_UNIT_STOP,
    4749        SYSMAN_CTL_GET_UNITS,
    4850        SYSMAN_CTL_UNIT_GET_NAME,
     
    7173        STATE_STARTED,
    7274        STATE_STOPPED,
     75        STATE_STOPPING,
    7376        STATE_FAILED
    7477} unit_state_t;
  • uspace/lib/sysman/include/sysman/ctl.h

    r68ae40a red5367b  
    3333#include <sysman/unit.h>
    3434
     35int sysman_unit_handle(const char *, unit_handle_t *);
     36
    3537int sysman_unit_start(const char *, int);
     38int sysman_unit_stop(unit_handle_t, int);
    3639
    3740int sysman_get_units(unit_handle_t **, size_t *);
  • uspace/lib/sysman/src/ctl.c

    r68ae40a red5367b  
    3434#include <sysman/sysman.h>
    3535
     36int sysman_unit_handle(const char *unit_name, unit_handle_t *handle_ptr)
     37{
     38        async_exch_t *exch = sysman_exchange_begin(SYSMAN_PORT_CTL);
     39
     40        ipc_call_t call;
     41        aid_t req = async_send_0(exch, SYSMAN_CTL_UNIT_HANDLE, &call);
     42        sysarg_t rc = async_data_write_start(exch, unit_name, str_size(unit_name));
     43        sysman_exchange_end(exch);
     44
     45        if (rc != EOK) {
     46                async_forget(req);
     47                return rc;
     48        }
     49
     50        async_wait_for(req, &rc);
     51        if (rc == EOK) {
     52                *handle_ptr = IPC_GET_ARG1(call);
     53        }
     54        return rc;
     55}
     56
    3657/*
    3758 * TODO
     
    4162 * broker knows when appropriate exposee is created and the request succeeded.
    4263 * Still though, it's necessary to centralize timeout into sysman.
     64 * TODO convert to name->handle API
    4365 */
    4466int sysman_unit_start(const char *unit_name, int flags)
     
    5678
    5779        async_wait_for(req, &rc);
     80        return rc;
     81}
     82
     83int sysman_unit_stop(unit_handle_t handle, int flags)
     84{
     85        async_exch_t *exch = sysman_exchange_begin(SYSMAN_PORT_CTL);
     86
     87        int rc = async_req_2_0(exch, SYSMAN_CTL_UNIT_STOP, handle, flags);
     88        sysman_exchange_end(exch);
     89       
    5890        return rc;
    5991}
Note: See TracChangeset for help on using the changeset viewer.