Changeset ed5367b in mainline for uspace/lib/sysman/src/ctl.c


Ignore:
Timestamp:
2019-08-07T10:01:13Z (5 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/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.