Index: uspace/lib/libc/generic/console.c
===================================================================
--- uspace/lib/libc/generic/console.c	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/generic/console.c	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -40,5 +40,5 @@
 void console_clear(void)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_0(cons_phone, CONSOLE_CLEAR);
 }
@@ -46,5 +46,5 @@
 void console_goto(int row, int col)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
 }
@@ -52,5 +52,5 @@
 void console_flush(void)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_0(cons_phone, CONSOLE_FLUSH);
 }
@@ -58,5 +58,5 @@
 int console_get_size(int *rows, int *cols)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	ipcarg_t r, c;
 	int rc;
@@ -72,5 +72,5 @@
 void console_set_style(int style)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
 }
@@ -78,5 +78,5 @@
 void console_set_color(int fg_color, int bg_color, int flags)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
 }
@@ -84,5 +84,5 @@
 void console_set_rgb_color(int fg_color, int bg_color)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
 }
@@ -90,5 +90,5 @@
 void console_cursor_visibility(int show)
 {
-	int cons_phone = get_cons_phone();
+	int cons_phone = get_console_phone();
 	async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
 }
Index: uspace/lib/libc/generic/io/stream.c
===================================================================
--- uspace/lib/libc/generic/io/stream.c	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/generic/io/stream.c	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -116,8 +116,16 @@
 }
 
-int get_cons_phone(void)
+int get_console_phone(void)
 {
-	open_console();
+	if (console_phone < 0)
+		console_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_CONSOLE, 0, 0);
+	
 	return console_phone;
+}
+
+void console_wait(void)
+{
+	while (console_phone < 0)
+		get_console_phone();
 }
 
Index: uspace/lib/libc/generic/ipc.c
===================================================================
--- uspace/lib/libc/generic/ipc.c	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/generic/ipc.c	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -599,6 +599,30 @@
 	int res;
 
-	res = ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3, 
+	res = ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
 	    NULL, NULL, NULL, NULL, &newphid);
+	if (res)
+		return res;
+	return newphid;
+}
+
+/** Ask through phone for a new connection to some service.
+ *
+ * If the connection is not available at the moment, the
+ * call will block.
+ *
+ * @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 ipc_connect_me_to_blocking(int phoneid, int arg1, int arg2, int arg3)
+{
+	ipcarg_t newphid;
+	int res;
+
+	res = ipc_call_sync_4_5(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, arg3,
+	    IPC_FLAG_BLOCKING, NULL, NULL, NULL, NULL, &newphid);
 	if (res)
 		return res;
Index: uspace/lib/libc/generic/kbd.c
===================================================================
--- uspace/lib/libc/generic/kbd.c	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/generic/kbd.c	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -42,5 +42,5 @@
 int kbd_get_event(kbd_event_t *ev)
 {
-	int console_phone = get_cons_phone();
+	int console_phone = get_console_phone();
 	ipcarg_t r0, r1, r2, r3;
 	int rc;
Index: uspace/lib/libc/generic/vfs/vfs.c
===================================================================
--- uspace/lib/libc/generic/vfs/vfs.c	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/generic/vfs/vfs.c	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -32,5 +32,5 @@
 /** @file
  */
- 
+
 #include <vfs/vfs.h>
 #include <vfs/canonify.h>
@@ -58,5 +58,5 @@
 DIR *cwd_dir = NULL;
 char *cwd_path = NULL;
-size_t cwd_len = 0; 
+size_t cwd_len = 0;
 
 char *absolutize(const char *path, size_t *retlen)
@@ -110,24 +110,29 @@
 }
 
-static int vfs_connect(void)
-{
-	if (vfs_phone < 0)
-		vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0);
-	return vfs_phone;
-}
-
-static int device_get_handle(const char *name, dev_handle_t *handle)
-{
-	int phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT,
-	    0);
+static void vfs_connect(void)
+{
+	while (vfs_phone < 0)
+		vfs_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VFS, 0, 0);
+}
+
+static int device_get_handle(const char *name, dev_handle_t *handle,
+    const unsigned int flags)
+{
+	int phone;
+	
+	if (flags & IPC_FLAG_BLOCKING)
+		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+	else
+		phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+	
 	if (phone < 0)
 		return phone;
 	
 	ipc_call_t answer;
-	aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0,
+	aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, flags, 0,
 	    &answer);
 	
 	ipcarg_t retval = ipc_data_write_start(phone, name, strlen(name) + 1); 
-
+	
 	if (retval != EOK) {
 		async_wait_for(req, NULL);
@@ -135,7 +140,7 @@
 		return retval;
 	}
-
+	
 	async_wait_for(req, &retval);
-
+	
 	if (handle != NULL)
 		*handle = -1;
@@ -150,5 +155,6 @@
 }
 
-int mount(const char *fs_name, const char *mp, const char *dev)
+int mount(const char *fs_name, const char *mp, const char *dev,
+	const unsigned int flags)
 {
 	int res;
@@ -157,5 +163,5 @@
 	dev_handle_t dev_handle;
 	
-	res = device_get_handle(dev, &dev_handle);
+	res = device_get_handle(dev, &dev_handle, flags);
 	if (res != EOK)
 		return res;
@@ -165,18 +171,11 @@
 	if (!mpa)
 		return ENOMEM;
-
-	futex_down(&vfs_phone_futex);
-	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			free(mpa);
-			return res;
-		}
-	}
-	req = async_send_1(vfs_phone, VFS_MOUNT, dev_handle, NULL);
-	rc = ipc_data_write_start(vfs_phone, (void *)fs_name, strlen(fs_name));
+	
+	futex_down(&vfs_phone_futex);
+	async_serialize_start();
+	vfs_connect();
+	
+	req = async_send_2(vfs_phone, VFS_MOUNT, dev_handle, flags, NULL);
+	rc = ipc_data_write_start(vfs_phone, (void *) mpa, mpa_len);
 	if (rc != EOK) {
 		async_wait_for(req, NULL);
@@ -186,6 +185,6 @@
 		return (int) rc;
 	}
-	/* Ask VFS whether it likes fs_name. */
-	rc = async_req_0_0(vfs_phone, IPC_M_PING);
+	
+	rc = ipc_data_write_start(vfs_phone, (void *) fs_name, strlen(fs_name));
 	if (rc != EOK) {
 		async_wait_for(req, NULL);
@@ -195,16 +194,10 @@
 		return (int) rc;
 	}
-	rc = ipc_data_write_start(vfs_phone, (void *)mpa, mpa_len);
-	if (rc != EOK) {
-		async_wait_for(req, NULL);
-		async_serialize_end();
-		futex_up(&vfs_phone_futex);
-		free(mpa);
-		return (int) rc;
-	}
+	
 	async_wait_for(req, &rc);
 	async_serialize_end();
 	futex_up(&vfs_phone_futex);
 	free(mpa);
+	
 	return (int) rc;
 }
@@ -212,5 +205,4 @@
 static int _open(const char *path, int lflag, int oflag, ...)
 {
-	int res;
 	ipcarg_t rc;
 	ipc_call_t answer;
@@ -224,13 +216,6 @@
 	futex_down(&vfs_phone_futex);
 	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			free(pa);
-			return res;
-		}
-	}
+	vfs_connect();
+	
 	req = async_send_3(vfs_phone, VFS_OPEN, lflag, oflag, 0, &answer);
 	rc = ipc_data_write_start(vfs_phone, pa, pa_len);
@@ -259,20 +244,12 @@
 int close(int fildes)
 {
-	int res;
-	ipcarg_t rc;
-
-	futex_down(&vfs_phone_futex);
-	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			return res;
-		}
-	}
-		
+	ipcarg_t rc;
+	
+	futex_down(&vfs_phone_futex);
+	async_serialize_start();
+	vfs_connect();
+	
 	rc = async_req_1_0(vfs_phone, VFS_CLOSE, fildes);
-
+	
 	async_serialize_end();
 	futex_up(&vfs_phone_futex);
@@ -283,5 +260,4 @@
 ssize_t read(int fildes, void *buf, size_t nbyte) 
 {
-	int res;
 	ipcarg_t rc;
 	ipc_call_t answer;
@@ -290,12 +266,6 @@
 	futex_down(&vfs_phone_futex);
 	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			return res;
-		}
-	}
+	vfs_connect();
+	
 	req = async_send_1(vfs_phone, VFS_READ, fildes, &answer);
 	rc = ipc_data_read_start(vfs_phone, (void *)buf, nbyte);
@@ -317,5 +287,4 @@
 ssize_t write(int fildes, const void *buf, size_t nbyte) 
 {
-	int res;
 	ipcarg_t rc;
 	ipc_call_t answer;
@@ -324,12 +293,6 @@
 	futex_down(&vfs_phone_futex);
 	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			return res;
-		}
-	}
+	vfs_connect();
+	
 	req = async_send_1(vfs_phone, VFS_WRITE, fildes, &answer);
 	rc = ipc_data_write_start(vfs_phone, (void *)buf, nbyte);
@@ -351,18 +314,10 @@
 off_t lseek(int fildes, off_t offset, int whence)
 {
-	int res;
-	ipcarg_t rc;
-
-	futex_down(&vfs_phone_futex);
-	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			return res;
-		}
-	}
-		
+	ipcarg_t rc;
+
+	futex_down(&vfs_phone_futex);
+	async_serialize_start();
+	vfs_connect();
+	
 	ipcarg_t newoffs;
 	rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
@@ -380,17 +335,10 @@
 int ftruncate(int fildes, off_t length)
 {
-	int res;
-	ipcarg_t rc;
-	
-	futex_down(&vfs_phone_futex);
-	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			return res;
-		}
-	}
+	ipcarg_t rc;
+	
+	futex_down(&vfs_phone_futex);
+	async_serialize_start();
+	vfs_connect();
+	
 	rc = async_req_2_0(vfs_phone, VFS_TRUNCATE, fildes, length);
 	async_serialize_end();
@@ -434,5 +382,4 @@
 int mkdir(const char *path, mode_t mode)
 {
-	int res;
 	ipcarg_t rc;
 	aid_t req;
@@ -442,16 +389,9 @@
 	if (!pa)
 		return ENOMEM;
-
-	futex_down(&vfs_phone_futex);
-	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			free(pa);
-			return res;
-		}
-	}
+	
+	futex_down(&vfs_phone_futex);
+	async_serialize_start();
+	vfs_connect();
+	
 	req = async_send_1(vfs_phone, VFS_MKDIR, mode, NULL);
 	rc = ipc_data_write_start(vfs_phone, pa, pa_len);
@@ -472,5 +412,4 @@
 static int _unlink(const char *path, int lflag)
 {
-	int res;
 	ipcarg_t rc;
 	aid_t req;
@@ -483,13 +422,6 @@
 	futex_down(&vfs_phone_futex);
 	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			free(pa);
-			return res;
-		}
-	}
+	vfs_connect();
+	
 	req = async_send_0(vfs_phone, VFS_UNLINK, NULL);
 	rc = ipc_data_write_start(vfs_phone, pa, pa_len);
@@ -520,5 +452,4 @@
 int rename(const char *old, const char *new)
 {
-	int res;
 	ipcarg_t rc;
 	aid_t req;
@@ -538,14 +469,6 @@
 	futex_down(&vfs_phone_futex);
 	async_serialize_start();
-	if (vfs_phone < 0) {
-		res = vfs_connect();
-		if (res < 0) {
-			async_serialize_end();
-			futex_up(&vfs_phone_futex);
-			free(olda);
-			free(newa);
-			return res;
-		}
-	}
+	vfs_connect();
+	
 	req = async_send_0(vfs_phone, VFS_RENAME, NULL);
 	rc = ipc_data_write_start(vfs_phone, olda, olda_len);
Index: uspace/lib/libc/include/async.h
===================================================================
--- uspace/lib/libc/include/async.h	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/include/async.h	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -77,5 +77,5 @@
     async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
         (arg5), (dataptr))
- 
+
 extern aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr);
@@ -87,6 +87,6 @@
     suseconds_t timeout);
 
-fid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid, 
-    ipc_call_t *call, void (*cthread)(ipc_callid_t,ipc_call_t *));
+fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid,
+    ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *));
 void async_usleep(suseconds_t timeout);
 void async_create_manager(void);
Index: uspace/lib/libc/include/io/stream.h
===================================================================
--- uspace/lib/libc/include/io/stream.h	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/include/io/stream.h	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -48,5 +48,6 @@
 extern ssize_t write_stderr(const void *, size_t);
 
-extern int get_cons_phone(void);
+extern int get_console_phone(void);
+extern void console_wait(void);
 
 #endif
Index: uspace/lib/libc/include/ipc/ipc.h
===================================================================
--- uspace/lib/libc/include/ipc/ipc.h	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/include/ipc/ipc.h	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -247,6 +247,9 @@
     ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
 
+#define IPC_FLAG_BLOCKING  0x01
+
 extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
 extern int ipc_connect_me_to(int, int, int, int);
+extern int ipc_connect_me_to_blocking(int, int, int, int);
 extern int ipc_hangup(int);
 extern int ipc_register_irq(int, int, int, irq_code_t *);
Index: uspace/lib/libc/include/ipc/services.h
===================================================================
--- uspace/lib/libc/include/ipc/services.h	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/include/ipc/services.h	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -31,6 +31,6 @@
  */
 /**
- * @file	services.h
- * @brief	List of all known services and their codes.
+ * @file  services.h
+ * @brief List of all known services and their codes.
  */
 
Index: uspace/lib/libc/include/vfs/vfs.h
===================================================================
--- uspace/lib/libc/include/vfs/vfs.h	(revision 0d5a50cade5ee95d9afc0d055a94381254bb6e18)
+++ uspace/lib/libc/include/vfs/vfs.h	(revision 6519d6f5a49b667921f83081e2ebb90b80c86500)
@@ -40,5 +40,6 @@
 extern char *absolutize(const char *, size_t *);
 
-extern int mount(const char *, const char *, const char *);
+extern int mount(const char *, const char *, const char *,
+    const unsigned int flags);
 
 #endif
