Index: uspace/srv/logger/main.c
===================================================================
--- uspace/srv/logger/main.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/logger/main.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -83,4 +83,6 @@
 
 	printf("%s: Accepting connections\n", NAME);
+
+	task_retval(EOK);
 	async_manager();
 
Index: uspace/srv/sysman/Makefile
===================================================================
--- uspace/srv/sysman/Makefile	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/Makefile	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -50,4 +50,5 @@
 	units/unit_tgt.c \
 	units/unit_svc.c \
+	sm_task.c \
 	util.c
 
Index: uspace/srv/sysman/configuration.c
===================================================================
--- uspace/srv/sysman/configuration.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/configuration.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -38,4 +38,6 @@
 #include "log.h"
 
+// TODO rename to repository (dynamic nature of units storage, and do not name it godlike Manager :-)
+
 LIST_INITIALIZE(units);
 
Index: uspace/srv/sysman/connection_ctl.c
===================================================================
--- uspace/srv/sysman/connection_ctl.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/connection_ctl.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -38,4 +38,5 @@
 
 
+// TODO possibly provide as type-safe function + macro in sysman.h for generic boxing
 static ipc_callid_t *box_callid(ipc_callid_t iid)
 {
Index: uspace/srv/sysman/main.c
===================================================================
--- uspace/srv/sysman/main.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/main.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -44,4 +44,5 @@
 #include "log.h"
 #include "sysman.h"
+#include "sm_task.h"
 #include "unit.h"
 
@@ -208,7 +209,9 @@
 	 * Initialize global structures
 	 */
+	// TODO check return values and abort start
 	configuration_init();
 	sysman_events_init();
 	job_queue_init();
+	sm_task_init();
 
 	/*
@@ -230,5 +233,6 @@
 
 	sysman_log(LVL_DEBUG, "Debugging pause...\n");
-	async_usleep(10 * 1000000);
+	async_usleep(1 * 1000000);
+	sysman_log(LVL_DEBUG, "Debugging pause ended.\n");
 	/* Queue first job from sequence */
 	prepare_and_run_job(&target_sequence[0]);
Index: uspace/srv/sysman/sm_task.c
===================================================================
--- uspace/srv/sysman/sm_task.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
+++ uspace/srv/sysman/sm_task.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2015 Michal Koutny
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <adt/list.h>
+#include <stdlib.h>
+#include <task.h>
+
+#include "configuration.h"
+#include "log.h"
+#include "sysman.h"
+#include "sm_task.h"
+
+/** Structure for boxing task event */
+struct sm_task_event {
+	task_id_t task_id;
+	int flags;
+	task_exit_t texit;
+	int retval;
+};
+
+static void sysman_event_task_event(void *);
+
+/**
+ * @note This function runs in separate fibril (not same as event loop).
+ */
+static void sm_task_event_handler(task_id_t tid, int flags, task_exit_t texit,
+    int retval)
+{
+	sm_task_event_t *tev = malloc(sizeof(sm_task_event_t));
+	if (tev == NULL) {
+		sysman_log(LVL_FATAL,
+		    "Unable to process event of task %" PRIu64 ".", tid);
+		return;
+	}
+	tev->task_id = tid;
+	tev->flags = flags;
+	tev->texit = texit;
+	tev->retval = retval;
+
+	sysman_raise_event(&sysman_event_task_event, tev);
+}
+
+static unit_svc_t *sm_task_find_service(task_id_t tid)
+{
+	/*
+	 * Unit to task is about to be developed, so use plain linear search
+	 * instead of specialized structures.
+	 */
+	list_foreach(units, units, unit_t, u) {
+		if (u->type != UNIT_SERVICE) {
+			continue;
+		}
+		if (CAST_SVC(u)->main_task_id == tid) {
+			return CAST_SVC(u);
+		}
+
+	}
+
+	return NULL;
+}
+
+static void sysman_event_task_event(void *data)
+{
+	sm_task_event_t *tev = data;
+
+	unit_svc_t *u_svc = sm_task_find_service(tev->task_id);
+	if (u_svc == NULL) {
+		goto finish;
+	}
+
+
+	/* Simple incomplete state automaton */
+	unit_t *u = &u_svc->unit;
+	sysman_log(LVL_DEBUG2, "%s, %s(%i)@%" PRIu64 " %i",
+	    __func__, unit_name(u), u->state, tev->task_id, tev->flags);
+	assert(u->state == STATE_STARTING);
+
+	if (tev->flags & TASK_WAIT_EXIT) {
+		// TODO maybe call unit_fail (would be nice to contain reason)
+		u->state = STATE_FAILED;
+	} else {
+		u->state = STATE_STARTED;
+	}
+
+	unit_notify_state(u);
+
+finish:
+	free(tev);
+}
+
+int sm_task_init(void)
+{
+	int rc = task_register_event_handler(&sm_task_event_handler);
+
+	//TODO dump taskman info for boot time tasks
+	return rc;
+}
Index: uspace/srv/sysman/sm_task.h
===================================================================
--- uspace/srv/sysman/sm_task.h	(revision e8747bd8d5612debac411290b4a44e33626eb264)
+++ uspace/srv/sysman/sm_task.h	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015 Michal Koutny
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SYSMAN_TASK_H
+#define SYSMAN_TASK_H
+
+struct sm_task_event;
+typedef struct sm_task_event sm_task_event_t;
+
+extern int sm_task_init(void);
+
+#endif
Index: uspace/srv/sysman/sysman.c
===================================================================
--- uspace/srv/sysman/sysman.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/sysman.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -35,4 +35,5 @@
 #include "log.h"
 #include "sysman.h"
+#include "task.h"
 #include "unit.h"
 
@@ -401,12 +402,10 @@
 void sysman_event_unit_exposee_created(void *data)
 {
-	unit_t *unit = data;
-	unit_exposee_created(unit);
+	unit_exposee_created(data);
 }
 
 void sysman_event_unit_failed(void *data)
 {
-	unit_t *unit = data;
-	unit_fail(unit);
+	unit_fail(data);
 }
 
@@ -415,2 +414,3 @@
 	notify_observers(data);
 }
+
Index: uspace/srv/sysman/sysman.h
===================================================================
--- uspace/srv/sysman/sysman.h	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/sysman.h	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -47,4 +47,5 @@
 extern size_t sysman_observers_count(void *);
 
+// TODO move particular events to separate file? (or move event impl there?)
 
 extern void sysman_event_job_process(void *);
Index: uspace/srv/sysman/units/unit_svc.c
===================================================================
--- uspace/srv/sysman/units/unit_svc.c	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/units/unit_svc.c	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -85,5 +85,5 @@
 	assert(unit->state == STATE_STOPPED);
 
-	int rc = task_spawnv(NULL, NULL, u_svc->exec_start.path,
+	int rc = task_spawnv(&u_svc->main_task_id, NULL, u_svc->exec_start.path,
 	    u_svc->exec_start.argv);
 
@@ -96,18 +96,7 @@
 
 	/*
-	 * This is temporary workaround, until proper reporting from brokers
-	 * about exposees will work. We assume the service succesfully starts
-	 * in a moment. Applies to naming service only.
-	 */
-	if (str_cmp(unit->name, "devman.svc") == 0 ||
-	    str_cmp(unit->name, "logger.svc") == 0 ||
-	    str_cmp(unit->name, "irc.svc") == 0) {
-		async_usleep(100000);
-		unit->state = STATE_STARTED;
-	}
-
-	/*
 	 * Workaround to see log output even after devman starts (and overrides
 	 * kernel's frame buffer.
+	 * TODO move to task retval/exposee created handler
 	 */
 	if (str_cmp(unit->name, "devman.svc") == 0) {
@@ -128,6 +117,7 @@
 	assert(unit->state == STATE_STOPPED || unit->state == STATE_STARTING || unit->state==STATE_STARTED);
 
-	unit->state = STATE_STARTED;
-	unit_notify_state(unit);
+	/* Exposee itself doesn't represent started unit. */
+	//unit->state = STATE_STARTED;
+	//unit_notify_state(unit);
 }
 
Index: uspace/srv/sysman/units/unit_svc.h
===================================================================
--- uspace/srv/sysman/units/unit_svc.h	(revision 012dd8ef3ba6b88a27a8406f1cb055389e6363f1)
+++ uspace/srv/sysman/units/unit_svc.h	(revision e8747bd8d5612debac411290b4a44e33626eb264)
@@ -30,4 +30,6 @@
 #define SYSMAN_UNIT_SVC_H
 
+#include <task.h>
+
 #include "unit.h"
 #include "util.h"
@@ -37,4 +39,6 @@
 
 	command_t exec_start;
+
+	task_id_t main_task_id;
 } unit_svc_t;
 
