Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/Makefile	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -83,4 +83,5 @@
 	generic/io/console.c \
 	generic/io/screenbuffer.c \
+	generic/ipc/ns.c \
 	generic/malloc.c \
 	generic/sysinfo.c \
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/generic/async.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -58,5 +58,5 @@
  *   int fibril1(void *arg)
  *   {
- *     conn = ipc_connect_me_to();
+ *     conn = async_connect_me_to();
  *     c1 = async_send(conn);
  *     c2 = async_send(conn);
@@ -1235,55 +1235,82 @@
 }
 
+/** Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.
+ *
+ * Ask through phone for a new connection to some service.
+ *
+ * @param phone           Phone handle used for contacting the other side.
+ * @param arg1            User defined argument.
+ * @param arg2            User defined argument.
+ * @param arg3            User defined argument.
+ * @param client_receiver Connection handing routine.
+ *
+ * @return New phone handle on success or a negative error code.
+ *
+ */
+int async_connect_to_me(int phone, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, async_client_conn_t client_receiver)
+{
+	sysarg_t task_hash;
+	sysarg_t phone_hash;
+	int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
+	    NULL, NULL, NULL, &task_hash, &phone_hash);
+	if (rc != EOK)
+		return rc;
+	
+	if (client_receiver != NULL)
+		async_new_connection(task_hash, phone_hash, 0, NULL,
+		    client_receiver);
+	
+	return EOK;
+}
+
 /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
- * 
+ *
  * Ask through phone for a new connection to some service.
  *
- * @param phoneid	Phone handle used for contacting the other side.
- * @param arg1		User defined argument.
- * @param arg2		User defined argument.
- * @param arg3		User defined argument.
- *
- * @return		New phone handle on success or a negative error code.
- */
-int
-async_connect_me_to(int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
-{
-	int rc;
+ * @param phone Phone handle used for contacting the other side.
+ * @param arg1  User defined argument.
+ * @param arg2  User defined argument.
+ * @param arg3  User defined argument.
+ *
+ * @return New phone handle on success or a negative error code.
+ *
+ */
+int async_connect_me_to(int phone, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3)
+{
 	sysarg_t newphid;
-
-	rc = async_req_3_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, NULL,
-	    NULL, NULL, NULL, &newphid);
-	
-	if (rc != EOK)	
+	int rc = async_req_3_5(phone, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
+	    NULL, NULL, NULL, NULL, &newphid);
+	
+	if (rc != EOK)
 		return rc;
-
+	
 	return newphid;
 }
 
 /** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
- * 
+ *
  * Ask through phone for a new connection to some service and block until
  * success.
  *
- * @param phoneid	Phone handle used for contacting the other side.
- * @param arg1		User defined argument.
- * @param arg2		User defined argument.
- * @param arg3		User defined argument.
- *
- * @return		New phone handle on success or a negative error code.
- */
-int
-async_connect_me_to_blocking(int phoneid, sysarg_t arg1, sysarg_t arg2,
+ * @param phoneid Phone handle used for contacting the other side.
+ * @param arg1    User defined argument.
+ * @param arg2    User defined argument.
+ * @param arg3    User defined argument.
+ *
+ * @return New phone handle on success or a negative error code.
+ *
+ */
+int async_connect_me_to_blocking(int phoneid, sysarg_t arg1, sysarg_t arg2,
     sysarg_t arg3)
 {
-	int rc;
 	sysarg_t newphid;
-
-	rc = async_req_4_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
+	int rc = async_req_4_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
 	    IPC_FLAG_BLOCKING, NULL, NULL, NULL, NULL, &newphid);
 	
-	if (rc != EOK)	
+	if (rc != EOK)
 		return rc;
-
+	
 	return newphid;
 }
Index: uspace/lib/c/generic/clipboard.c
===================================================================
--- uspace/lib/c/generic/clipboard.c	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/generic/clipboard.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -39,4 +39,5 @@
 
 #include <clipboard.h>
+#include <ipc/ns.h>
 #include <ipc/services.h>
 #include <ipc/clipboard.h>
@@ -54,5 +55,5 @@
 {
 	while (clip_phone < 0)
-		clip_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_CLIPBOARD, 0, 0);
+		clip_phone = service_connect_blocking(SERVICE_CLIPBOARD, 0, 0);
 }
 
Index: uspace/lib/c/generic/devmap.c
===================================================================
--- uspace/lib/c/generic/devmap.c	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/generic/devmap.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -31,4 +31,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/ns.h>
 #include <ipc/devmap.h>
 #include <devmap.h>
@@ -50,9 +51,9 @@
 		
 		if (flags & IPC_FLAG_BLOCKING)
-			devmap_phone_driver = ipc_connect_me_to_blocking(PHONE_NS,
-			    SERVICE_DEVMAP, DEVMAP_DRIVER, 0);
+			devmap_phone_driver = service_connect_blocking(SERVICE_DEVMAP,
+			    DEVMAP_DRIVER, 0);
 		else
-			devmap_phone_driver = ipc_connect_me_to(PHONE_NS,
-			    SERVICE_DEVMAP, DEVMAP_DRIVER, 0);
+			devmap_phone_driver = service_connect(SERVICE_DEVMAP,
+			    DEVMAP_DRIVER, 0);
 		
 		return devmap_phone_driver;
@@ -62,9 +63,9 @@
 		
 		if (flags & IPC_FLAG_BLOCKING)
-			devmap_phone_client = ipc_connect_me_to_blocking(PHONE_NS,
-			    SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+			devmap_phone_client = service_connect_blocking(SERVICE_DEVMAP,
+			    DEVMAP_CLIENT, 0);
 		else
-			devmap_phone_client = ipc_connect_me_to(PHONE_NS,
-			    SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+			devmap_phone_client = service_connect(SERVICE_DEVMAP,
+			    DEVMAP_CLIENT, 0);
 		
 		return devmap_phone_client;
Index: uspace/lib/c/generic/ipc/ns.c
===================================================================
--- uspace/lib/c/generic/ipc/ns.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
+++ uspace/lib/c/generic/ipc/ns.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * 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.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <async.h>
+#include <ipc/services.h>
+#include <ipc/ns.h>
+#include <sysinfo.h>
+#include <errno.h>
+#include <as.h>
+#include <macros.h>
+
+int service_register(sysarg_t service)
+{
+	return async_connect_to_me(PHONE_NS, service, 0, 0, NULL);
+}
+
+int service_connect(sysarg_t service, sysarg_t arg2, sysarg_t arg3)
+{
+	return async_connect_me_to(PHONE_NS, service, arg2, arg3);
+}
+
+int service_connect_blocking(sysarg_t service, sysarg_t arg2, sysarg_t arg3)
+{
+	return async_connect_me_to_blocking(PHONE_NS, service, arg2, arg3);
+}
+
+wchar_t *service_klog_share_in(size_t *length)
+{
+	size_t pages;
+	if (sysinfo_get_value("klog.pages", &pages) != EOK)
+		return NULL;
+	
+	size_t size = pages * PAGE_SIZE;
+	*length = size / sizeof(wchar_t);
+	
+	wchar_t *klog = (wchar_t *) as_get_mappable_page(size);
+	if (klog == NULL)
+		return NULL;
+	
+	int res = async_share_in_start_1_0(PHONE_NS, (void *) klog, size,
+	    SERVICE_MEM_KLOG);
+	if (res != EOK) {
+		as_area_destroy((void *) klog);
+		return NULL;
+	}
+	
+	return klog;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/loader.c
===================================================================
--- uspace/lib/c/generic/loader.c	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/generic/loader.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -36,4 +36,5 @@
 #include <ipc/loader.h>
 #include <ipc/services.h>
+#include <ipc/ns.h>
 #include <libc.h>
 #include <task.h>
@@ -63,5 +64,5 @@
 loader_t *loader_connect(void)
 {
-	int phone_id = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_LOAD, 0, 0);
+	int phone_id = service_connect_blocking(SERVICE_LOAD, 0, 0);
 	if (phone_id < 0)
 		return NULL;
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -45,4 +45,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/ns.h>
 #include <async.h>
 #include <fibril_synch.h>
@@ -118,8 +119,6 @@
 static void vfs_connect(void)
 {
-	while (vfs_phone < 0) {
-		vfs_phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_VFS,
-		    0, 0);
-	}
+	while (vfs_phone < 0)
+		vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
 	
 	async_session_create(&vfs_session, vfs_phone, 0);
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/include/async.h	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -266,4 +266,6 @@
 }
 
+extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
+    async_client_conn_t);
 extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
 extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
Index: uspace/lib/c/include/ipc/ns.h
===================================================================
--- uspace/lib/c/include/ipc/ns.h	(revision bf75e3cb2c7ba437dce4bc70fc808e165cdb0206)
+++ uspace/lib/c/include/ipc/ns.h	(revision 007e6efa14f9116036c5ff0b040b3fbedee25b6f)
@@ -36,4 +36,5 @@
 #define LIBIPC_NS_H_
 
+#include <sys/types.h>
 #include <ipc/ipc.h>
 
@@ -45,4 +46,10 @@
 } ns_request_t;
 
+extern int service_register(sysarg_t);
+extern int service_connect(sysarg_t, sysarg_t, sysarg_t);
+extern int service_connect_blocking(sysarg_t, sysarg_t, sysarg_t);
+
+extern wchar_t *service_klog_share_in(size_t *);
+
 #endif
 
