Changeset ed5367b in mainline for uspace/srv/sysman/units
- Timestamp:
- 2019-08-07T10:01:13Z (7 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)
- Location:
- uspace/srv/sysman/units
- Files:
-
- 4 edited
-
unit_cfg.c (modified) (1 diff)
-
unit_mnt.c (modified) (1 diff)
-
unit_svc.c (modified) (1 diff)
-
unit_tgt.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/units/unit_cfg.c
r68ae40a red5367b 240 240 } 241 241 242 static int unit_cfg_stop(unit_t *unit) 243 { 244 unit_cfg_t *u_cfg = CAST_CFG(unit); 245 assert(u_cfg); 246 247 /* 248 * It makes no sense to stop configuration (i.e. unload it), however, 249 * lets virtually stop it not to make obstructions for potential 250 * restart = reload of configuration. 251 */ 252 unit->state = STATE_STOPPED; 253 return EOK; 254 } 255 242 256 static void unit_cfg_exposee_created(unit_t *unit) 243 257 { -
uspace/srv/sysman/units/unit_mnt.c
r68ae40a red5367b 229 229 } 230 230 231 static int unit_mnt_stop(unit_t *unit) 232 { 233 unit_mnt_t *u_mnt = CAST_MNT(unit); 234 assert(u_mnt); 235 /* autostart implies blocking */ 236 assert(!u_mnt->autostart || u_mnt->blocking); 237 238 239 // TODO think about unit's lifecycle (is STOPPED only acceptable?) 240 // note: we should never hit STATE_STARTING, since it'd mean there are 241 // two jobs running at once (unless job cancellation is implemented) 242 assert(unit->state == STATE_STARTED); 243 244 /* 245 * We don't expect unmount to be blocking, since if some files are 246 * being used, it'd return EBUSY immediately. That's why we call 247 * unmount synchronously in the event loop fibril. 248 */ 249 int rc = unmount(u_mnt->mountpoint); 250 251 if (rc == EOK) { 252 unit->state = STATE_STOPPED; 253 return EOK; 254 } else if (rc == EBUSY) { 255 assert(unit->state == STATE_STARTED); 256 return EBUSY; 257 } else { 258 /* 259 * Mount may be still usable, but be conservative and mark unit 260 * as failed. 261 */ 262 unit->state = STATE_FAILED; 263 return rc; 264 } 265 } 266 231 267 static void unit_mnt_exposee_created(unit_t *unit) 232 268 { -
uspace/srv/sysman/units/unit_svc.c
r68ae40a red5367b 112 112 } 113 113 114 static int unit_svc_stop(unit_t *unit) 115 { 116 unit_svc_t *u_svc = CAST_SVC(unit); 117 assert(u_svc); 118 119 120 // TODO think about unit's lifecycle (is STOPPED only acceptable?) 121 // note: May change when job cancellation is possible. 122 assert(unit->state == STATE_STARTED); 123 124 int rc = task_kill(u_svc->main_task_id); 125 126 if (rc != EOK) { 127 /* Task may still be running, but be conservative about unit's 128 * state. */ 129 unit->state = STATE_FAILED; 130 return rc; 131 } 132 133 unit->state = STATE_STOPPING; 134 135 return EOK; 136 } 137 138 114 139 static void unit_svc_exposee_created(unit_t *unit) 115 140 { -
uspace/srv/sysman/units/unit_tgt.c
r68ae40a red5367b 63 63 } 64 64 65 static int unit_tgt_stop(unit_t *unit) 66 { 67 unit_tgt_t *u_tgt = CAST_TGT(unit); 68 assert(u_tgt); 69 70 unit->state = STATE_STOPPED; 71 return EOK; 72 } 73 65 74 static void unit_tgt_exposee_created(unit_t *unit) 66 75 {
Note:
See TracChangeset
for help on using the changeset viewer.
