Changeset 241f1985 in mainline for uspace/app/sysctl/main.c
- Timestamp:
- 2019-08-31T10:45:17Z (6 years ago)
- Children:
- 102f641
- Parents:
- f92b315
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-23 22:04:34)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-31 10:45:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysctl/main.c
rf92b315 r241f1985 39 39 #include <str_error.h> 40 40 #include <sysman/ctl.h> 41 #include <unistd.h> 41 #include <fibril.h> 42 42 43 43 44 #define NAME "sysctl" … … 66 67 } 67 68 68 static int list_units(int argc, char *argv[])69 static errno_t list_units(int argc, char *argv[]) 69 70 { 70 71 unit_handle_t *units; 71 72 size_t unit_cnt; 72 73 73 int rc = sysman_get_units(&units, &unit_cnt);74 errno_t rc = sysman_get_units(&units, &unit_cnt); 74 75 if (rc != EOK) { 75 76 return rc; … … 98 99 } 99 100 100 static int start(int argc, char *argv[])101 static errno_t start(int argc, char *argv[]) 101 102 { 102 103 unit_handle_t handle; 103 104 char *unit_name = argv[1]; 104 105 105 int rc = sysman_unit_handle(unit_name, &handle);106 errno_t rc = sysman_unit_handle(unit_name, &handle); 106 107 if (rc != EOK) { 107 108 printf("Cannot obtain handle for unit '%s' (%s).\n", … … 120 121 } 121 122 122 static int stop(int argc, char *argv[])123 static errno_t stop(int argc, char *argv[]) 123 124 { 124 125 unit_handle_t handle; 125 126 char *unit_name = argv[1]; 126 127 127 int rc = sysman_unit_handle(unit_name, &handle);128 errno_t rc = sysman_unit_handle(unit_name, &handle); 128 129 if (rc != EOK) { 129 130 printf("Cannot obtain handle for unit '%s' (%s).\n", … … 142 143 } 143 144 144 static int shutdown(int argc, char *argv[])145 static errno_t shutdown(int argc, char *argv[]) 145 146 { 146 147 const int delay = 3; 147 148 printf("Will shutdown in %i seconds...\n", delay); 148 sleep(delay);149 fibril_sleep(delay); 149 150 printf("Shutdown now.\n"); 150 151 151 int rc = sysman_shutdown();152 errno_t rc = sysman_shutdown(); 152 153 if (rc != EOK) { 153 154 printf("Shutdown request failed: %s.\n", str_error(rc));
Note:
See TracChangeset
for help on using the changeset viewer.