Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ HelenOS.config	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -417,4 +417,7 @@
 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_PC_KBD (y/n)
 
+% PC keyboard support
+! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_PC_KBD (y/n)
+
 % Support for msim/GXemul keyboard
 ! [CONFIG_HID_IN=generic&PLATFORM=mips32] CONFIG_MIPS_KBD (y/n)
Index: defaults/arm32/gta02/Makefile.config
===================================================================
--- defaults/arm32/gta02/Makefile.config	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ defaults/arm32/gta02/Makefile.config	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -4,11 +4,2 @@
 # RAM disk format
 RDFMT = tmpfs
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = n
-
-# Compile kernel tests
-CONFIG_TEST = n
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
Index: kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
===================================================================
--- kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -292,5 +292,5 @@
 		.y = 480,
 		.scan = 2560,
-		.visual = VISUAL_BGR_0_8_8_8,
+		.visual = VISUAL_RGB_8_8_8_0,
 	};
 	
Index: kernel/arch/mips32/include/cp0.h
===================================================================
--- kernel/arch/mips32/include/cp0.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/arch/mips32/include/cp0.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -70,5 +70,5 @@
   { \
       uint32_t retval; \
-      asm("mfc0 %0, $" #reg : "=r"(retval)); \
+      asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \
       return retval; \
   }
@@ -76,5 +76,5 @@
 #define GEN_WRITE_CP0(nm,reg) static inline void cp0_ ##nm##_write(uint32_t val) \
  { \
-    asm("mtc0 %0, $" #reg : : "r"(val) ); \
+    asm volatile ("mtc0 %0, $" #reg : : "r"(val) ); \
  }
 
Index: kernel/arch/sparc64/src/smp/sun4v/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -1,5 +1,5 @@
 /*
  * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky 
+ * Copyright (c) 2009 Pavel Rimsky
  * All rights reserved.
  *
@@ -439,5 +439,5 @@
 	if (waitq_sleep_timeout(&ap_completion_wq, 10000000, SYNCH_FLAGS_NONE) ==
 	    ESYNCH_TIMEOUT)
-		printf("%s: waiting for processor (cpuid = %" PRIu32 ") timed out\n",
+		printf("%s: waiting for processor (cpuid = %" PRIu64 ") timed out\n",
 		    __func__, cpuid);
 	
Index: kernel/arch/sparc64/src/sun4v/start.S
===================================================================
--- kernel/arch/sparc64/src/sun4v/start.S	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/arch/sparc64/src/sun4v/start.S	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -296,5 +296,5 @@
 	 * Create the first stack frame.
 	 */
-	save %sp, -(STACK_WINDWO_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
+	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
 	flushw
 	add %g0, -STACK_BIAS, %fp
Index: kernel/arch/sparc64/src/trap/sun4v/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -111,5 +111,5 @@
 			((void (*)(void)) data1)();
 		} else {
-			printf("Spurious interrupt on %d, data = %" PRIx64 ".\n",
+			printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",
 			    CPU->arch.id, data1);
 		}
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/genarch/Makefile.inc	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -122,10 +122,4 @@
 endif
 
-ifeq ($(CONFIG_PL050),y)
-	GENARCH_SOURCES += \
-		genarch/src/kbrd/kbrd_pl050.c \
-		genarch/src/kbrd/scanc_pl050.c
-endif
-
 ifeq ($(CONFIG_MAC_KBD),y)
 	GENARCH_SOURCES += \
Index: rnel/genarch/src/kbrd/kbrd_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd_pl050.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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 genarch
- * @{
- */
-/**
- * @file
- * @brief pl050 Keyboard processing.
- */
-
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/kbrd/scanc.h>
-
-#include <genarch/kbrd/scanc_pl050.h>
-
-#include <synch/spinlock.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <macros.h>
-
-#define PRESSED_SHIFT     (1 << 0)
-#define PRESSED_CAPSLOCK  (1 << 1)
-#define LOCKED_CAPSLOCK   (1 << 0)
-
-#define PL050_KEY_RELEASE 0xF0
-#define PL050_ESC_KEY   0xE0
-#define PL050_CAPS_SCAN_CODE   0x58
-#define PL050_NUM_SCAN_CODE   0x77
-#define PL050_SCROLL_SCAN_CODE   0x7E
-
-static bool is_lock_key(wchar_t);
-
-static indev_operations_t kbrd_raw_ops = {
-	.poll = NULL
-};
-
-/** Process release of key.
- *
- * @param sc Scancode of the key being released.
- */
-static void key_released(kbrd_instance_t *instance, wchar_t sc)
-{
-	spinlock_lock(&instance->keylock);
-	
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags &= ~PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags &= ~PRESSED_CAPSLOCK;
-		if (instance->lockflags & LOCKED_CAPSLOCK)
-			instance->lockflags &= ~LOCKED_CAPSLOCK;
-		else
-			instance->lockflags |= LOCKED_CAPSLOCK;
-		break;
-	default:
-		break;
-	}
-	
-	spinlock_unlock(&instance->keylock);
-}
-
-/** Process keypress.
- *
- * @param sc Scancode of the key being pressed.
- */
-static void key_pressed(kbrd_instance_t *instance, wchar_t sc)
-{
-	bool letter;
-	bool shift;
-	bool capslock;
-	
-	spinlock_lock(&instance->keylock);
-	
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags |= PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags |= PRESSED_CAPSLOCK;
-		break;
-	case SC_SCAN_ESCAPE:
-		break;
-	default:
-		letter = islower(sc_primary_map[sc]);
-		shift = instance->keyflags & PRESSED_SHIFT;
-		capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
-		    (instance->lockflags & LOCKED_CAPSLOCK);
-		
-		if ((letter) && (capslock))
-			shift = !shift;
-		
-		if (shift)
-			indev_push_character(instance->sink, sc_secondary_map[sc]);
-		else
-			indev_push_character(instance->sink, sc_primary_map[sc]);
-		break;
-	}
-	
-	spinlock_unlock(&instance->keylock);
-}
-
-static void kkbrd(void *arg)
-{
-	static int key_released_flag = 0;
-	static int is_locked = 0;
-	kbrd_instance_t *instance = (kbrd_instance_t *) arg;
-	
-	while (true) {
-		wchar_t sc = indev_pop_character(&instance->raw);
-
-		if (sc == PL050_KEY_RELEASE) {
-			key_released_flag = 1;
-		} else {
-			if (key_released_flag) {
-				key_released_flag = 0;
-				if (is_lock_key(sc)) {
-					if (!is_locked) {
-						is_locked = 1;
-					} else {
-						is_locked = 0;
-						continue;
-					}
-				}
-				key_released(instance, sc);
-
-			} else {
-				if (is_lock_key(sc) && is_locked)
-					continue;
-				key_pressed(instance, sc);
-			}
-		}
-		
-	}
-}
-
-kbrd_instance_t *kbrd_init(void)
-{
-	kbrd_instance_t *instance
-	    = malloc(sizeof(kbrd_instance_t), FRAME_ATOMIC);
-	if (instance) {
-		instance->thread
-			= thread_create(kkbrd, (void *) instance, TASK, 0, "kkbrd", false);
-		
-		if (!instance->thread) {
-			free(instance);
-			return NULL;
-		}
-		
-		instance->sink = NULL;
-		indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
-		
-		spinlock_initialize(&instance->keylock, "kbrd_pl050.instance.keylock");
-		instance->keyflags = 0;
-		instance->lockflags = 0;
-	}
-	
-	return instance;
-}
-
-indev_t *kbrd_wire(kbrd_instance_t *instance, indev_t *sink)
-{
-	ASSERT(instance);
-	ASSERT(sink);
-	
-	instance->sink = sink;
-	thread_ready(instance->thread);
-	
-	return &instance->raw;
-}
-
-static bool is_lock_key(wchar_t sc)
-{
-	return ((sc == PL050_CAPS_SCAN_CODE) || (sc == PL050_NUM_SCAN_CODE) ||
-		(sc == PL050_SCROLL_SCAN_CODE));
-}
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_pl050.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_pl050.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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, U_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 genarch	
- * @{
- */
-/**
- * @file
- * @brief	Scan codes for pl050 keyboards.
- */
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-
-/** Primary meaning of scancodes. */
-wchar_t sc_primary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'`',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'q', '1',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'z', 's', 'a', 'w', '2',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'c', 'x', 'd', 'e', '4', '3',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'v', 'f', 't', 'r', '5',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'n', 'b', 'h', 'g', 'y', '6',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'm', 'j', 'u', '7', '8',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	',', 'k', 'i', 'o', '0', '9',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'.', '/', 'l', ';', 'p', '-',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'\'',
-	U_SPECIAL, /* 0x53 */
-	'[', '=',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', ']',
-	U_SPECIAL, /* 0x5C */
-	'\\',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace*/
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del*/
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock*/
-	U_SPECIAL, /* 0x78  F11*/
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** Secondary meaning of scancodes. */
-wchar_t sc_secondary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'~',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'Q', '!',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'Z', 'S', 'A', 'W', '@',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'C', 'X', 'D', 'E', '$', '#',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'V', 'F', 'T', 'R', '%',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'N', 'B', 'H', 'G', 'Y', '^',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'M', 'J', 'U', '&', '*',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	'<', 'K', 'I', 'O', ')', '(',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'>', '?', 'L', ':', 'P', '_',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'"',
-	U_SPECIAL, /* 0x53 */
-	'{', '+',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', '}',
-	U_SPECIAL, /* 0x5C */
-	'|',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace*/
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del*/
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock*/
-	U_SPECIAL, /* 0x78  F11*/
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** @}
- */
Index: kernel/tools/genmap.py
===================================================================
--- kernel/tools/genmap.py	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ kernel/tools/genmap.py	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -100,8 +100,9 @@
 			for addr, symbol in symbols:
 				value = fname + ':' + symbol
-				data = struct.pack(symtabfmt, addr + offset, value[:MAXSTRING])
+				value_bytes = value.encode('ascii')
+				data = struct.pack(symtabfmt, addr + offset, value_bytes[:MAXSTRING])
 				out.write(data)
 			
-	out.write(struct.pack(symtabfmt, 0, ''))
+	out.write(struct.pack(symtabfmt, 0, b''))
 
 def main():
Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ tools/mkfat.py	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -211,6 +211,6 @@
 	dir_entry = xstruct.create(DIR_ENTRY)
 	
-	dir_entry.name = mangle_fname(name)
-	dir_entry.ext = mangle_ext(name)
+	dir_entry.name = mangle_fname(name).encode('ascii')
+	dir_entry.ext = mangle_ext(name).encode('ascii')
 	
 	if (directory):
@@ -239,6 +239,6 @@
 	
 	dir_entry.signature = 0x2e
-	dir_entry.name = '       '
-	dir_entry.ext = '   '
+	dir_entry.name = b'       '
+	dir_entry.ext = b'   '
 	dir_entry.attr = 0x10
 	
@@ -258,6 +258,6 @@
 	
 	dir_entry.signature = [0x2e, 0x2e]
-	dir_entry.name = '      '
-	dir_entry.ext = '   '
+	dir_entry.name = b'      '
+	dir_entry.ext = b'   '
 	dir_entry.attr = 0x10
 	
Index: tools/mkhord.py
===================================================================
--- tools/mkhord.py	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ tools/mkhord.py	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -84,5 +84,5 @@
 	payload_size_aligned = align_up(payload_size, align)
 	
-	header.tag = "HORD"
+	header.tag = b"HORD"
 	header.version = 1
 	header.encoding = HORD_LSB
Index: tools/mktmpfs.py
===================================================================
--- tools/mktmpfs.py	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ tools/mktmpfs.py	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -80,5 +80,5 @@
 			dentry.kind = TMPFS_FILE
 			dentry.fname_len = len(name)
-			dentry.fname = name
+			dentry.fname = name.encode('ascii')
 			dentry.flen = size
 			
@@ -97,5 +97,5 @@
 			dentry.kind = TMPFS_DIRECTORY
 			dentry.fname_len = len(name)
-			dentry.fname = name
+			dentry.fname = name.encode('ascii')
 			
 			outf.write(dentry.pack())
@@ -122,5 +122,5 @@
 	
 	header = xstruct.create(HEADER)
-	header.tag = "TMPFS"
+	header.tag = b"TMPFS"
 	
 	outf.write(header.pack())
Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -1,3 +1,4 @@
 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com>
+ * Copyright (c) 2011, Martin Sucha
  * All rights reserved.
  *
@@ -35,4 +36,11 @@
 #include <str.h>
 #include <fcntl.h>
+#include <io/console.h>
+#include <io/color.h>
+#include <io/style.h>
+#include <io/keycode.h>
+#include <errno.h>
+#include <vfs/vfs.h>
+#include <assert.h>
 
 #include "config.h"
@@ -48,4 +56,12 @@
 
 static const char *cat_oops = "That option is not yet supported\n";
+static const char *hexchars = "0123456789abcdef";
+
+static bool paging_enabled = false;
+static size_t chars_remaining = 0;
+static size_t lines_remaining = 0;
+static sysarg_t console_cols = 0;
+static sysarg_t console_rows = 0;
+static bool should_quit = false;
 
 static struct option const long_options[] = {
@@ -56,4 +72,5 @@
 	{ "buffer", required_argument, 0, 'b' },
 	{ "more", no_argument, 0, 'm' },
+	{ "hex", no_argument, 0, 'x' },
 	{ 0, 0, 0, 0 }
 };
@@ -75,4 +92,5 @@
 		"  -b, --buffer ##  Set the read buffer size to ##\n"
 		"  -m, --more       Pause after each screen full\n"
+		"  -x, --hex        Print bytes as hex values\n"
 		"Currently, %s is under development, some options don't work.\n",
 		cmdname, cmdname);
@@ -82,9 +100,72 @@
 }
 
-static unsigned int cat_file(const char *fname, size_t blen)
+static void waitprompt()
+{
+	console_set_pos(fphone(stdout), 0, console_rows-1);
+	console_set_color(fphone(stdout), COLOR_BLUE, COLOR_WHITE, 0);
+	printf("ENTER/SPACE/PAGE DOWN - next page, "
+	       "ESC/Q - quit, C - continue unpaged");
+	fflush(stdout);
+	console_set_style(fphone(stdout), STYLE_NORMAL);
+}
+
+static void waitkey()
+{
+	console_event_t ev;
+	
+	while (true) {
+		if (!console_get_event(fphone(stdin), &ev)) {
+			return;
+		}
+		if (ev.type == KEY_PRESS) {
+			if (ev.key == KC_ESCAPE || ev.key == KC_Q) {
+				should_quit = true;
+				return;
+			}
+			if (ev.key == KC_C) {
+				paging_enabled = false;
+				return;
+			}
+			if (ev.key == KC_ENTER || ev.key == KC_SPACE ||
+			    ev.key == KC_PAGE_DOWN) {
+				return;
+			}
+		}
+	}
+	assert(false);
+}
+
+static void newpage()
+{
+	console_clear(fphone(stdout));
+	chars_remaining = console_cols;
+	lines_remaining = console_rows-1;
+}
+
+static void paged_char(wchar_t c)
+{
+	putchar(c);
+	if (paging_enabled) {
+		chars_remaining--;
+		if (c == '\n' || chars_remaining == 0) {
+			chars_remaining = console_cols;
+			lines_remaining--;
+		}
+		if (lines_remaining == 0) {
+			fflush(stdout);
+			waitprompt();
+			waitkey();
+			newpage();
+		}
+	}
+}
+
+static unsigned int cat_file(const char *fname, size_t blen, bool hex)
 {
 	int fd, bytes = 0, count = 0, reads = 0;
 	off64_t total = 0;
 	char *buff = NULL;
+	int i;
+	size_t offset = 0;
 
 	fd = open(fname, O_RDONLY);
@@ -109,8 +190,23 @@
 			count += bytes;
 			buff[bytes] = '\0';
-			printf("%s", buff);
+			offset = 0;
+			for (i = 0; i < bytes && !should_quit; i++) {
+				if (hex) {
+					paged_char(hexchars[((uint8_t)buff[i])/16]);
+					paged_char(hexchars[((uint8_t)buff[i])%16]);
+				}
+				else {
+					wchar_t c = str_decode(buff, &offset, bytes);
+					if (c == 0) {
+						// reached end of string
+						break;
+					}
+					paged_char(c);
+				}
+				
+			}
 			reads++;
 		}
-	} while (bytes > 0);
+	} while (bytes > 0 && !should_quit);
 
 	close(fd);
@@ -131,9 +227,22 @@
 	unsigned int argc, i, ret = 0, buffer = 0;
 	int c, opt_ind;
+	bool hex = false;
+	bool more = false;
+	sysarg_t rows, cols;
+	int rc;
+	
+	// reset global state
+	// TODO: move to structure?
+	paging_enabled = false;
+	chars_remaining = 0;
+	lines_remaining = 0;
+	console_cols = 0;
+	console_rows = 0;
+	should_quit = false;
 
 	argc = cli_count_args(argv);
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "hvmH:t:b:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "xhvmH:t:b:", long_options, &opt_ind);
 		switch (c) {
 		case 'h':
@@ -144,15 +253,18 @@
 			return CMD_SUCCESS;
 		case 'H':
-			printf(cat_oops);
+			printf("%s", cat_oops);
 			return CMD_FAILURE;
 		case 't':
-			printf(cat_oops);
+			printf("%s", cat_oops);
 			return CMD_FAILURE;
 		case 'b':
-			printf(cat_oops);
+			printf("%s", cat_oops);
 			break;
 		case 'm':
-			printf(cat_oops);
-			return CMD_FAILURE;
+			more = true;
+			break;
+		case 'x':
+			hex = true;
+			break;
 		}
 	}
@@ -168,7 +280,19 @@
 	if (buffer <= 0)
 		buffer = CAT_DEFAULT_BUFLEN;
-
-	for (i = optind; argv[i] != NULL; i++)
-		ret += cat_file(argv[i], buffer);
+	
+	if (more) {
+		rc = console_get_size(fphone(stdout), &cols, &rows);
+		if (rc != EOK) {
+			printf("%s - cannot get console size\n", cmdname);
+			return CMD_FAILURE;
+		}
+		console_cols = cols;
+		console_rows = rows;
+		paging_enabled = true;
+		newpage();
+	}
+
+	for (i = optind; argv[i] != NULL && !should_quit; i++)
+		ret += cat_file(argv[i], buffer, hex);
 
 	if (ret)
Index: uspace/app/bdsh/cmds/modules/cat/cat.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -4,5 +4,5 @@
 /* Prototypes for the cat command, excluding entry points */
 
-static unsigned int cat_file(const char *, size_t);
+static unsigned int cat_file(const char *, size_t, bool);
 
 #endif /* CAT_H */
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -108,4 +108,5 @@
 	for (;;) {
 		ssize_t res;
+		size_t written = 0;
 
 		bytes = read(fd1, buff, blen);
@@ -120,7 +121,8 @@
 			 * returned less data than requested.
 			 */
-			bytes = write(fd2, buff, res);
+			bytes = write(fd2, buff + written, res);
 			if (bytes < 0)
 				goto err;
+			written += bytes;
 			res -= bytes;
 		} while (res > 0);
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -101,7 +101,42 @@
 }
 
+static unsigned int rm_recursive_not_empty_dirs(const char *path)
+{
+	DIR *dirp;
+	struct dirent *dp;
+	char buff[PATH_MAX];
+	unsigned int scope;
+	unsigned int ret = 0;
+
+	dirp = opendir(path);
+	if (!dirp) {
+		/* May have been deleted between scoping it and opening it */
+		cli_error(CL_EFAIL, "Could not open %s", path);
+		return ret;
+	}
+
+	memset(buff, 0, sizeof(buff));
+	while ((dp = readdir(dirp))) {
+		snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
+		scope = rm_scope(buff);
+		switch (scope) {
+		case RM_BOGUS:
+			break;
+		case RM_FILE:
+			ret += rm_single(buff);
+			break;
+		case RM_DIR:
+			ret += rm_recursive(buff);
+			break;
+		}
+	}
+	
+	return ret;
+}
+
 static unsigned int rm_recursive(const char *path)
 {
 	int rc;
+	unsigned int ret = 0;
 
 	/* First see if it will just go away */
@@ -111,7 +146,14 @@
 
 	/* Its not empty, recursively scan it */
-	cli_error(CL_ENOTSUP,
-		"Can not remove %s, directory not empty", path);
-	return 1;
+	ret = rm_recursive_not_empty_dirs(path);
+
+	/* Delete directory */
+	rc = rmdir(path);
+	if (rc == 0)
+		return ret;
+
+	cli_error(CL_ENOTSUP, "Can not remove %s", path);
+
+	return ret + 1;
 }
 
@@ -227,5 +269,5 @@
 		}
 		memset(buff, 0, sizeof(buff));
-		snprintf(buff, len, argv[i]);
+		snprintf(buff, len, "%s", argv[i]);
 
 		scope = rm_scope(buff);
Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/generic/net/packet.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -190,5 +190,5 @@
 		}
 	}
-	gpm_destroy(&pm_globals.packet_map);
+	gpm_destroy(&pm_globals.packet_map, free);
 	/* leave locked */
 }
Index: uspace/lib/c/generic/net/socket_client.c
===================================================================
--- uspace/lib/c/generic/net/socket_client.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/generic/net/socket_client.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -749,5 +749,5 @@
 	dyn_fifo_destroy(&socket->received);
 	dyn_fifo_destroy(&socket->accepted);
-	sockets_exclude(socket_get_sockets(), socket->socket_id);
+	sockets_exclude(socket_get_sockets(), socket->socket_id, free);
 }
 
Index: uspace/lib/c/include/adt/generic_char_map.h
===================================================================
--- uspace/lib/c/include/adt/generic_char_map.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/include/adt/generic_char_map.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -47,4 +47,8 @@
 #define GENERIC_CHAR_MAP_MAGIC_VALUE	0x12345622
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Character string to generic type map declaration.
  *  @param[in] name	Name of the map.
@@ -64,6 +68,6 @@
 	int name##_add(name##_t *, const uint8_t *, const size_t, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude(name##_t *, const uint8_t *, const size_t); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \
 	type *name##_find(name##_t *, const uint8_t *, const size_t); \
 	int name##_initialize(name##_t *); \
@@ -84,5 +88,4 @@
 	     type *value) \
 	{ \
-		int rc; \
 		int index; \
 		if (!name##_is_valid(map)) \
@@ -91,10 +94,5 @@
 		if (index < 0) \
 			return index; \
-		rc = char_map_add(&map->names, name, length, index); \
-		if (rc != EOK) { \
-			name##_items_exclude_index(&map->values, index); \
-			return rc; \
-		} \
-		return EOK; \
+		return char_map_add(&map->names, name, length, index); \
 	} \
 	\
@@ -105,14 +103,14 @@
 	} \
 	\
-	void name##_destroy(name##_t *map) \
+	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
 			char_map_destroy(&map->names); \
-			name##_items_destroy(&map->values); \
+			name##_items_destroy(&map->values, dtor); \
 		} \
 	} \
 	\
 	void name##_exclude(name##_t *map, const uint8_t *name, \
-	    const size_t length) \
+	    const size_t length, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -121,5 +119,5 @@
 			if (index != CHAR_MAP_NULL) \
 				name##_items_exclude_index(&map->values, \
-				     index); \
+				     index, dtor); \
 		} \
 	} \
Index: uspace/lib/c/include/adt/generic_field.h
===================================================================
--- uspace/lib/c/include/adt/generic_field.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/include/adt/generic_field.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -46,4 +46,8 @@
 #define GENERIC_FIELD_MAGIC_VALUE		0x55667788
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Generic type field declaration.
  *
@@ -63,6 +67,6 @@
 	int name##_add(name##_t *, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude_index(name##_t *, int); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude_index(name##_t *, int, DTOR_T()); \
 	type **name##_get_field(name##_t *); \
 	type *name##_get_index(name##_t *, int); \
@@ -103,12 +107,14 @@
 	} \
 	\
-	void name##_destroy(name##_t *field) \
+	void name##_destroy(name##_t *field, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(field)) { \
 			int index; \
 			field->magic = 0; \
-			for (index = 0; index < field->next; index++) { \
-				if (field->items[index]) \
-					free(field->items[index]); \
+			if (dtor) { \
+				for (index = 0; index < field->next; index++) { \
+					if (field->items[index]) \
+						dtor(field->items[index]); \
+				} \
 			} \
 			free(field->items); \
@@ -116,9 +122,10 @@
 	} \
 	 \
-	void name##_exclude_index(name##_t *field, int index) \
+	void name##_exclude_index(name##_t *field, int index, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(field) && (index >= 0) && \
 		    (index < field->next) && (field->items[index])) { \
-			free(field->items[index]); \
+			if (dtor) \
+				dtor(field->items[index]); \
 			field->items[index] = NULL; \
 		} \
Index: uspace/lib/c/include/adt/int_map.h
===================================================================
--- uspace/lib/c/include/adt/int_map.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/include/adt/int_map.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -49,4 +49,8 @@
 #define INT_MAP_ITEM_MAGIC_VALUE	0x55667788
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Integer to generic type map declaration.
  *
@@ -72,9 +76,9 @@
 	\
 	int name##_add(name##_t *, int, type *); \
-	void name##_clear(name##_t *); \
+	void name##_clear(name##_t *, DTOR_T()); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude(name##_t *, int); \
-	void name##_exclude_index(name##_t *, int); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude(name##_t *, int, DTOR_T()); \
+	void name##_exclude_index(name##_t *, int, DTOR_T()); \
 	type *name##_find(name##_t *, int); \
 	int name##_update(name##_t *, int, int); \
@@ -82,5 +86,5 @@
 	int name##_initialize(name##_t *); \
 	int name##_is_valid(name##_t *); \
-	void name##_item_destroy(name##_item_t *); \
+	void name##_item_destroy(name##_item_t *, DTOR_T()); \
 	int name##_item_is_valid(name##_item_t *);
 
@@ -115,5 +119,5 @@
 	} \
 	\
-	void name##_clear(name##_t *map) \
+	void name##_clear(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -122,5 +126,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
+					    &map->items[index], dtor); \
 				} \
 			} \
@@ -135,5 +139,5 @@
 	} \
 	\
-	void name##_destroy(name##_t *map) \
+	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -143,5 +147,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
+					    &map->items[index], dtor); \
 				} \
 			} \
@@ -150,5 +154,5 @@
 	} \
 	\
-	void name##_exclude(name##_t *map, int key) \
+	void name##_exclude(name##_t *map, int key, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -158,16 +162,16 @@
 				    (map->items[index].key == key)) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
-				} \
-			} \
-		} \
-	} \
-	\
-	void name##_exclude_index(name##_t *map, int index) \
+					    &map->items[index], dtor); \
+				} \
+			} \
+		} \
+	} \
+	\
+	void name##_exclude_index(name##_t *map, int index, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map) && (index >= 0) && \
 		    (index < map->next) && \
 		    name##_item_is_valid(&map->items[index])) { \
-			name##_item_destroy(&map->items[index]); \
+			name##_item_destroy(&map->items[index], dtor); \
 		} \
 	} \
@@ -236,10 +240,11 @@
 	} \
 	\
-	void name##_item_destroy(name##_item_t *item) \
+	void name##_item_destroy(name##_item_t *item, DTOR_T(dtor)) \
 	{ \
 		if (name##_item_is_valid(item)) { \
 			item->magic = 0; \
 			if (item->value) { \
-				free(item->value); \
+				if (dtor) \
+					dtor(item->value); \
 				item->value = NULL; \
 			} \
Index: uspace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/c/include/ipc/services.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -47,8 +47,5 @@
 	SERVICE_DEVMAP,
 	SERVICE_DEVMAN,
-	SERVICE_FHC,
-	SERVICE_OBIO,
-	SERVICE_APIC,
-	SERVICE_I8259,
+	SERVICE_IRC,
 	SERVICE_CLIPBOARD,
 	SERVICE_NETWORKING,
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/fs/libfs.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -391,4 +391,6 @@
 						if (lflag & L_CREATE)
 							(void) ops->destroy(fn);
+						else
+							(void) ops->node_put(fn);
 						async_answer_0(rid, rc);
 					} else {
@@ -473,4 +475,6 @@
 					if (lflag & L_CREATE)
 						(void) ops->destroy(fn);
+					else
+						(void) ops->node_put(fn);
 					async_answer_0(rid, rc);
 				} else {
Index: uspace/lib/net/tl/socket_core.c
===================================================================
--- uspace/lib/net/tl/socket_core.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/net/tl/socket_core.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -107,5 +107,5 @@
 		socket_release(socket);
 
-	socket_cores_exclude(local_sockets, socket->socket_id);
+	socket_cores_exclude(local_sockets, socket->socket_id, free);
 }
 
@@ -230,5 +230,5 @@
 
 fail:
-	socket_port_map_destroy(&socket_port->map);
+	socket_port_map_destroy(&socket_port->map, free);
 	free(socket_port);
 	return rc;
@@ -649,12 +649,12 @@
 			if (socket_port->count <= 0) {
 				// destroy the map
-				socket_port_map_destroy(&socket_port->map);
+				socket_port_map_destroy(&socket_port->map, free);
 				// release the port
 				socket_ports_exclude(global_sockets,
-				    socket->port);
+				    socket->port, free);
 			} else {
 				// remove
 				socket_port_map_exclude(&socket_port->map,
-				    socket->key, socket->key_length);
+				    socket->key, socket->key_length, free);
 			}
 		}
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/lib/net/tl/tl_common.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -182,5 +182,5 @@
 			else
 				packet_dimensions_exclude(packet_dimensions,
-				    DEVICE_INVALID_ID);
+				    DEVICE_INVALID_ID, free);
 		}
 	}
Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/devman/devman.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -266,9 +266,10 @@
 	}
 	
-	if (read(fd, buf, len) <= 0) {
+	ssize_t read_bytes = safe_read(fd, buf, len);
+	if (read_bytes <= 0) {
 		printf(NAME ": unable to read file '%s'.\n", conf_path);
 		goto cleanup;
 	}
-	buf[len] = 0;
+	buf[read_bytes] = 0;
 	
 	suc = parse_match_ids(buf, ids);
@@ -1123,4 +1124,11 @@
 fun_node_t *find_fun_node_by_path(dev_tree_t *tree, char *path)
 {
+	assert(path != NULL);
+
+	bool is_absolute = path[0] == '/';
+	if (!is_absolute) {
+		return NULL;
+	}
+
 	fibril_rwlock_read_lock(&tree->rwlock);
 	
@@ -1132,5 +1140,5 @@
 	char *rel_path = path;
 	char *next_path_elem = NULL;
-	bool cont = (rel_path[0] == '/');
+	bool cont = true;
 	
 	while (cont && fun != NULL) {
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/devman/main.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -477,5 +477,11 @@
 		dev = fun->dev;
 
-	if (fun == NULL && dev == NULL) {
+	/*
+	 * For a valid function to connect to we need a device. The root
+	 * function, for example, has no device and cannot be connected to.
+	 * This means @c dev needs to be valid regardless whether we are
+	 * connecting to a device or to a function.
+	 */
+	if (dev == NULL) {
 		printf(NAME ": devman_forward error - no device or function with "
 		    "handle %" PRIun " was found.\n", handle);
Index: uspace/srv/devman/util.c
===================================================================
--- uspace/srv/devman/util.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/devman/util.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -111,4 +111,31 @@
 }
 
+ssize_t safe_read(int fd, void *buffer, size_t size)
+{
+	if (size == 0) {
+		return 0;
+	}
+
+	uint8_t *buf_ptr = (uint8_t *) buffer;
+
+	size_t total_read = 0;
+	while (total_read < size) {
+		ssize_t bytes_read = read(fd, buf_ptr, size - total_read);
+		if (bytes_read < 0) {
+			/* Error. */
+			return bytes_read;
+		} else if (bytes_read == 0) {
+			/* Possibly end of file. */
+			break;
+		} else {
+			/* Read at least something. */
+			buf_ptr += bytes_read;
+			total_read += bytes_read;
+		}
+	}
+
+	return (ssize_t) total_read;
+}
+
 /** @}
  */
Index: uspace/srv/devman/util.h
===================================================================
--- uspace/srv/devman/util.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/devman/util.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -47,4 +47,6 @@
 extern void replace_char(char *, char, char);
 
+extern ssize_t safe_read(int, void *, size_t);
+
 #endif
 
Index: uspace/srv/hid/kbd/Makefile
===================================================================
--- uspace/srv/hid/kbd/Makefile	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hid/kbd/Makefile	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -78,5 +78,5 @@
 		SOURCES += \
 			port/pl050.c \
-			ctl/pl050.c
+			ctl/pc.c
 	endif
 endif
Index: pace/srv/hid/kbd/ctl/pl050.c
===================================================================
--- uspace/srv/hid/kbd/ctl/pl050.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * 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 kbd_ctl
- * @ingroup kbd
- * @{
- */
-/**
- * @file
- * @brief PL050 keyboard controller driver.
- */
-
-#include <kbd.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <kbd_ctl.h>
-#include <gsp.h>
-#include <stdio.h>
-
-#define PL050_CAPS_SCAN_CODE 0x58
-#define PL050_NUM_SCAN_CODE 0x77
-#define PL050_SCROLL_SCAN_CODE 0x7E
-
-static bool is_lock_key(int);
-enum dec_state {
-	ds_s,
-	ds_e
-};
-
-static enum dec_state ds;
-
-static int scanmap_simple[] = {
-
-	[0x0e] = KC_BACKTICK,
-
-	[0x16] = KC_1,
-	[0x1e] = KC_2,
-	[0x26] = KC_3,
-	[0x25] = KC_4,
-	[0x2e] = KC_5,
-	[0x36] = KC_6,
-	[0x3d] = KC_7,
-	[0x3e] = KC_8,
-	[0x46] = KC_9,
-	[0x45] = KC_0,
-
-	[0x4e] = KC_MINUS,
-	[0x55] = KC_EQUALS,
-	[0x66] = KC_BACKSPACE,
-
-	[0x0d] = KC_TAB,
-
-	[0x15] = KC_Q,
-	[0x1d] = KC_W,
-	[0x24] = KC_E,
-	[0x2d] = KC_R,
-	[0x2c] = KC_T,
-	[0x35] = KC_Y,
-	[0x3c] = KC_U,
-	[0x43] = KC_I,
-	[0x44] = KC_O,
-	[0x4d] = KC_P,
-
-	[0x54] = KC_LBRACKET,
-	[0x5b] = KC_RBRACKET,
-
-	[0x58] = KC_CAPS_LOCK,
-
-	[0x1c] = KC_A,
-	[0x1b] = KC_S,
-	[0x23] = KC_D,
-	[0x2b] = KC_F,
-	[0x34] = KC_G,
-	[0x33] = KC_H,
-	[0x3b] = KC_J,
-	[0x42] = KC_K,
-	[0x4b] = KC_L,
-
-	[0x4c] = KC_SEMICOLON,
-	[0x52] = KC_QUOTE,
-	[0x5d] = KC_BACKSLASH,
-
-	[0x12] = KC_LSHIFT,
-
-	[0x1a] = KC_Z,
-	[0x22] = KC_X,
-	[0x21] = KC_C,
-	[0x2a] = KC_V,
-	[0x32] = KC_B,
-	[0x31] = KC_N,
-	[0x3a] = KC_M,
-
-	[0x41] = KC_COMMA,
-	[0x49] = KC_PERIOD,
-	[0x4a] = KC_SLASH,
-
-	[0x59] = KC_RSHIFT,
-
-	[0x14] = KC_LCTRL,
-	[0x11] = KC_LALT,
-	[0x29] = KC_SPACE,
-
-	[0x76] = KC_ESCAPE,
-
-	[0x05] = KC_F1,
-	[0x06] = KC_F2,
-	[0x04] = KC_F3,
-	[0x0c] = KC_F4,
-	[0x03] = KC_F5,
-	[0x0b] = KC_F6,
-	[0x02] = KC_F7,
-
-	[0x0a] = KC_F8,
-	[0x01] = KC_F9,
-	[0x09] = KC_F10,
-
-	[0x78] = KC_F11,
-	[0x07] = KC_F12,
-
-	[0x60] = KC_SCROLL_LOCK,
-
-	[0x5a] = KC_ENTER,
-
-	[0x77] = KC_NUM_LOCK,
-	[0x7c] = KC_NTIMES,
-	[0x7b] = KC_NMINUS,
-	[0x79] = KC_NPLUS,
-	[0x6c] = KC_N7,
-	[0x75] = KC_N8,
-	[0x7d] = KC_N9,
-	[0x6b] = KC_N4,
-	[0x73] = KC_N5,
-	[0x74] = KC_N6,
-	[0x69] = KC_N1,
-	[0x72] = KC_N2,
-	[0x7a] = KC_N3,
-	[0x70] = KC_N0,
-	[0x71] = KC_NPERIOD
-};
-
-static int scanmap_e0[] = {
-	[0x65] = KC_RALT,
-	[0x59] = KC_RSHIFT,
-
-	[0x64] = KC_PRTSCR,
-
-	[0x70] = KC_INSERT,
-	[0x6c] = KC_HOME,
-	[0x7d] = KC_PAGE_UP,
-
-	[0x71] = KC_DELETE,
-	[0x69] = KC_END,
-	[0x7a] = KC_PAGE_DOWN,
-
-	[0x75] = KC_UP,
-	[0x6b] = KC_LEFT,
-	[0x72] = KC_DOWN,
-	[0x74] = KC_RIGHT,
-
-	[0x4a] = KC_NSLASH,
-	[0x5a] = KC_NENTER
-};
-
-int kbd_ctl_init(void)
-{
-	ds = ds_s;
-	return 0;
-}
-
-void kbd_ctl_parse_scancode(int scancode)
-{
-	static int key_release_flag = 0;
-	static int is_locked = 0;
-	console_ev_type_t type;
-	unsigned int key;
-	int *map;
-	size_t map_length;
-
-	if (scancode == 0xe0) {
-		ds = ds_e;
-		return;
-	}
-
-	switch (ds) {
-	case ds_s:
-		map = scanmap_simple;
-		map_length = sizeof(scanmap_simple) / sizeof(int);
-		break;
-	case ds_e:
-		map = scanmap_e0;
-		map_length = sizeof(scanmap_e0) / sizeof(int);
-		break;
-	default:
-		map = NULL;
-		map_length = 0;
-	}
-
-	ds = ds_s;
-	if (scancode == 0xf0) {
-		key_release_flag = 1;
-		return;
-	} else {
-		if (key_release_flag) {
-			type = KEY_RELEASE;
-			key_release_flag = 0;
-			if (is_lock_key(scancode)) {
-				if (!is_locked) {
-					is_locked = 1;
-				} else {
-					is_locked = 0;
-					return;
-				}
-			}
-		} else {
-			if (is_lock_key(scancode) && is_locked)
-				return;
-			type = KEY_PRESS;
-		}
-	}
-
-	if (scancode < 0)
-		return;
-
-	key = map[scancode];
-	if (key != 0)
-		kbd_push_ev(type, key);
-}
-
-static bool is_lock_key(int sc)
-{
-	return ((sc == PL050_CAPS_SCAN_CODE) || (sc == PL050_NUM_SCAN_CODE) ||
-	    (sc == PL050_SCROLL_SCAN_CODE));
-}
-
-void kbd_ctl_set_ind(unsigned mods)
-{
-	(void) mods;
-}
-
-/**
- * @}
- */ 
Index: uspace/srv/hid/kbd/generic/kbd.c
===================================================================
--- uspace/srv/hid/kbd/generic/kbd.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hid/kbd/generic/kbd.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -67,6 +67,6 @@
 static unsigned lock_keys;
 
-int cir_service = 0;
-int cir_phone = -1;
+bool irc_service = false;
+int irc_phone = -1;
 
 #define NUM_LAYOUTS 3
@@ -216,12 +216,11 @@
 	sysarg_t obio;
 	
-	if ((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
-		cir_service = SERVICE_FHC;
-	else if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio))
-		cir_service = SERVICE_OBIO;
-	
-	if (cir_service) {
-		while (cir_phone < 0)
-			cir_phone = service_connect_blocking(cir_service, 0, 0);
+	if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
+	    || ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio)))
+		irc_service = true;
+	
+	if (irc_service) {
+		while (irc_phone < 0)
+			irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
 	}
 	
Index: uspace/srv/hid/kbd/include/kbd.h
===================================================================
--- uspace/srv/hid/kbd/include/kbd.h	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hid/kbd/include/kbd.h	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -38,6 +38,8 @@
 #define KBD_KBD_H_
 
-extern int cir_service;
-extern int cir_phone;
+#include <bool.h>
+
+extern bool irc_service;
+extern int irc_phone;
 
 extern void kbd_push_scancode(int);
Index: uspace/srv/hid/kbd/port/ns16550.c
===================================================================
--- uspace/srv/hid/kbd/port/ns16550.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hid/kbd/port/ns16550.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -120,6 +120,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (cir_service)
-		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
+	if (irc_service)
+		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hid/kbd/port/z8530.c
===================================================================
--- uspace/srv/hid/kbd/port/z8530.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hid/kbd/port/z8530.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -108,6 +108,6 @@
 	kbd_push_scancode(scan_code);
 	
-	if (cir_service)
-		async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
+	if (irc_service)
+		async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
 		    IPC_GET_IMETHOD(*call));
 }
Index: uspace/srv/hw/irc/apic/apic.c
===================================================================
--- uspace/srv/hw/irc/apic/apic.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hw/irc/apic/apic.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -107,5 +107,5 @@
 	
 	async_set_client_connection(apic_connection);
-	service_register(SERVICE_APIC);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/irc/fhc/fhc.c
===================================================================
--- uspace/srv/hw/irc/fhc/fhc.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hw/irc/fhc/fhc.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -136,5 +136,5 @@
 	
 	async_set_client_connection(fhc_connection);
-	service_register(SERVICE_FHC);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/irc/i8259/i8259.c
===================================================================
--- uspace/srv/hw/irc/i8259/i8259.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hw/irc/i8259/i8259.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -149,5 +149,5 @@
 	
 	async_set_client_connection(i8259_connection);
-	service_register(SERVICE_I8259);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/irc/obio/obio.c
===================================================================
--- uspace/srv/hw/irc/obio/obio.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hw/irc/obio/obio.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -137,5 +137,5 @@
 	
 	async_set_client_connection(obio_connection);
-	service_register(SERVICE_OBIO);
+	service_register(SERVICE_IRC);
 	
 	return true;
Index: uspace/srv/hw/netif/ne2000/ne2000.c
===================================================================
--- uspace/srv/hw/netif/ne2000/ne2000.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/hw/netif/ne2000/ne2000.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -75,5 +75,5 @@
 #define IRQ_GET_TSR(call)  ((int) IPC_GET_ARG3(call))
 
-static int irc_service = 0;
+static bool irc_service = false;
 static int irc_phone = -1;
 
@@ -383,12 +383,11 @@
 	sysarg_t i8259;
 	
-	if ((sysinfo_get_value("apic", &apic) == EOK) && (apic))
-		irc_service = SERVICE_APIC;
-	else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))
-		irc_service = SERVICE_I8259;
+	if (((sysinfo_get_value("apic", &apic) == EOK) && (apic))
+	    || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)))
+		irc_service = true;
 	
 	if (irc_service) {
 		while (irc_phone < 0)
-			irc_phone = service_connect_blocking(irc_service, 0, 0);
+			irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
 	}
 	
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/il/arp/arp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -157,9 +157,9 @@
 			
 			arp_clear_addr(&proto->addresses);
-			arp_addr_destroy(&proto->addresses);
-		}
-	}
-	
-	arp_protos_clear(&device->protos);
+			arp_addr_destroy(&proto->addresses, free);
+		}
+	}
+	
+	arp_protos_clear(&device->protos, free);
 }
 
@@ -184,5 +184,5 @@
 	}
 	
-	arp_cache_clear(&arp_globals.cache);
+	arp_cache_clear(&arp_globals.cache, free);
 	fibril_mutex_unlock(&arp_globals.lock);
 	
@@ -212,5 +212,5 @@
 		arp_clear_trans(trans);
 	
-	arp_addr_exclude(&proto->addresses, address->value, address->length);
+	arp_addr_exclude(&proto->addresses, address->value, address->length, free);
 	
 	fibril_mutex_unlock(&arp_globals.lock);
@@ -345,5 +345,5 @@
 			    header->protocol_length, trans);
 			if (rc != EOK) {
-				/* The generic char map has already freed trans! */
+				free(trans);
 				return rc;
 			}
@@ -556,5 +556,5 @@
 		if (index < 0) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return index;
@@ -569,5 +569,5 @@
 		if (device->phone < 0) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return EREFUSED;
@@ -579,5 +579,5 @@
 		if (rc != EOK) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return rc;
@@ -589,5 +589,5 @@
 		if (rc != EOK) {
 			fibril_mutex_unlock(&arp_globals.lock);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return rc;
@@ -601,5 +601,5 @@
 			free(device->addr);
 			free(device->addr_data);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return rc;
@@ -614,5 +614,5 @@
 			free(device->broadcast_addr);
 			free(device->broadcast_data);
-			arp_protos_destroy(&device->protos);
+			arp_protos_destroy(&device->protos, free);
 			free(device);
 			return rc;
@@ -746,5 +746,5 @@
 			arp_clear_trans(trans);
 			arp_addr_exclude(&proto->addresses, target->value,
-			    target->length);
+			    target->length, free);
 			return EAGAIN;
 		}
@@ -794,5 +794,5 @@
 	    trans);
 	if (rc != EOK) {
-		/* The generic char map has already freed trans! */
+		free(trans);
 		return rc;
 	}
@@ -807,5 +807,5 @@
 		arp_clear_trans(trans);
 		arp_addr_exclude(&proto->addresses, target->value,
-		    target->length);
+		    target->length, free);
 		return ENOENT;
 	}
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/il/ip/ip.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -505,5 +505,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
-		ip_routes_destroy(&ip_netif->routes);
+		ip_routes_destroy(&ip_netif->routes, free);
 		free(ip_netif);
 		return rc;
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/net/net.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -289,12 +289,15 @@
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) NE2000_NAME,
 	    (uint8_t *) NE2000_FILENAME, SERVICE_NE2000, 0, connect_to_service);
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) ETHERNET_NAME,
 	    (uint8_t *) ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service);
 	if (rc != EOK)
 		return rc;
+	
 	rc = add_module(NULL, &net_globals.modules, (uint8_t *) NILDUMMY_NAME,
 	    (uint8_t *) NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service);
@@ -552,5 +555,5 @@
 		rc = read_netif_configuration(conf_files[i], netif);
 		if (rc != EOK) {
-			measured_strings_destroy(&netif->configuration);
+			measured_strings_destroy(&netif->configuration, free);
 			free(netif);
 			return rc;
@@ -562,5 +565,5 @@
 		if (!setting) {
 			fprintf(stderr, "%s: Network interface name is missing\n", NAME);
-			measured_strings_destroy(&netif->configuration);
+			measured_strings_destroy(&netif->configuration, free);
 			free(netif);
 			return EINVAL;
@@ -571,5 +574,5 @@
 		int index = netifs_add(&net_globals.netifs, netif->id, netif);
 		if (index < 0) {
-			measured_strings_destroy(&netif->configuration);
+			measured_strings_destroy(&netif->configuration, free);
 			free(netif);
 			return index;
@@ -583,6 +586,6 @@
 		    index);
 		if (rc != EOK) {
-			measured_strings_destroy(&netif->configuration);
-			netifs_exclude_index(&net_globals.netifs, index);
+			measured_strings_destroy(&netif->configuration, free);
+			netifs_exclude_index(&net_globals.netifs, index, free);
 			return rc;
 		}
@@ -590,10 +593,9 @@
 		rc = start_device(netif);
 		if (rc != EOK) {
-			printf("%s: Error starting interface %s (%s)\n", NAME,
+			printf("%s: Ignoring failed interface %s (%s)\n", NAME,
 			    netif->name, str_error(rc));
-			measured_strings_destroy(&netif->configuration);
-			netifs_exclude_index(&net_globals.netifs, index);
-			
-			return rc;
+			measured_strings_destroy(&netif->configuration, free);
+			netifs_exclude_index(&net_globals.netifs, index, free);
+			continue;
 		}
 		
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/nil/eth/eth.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -214,5 +214,5 @@
 	if (rc != EOK) {
 		free(eth_globals.broadcast_addr);
-		eth_devices_destroy(&eth_globals.devices);
+		eth_devices_destroy(&eth_globals.devices, free);
 	}
 out:
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -1707,5 +1707,5 @@
 		if (socket->port > 0) {
 			socket_ports_exclude(&tcp_globals.sockets,
-			    socket->port);
+			    socket->port, free);
 			socket->port = 0;
 		}
@@ -2492,5 +2492,5 @@
 	rc = packet_dimensions_initialize(&tcp_globals.dimensions);
 	if (rc != EOK) {
-		socket_ports_destroy(&tcp_globals.sockets);
+		socket_ports_destroy(&tcp_globals.sockets, free);
 		goto out;
 	}
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/net/tl/udp/udp.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -417,5 +417,5 @@
 	rc = packet_dimensions_initialize(&udp_globals.dimensions);
 	if (rc != EOK) {
-		socket_ports_destroy(&udp_globals.sockets);
+		socket_ports_destroy(&udp_globals.sockets, free);
 		fibril_rwlock_write_unlock(&udp_globals.lock);
 		return rc;
@@ -434,5 +434,5 @@
 	    &data);
 	if (rc != EOK) {
-		socket_ports_destroy(&udp_globals.sockets);
+		socket_ports_destroy(&udp_globals.sockets, free);
 		fibril_rwlock_write_unlock(&udp_globals.lock);
 		return rc;
@@ -740,5 +740,5 @@
 	int socket_id;
 	size_t addrlen;
-	size_t size;
+	size_t size = 0;
 	ipc_call_t answer;
 	size_t answer_count;
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ uspace/srv/vfs/vfs_ops.c	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -1234,4 +1234,5 @@
 	if (!parentc) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1251,4 +1252,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, rc);
 		free(old);
@@ -1261,4 +1263,5 @@
 	    (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, EXDEV);	/* different file systems */
 		free(old);
@@ -1279,4 +1282,5 @@
 		if (!new_node) {
 			fibril_rwlock_write_unlock(&namespace_rwlock);
+			vfs_node_put(old_node);
 			async_answer_0(rid, ENOMEM);
 			free(old);
@@ -1290,4 +1294,5 @@
 	default:
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		async_answer_0(rid, ENOTEMPTY);
 		free(old);
@@ -1300,4 +1305,5 @@
 	if (rc != EOK) {
 		fibril_rwlock_write_unlock(&namespace_rwlock);
+		vfs_node_put(old_node);
 		if (new_node)
 			vfs_node_put(new_node);
Index: version
===================================================================
--- version	(revision 2cf95e8c9cec32a4eeae9cef57c658d69f9209a9)
+++ version	(revision 3317724ade03c3602e2ba1e125180ec5fe566732)
@@ -37,5 +37,5 @@
 VERSION = 0
 PATCHLEVEL = 4
-SUBLEVEL = 2
+SUBLEVEL = 3
 
 ifdef EXTRAVERSION
@@ -45,3 +45,3 @@
 endif
 
-NAME = Skewer
+NAME = Sashimi
