Changeset ed5367b in mainline for uspace/srv/sysman/connection_ctl.c
- Timestamp:
- 2019-08-07T10:01:13Z (6 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/connection_ctl.c
r68ae40a red5367b 63 63 job_del_ref(&job); 64 64 } 65 66 static void sysman_unit_handle(ipc_callid_t iid, ipc_call_t *icall) 67 { 68 char *unit_name = NULL; 69 sysarg_t retval; 70 71 int rc = async_data_write_accept((void **) &unit_name, true, 72 0, 0, 0, NULL); 73 if (rc != EOK) { 74 retval = rc; 75 goto fail; 76 } 77 78 // TODO this is connection fibril, UNSYNCHRONIZED access to units! 79 unit_t *unit = repo_find_unit_by_name(unit_name); 80 if (unit == NULL) { 81 retval = ENOENT; 82 goto fail; 83 } 84 85 async_answer_1(iid, EOK, unit->handle); 86 goto finish; 87 88 fail: 89 async_answer_0(iid, retval); 90 finish: 91 free(unit_name); 92 } 93 65 94 static void sysman_unit_start(ipc_callid_t iid, ipc_call_t *icall) 66 95 { … … 109 138 finish: 110 139 free(unit_name); 140 } 141 142 static void sysman_unit_stop(ipc_callid_t iid, ipc_call_t *icall) 143 { 144 sysarg_t retval; 145 146 unit_handle_t handle = IPC_GET_ARG1(*icall); 147 int flags = IPC_GET_ARG2(*icall); 148 sysman_log(LVL_DEBUG2, "%s(%i, %x)", __func__, handle, flags); 149 150 // TODO this is connection fibril, UNSYNCHRONIZED access to units! 151 unit_t *unit = repo_find_unit_by_handle(handle); 152 if (unit == NULL) { 153 retval = ENOENT; 154 goto answer; 155 } 156 157 if (!(flags & IPC_FLAG_BLOCKING)) { 158 retval = sysman_run_job(unit, STATE_STOPPED, NULL, NULL); 159 goto answer; 160 } 161 162 ipc_callid_t *iid_ptr = box_callid(iid); 163 if (iid_ptr == NULL) { 164 retval = ENOMEM; 165 goto answer; 166 } 167 retval = sysman_run_job(unit, STATE_STOPPED, &answer_callback, 168 iid_ptr); 169 if (retval != EOK) { 170 goto answer; 171 } 172 173 /* Answer asynchronously from callback */ 174 return; 175 176 answer: 177 async_answer_0(iid, retval); 111 178 } 112 179 … … 220 287 221 288 switch (IPC_GET_IMETHOD(call)) { 289 case SYSMAN_CTL_UNIT_HANDLE: 290 sysman_unit_handle(callid, &call); 291 break; 222 292 case SYSMAN_CTL_UNIT_START: 223 293 sysman_unit_start(callid, &call); 294 break; 295 case SYSMAN_CTL_UNIT_STOP: 296 sysman_unit_stop(callid, &call); 224 297 break; 225 298 case SYSMAN_CTL_GET_UNITS:
Note:
See TracChangeset
for help on using the changeset viewer.