Index: uspace/lib/wndmgt/test/wndmgt.c
===================================================================
--- uspace/lib/wndmgt/test/wndmgt.c	(revision 3c54869a5b618845c19d4f6200ee90ac99a446aa)
+++ uspace/lib/wndmgt/test/wndmgt.c	(revision 7d7f5e3e22d4a07e37e90f73a61193fc2a664b39)
@@ -117,21 +117,23 @@
 	wndmgt_t *wndmgt = NULL;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(wndmgt);
+
+	wndmgt_close(wndmgt);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -144,12 +146,13 @@
 	wndmgt_window_list_t *list;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -166,6 +169,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -178,12 +182,13 @@
 	wndmgt_window_list_t *list;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -212,6 +217,7 @@
 	wndmgt_free_window_list(list);
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -225,12 +231,13 @@
 	wndmgt_window_info_t *info;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -249,6 +256,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -262,12 +270,13 @@
 	wndmgt_window_info_t *info;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -297,6 +306,7 @@
 	wndmgt_free_window_info(info);
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -310,12 +320,13 @@
 	sysarg_t wnd_id;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -336,6 +347,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -349,12 +361,13 @@
 	sysarg_t wnd_id;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -375,6 +388,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -387,12 +401,13 @@
 	sysarg_t wnd_id;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -411,6 +426,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -423,12 +439,13 @@
 	sysarg_t wnd_id;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -447,6 +464,7 @@
 
 	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -458,12 +476,13 @@
 	wndmgt_t *wndmgt = NULL;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -494,6 +513,7 @@
 	wndmgt_close(wndmgt);
 
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -505,12 +525,13 @@
 	wndmgt_t *wndmgt = NULL;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -541,6 +562,7 @@
 	wndmgt_close(wndmgt);
 
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -552,12 +574,13 @@
 	wndmgt_t *wndmgt = NULL;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_wndmgt_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_wndmgt_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -588,6 +611,7 @@
 	wndmgt_close(wndmgt);
 
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
