Changeset ed5367b in mainline for uspace/app/sysctl/main.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/app/sysctl/main.c

    r68ae40a red5367b  
    3737#include <stdlib.h>
    3838#include <str.h>
     39#include <str_error.h>
    3940#include <sysman/ctl.h>
    4041
     
    9192                continue;
    9293fail:
    93                 printf(" -- unit skipped due to IPC error (%i) --\n", rc);
     94                printf(" -- unit skipped due to IPC error (%s) --\n",
     95                    str_error(rc));
     96        }
     97
     98        return 0;
     99}
     100
     101static int stop(int argc, char *argv[])
     102{
     103        unit_handle_t handle;
     104        char *unit_name = argv[1];
     105
     106        int rc = sysman_unit_handle(unit_name, &handle);
     107        if (rc != EOK) {
     108                printf("Cannot obtain handle for unit '%s' (%s).\n",
     109                    unit_name, str_error(rc));
     110                return rc;
     111        }
     112
     113        rc = sysman_unit_stop(handle, IPC_FLAG_BLOCKING);
     114        if (rc != EOK) {
     115                printf("Error when stopping unit '%s' handle (%s).\n",
     116                    unit_name, str_error(rc));
     117                return rc;
    94118        }
    95119
     
    99123command_t commands[] = {
    100124        { "list-units", 0, &list_units },
     125        { "stop",       1, &stop },
    101126        { 0 }
    102127};
Note: See TracChangeset for help on using the changeset viewer.