Index: abi/include/_bits/errno.h
===================================================================
--- abi/include/_bits/errno.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/errno.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,14 +41,20 @@
 #define _BITS_ERRNO_H_
 
+#include <_bits/native.h>
+#include <_bits/decls.h>
+
 #ifdef __OPAQUE_ERRNO__
 #include <_bits/__opaque_handle.h>
 
+__HELENOS_DECLS_BEGIN;
 __opaque_handle(errno_t);
 typedef errno_t sys_errno_t;
+__HELENOS_DECLS_END;
+
 #define __errno_t(val) ((errno_t) val)
 
 #else
 
-#include <_bits/native.h>
+__HELENOS_DECLS_BEGIN;
 
 /**
@@ -65,4 +71,6 @@
 typedef sysarg_t sys_errno_t;
 
+__HELENOS_DECLS_END;
+
 /**
  * A C++-style "cast" to `errno_t`.
Index: abi/include/_bits/native.h
===================================================================
--- abi/include/_bits/native.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/native.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -47,4 +47,7 @@
 
 #include <inttypes.h>
+#include <_bits/decls.h>
+
+__HELENOS_DECLS_BEGIN;
 
 typedef uintptr_t pfn_t;
@@ -53,7 +56,5 @@
 typedef intptr_t  native_t;
 
-#define PRIdn  PRIdPTR  /**< Format for native_t. */
-#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
-#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
+__HELENOS_DECLS_END;
 
 #endif
Index: abi/include/_bits/off64_t.h
===================================================================
--- abi/include/_bits/off64_t.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
+++ abi/include/_bits/off64_t.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019 Jiří Zárevúcky
+ * 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 bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_OFF64_T_H_
+#define _BITS_OFF64_T_H_
+
+#include <stdint.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
+typedef int64_t off64_t;
+__C_DECLS_END;
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/ssize_t.h
===================================================================
--- abi/include/_bits/ssize_t.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/ssize_t.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -42,9 +42,9 @@
 
 #include <stdint.h>
+#include <_bits/decls.h>
 
+__C_DECLS_BEGIN;
 typedef intptr_t ssize_t;
-
-#define SSIZE_MIN  INTPTR_MIN
-#define SSIZE_MAX  INTPTR_MAX
+__C_DECLS_END;
 
 #endif
Index: abi/include/inttypes.h
===================================================================
--- abi/include/inttypes.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/inttypes.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -43,4 +43,5 @@
 #include <stdint.h>
 #include <_bits/wchar_t.h>
+#include <_bits/decls.h>
 
 /*
@@ -311,11 +312,4 @@
 #endif
 
-#ifdef _HELENOS_SOURCE
-#define UINT8_MIN   0
-#define UINT16_MIN  0
-#define UINT32_MIN  0
-#define UINT64_MIN  0
-#endif
-
 #define PRIdMAX  "lld"
 #define PRIiMAX  "lli"
@@ -330,7 +324,11 @@
 #define SCNxMAX  "llx"
 
-#ifdef __cplusplus
-extern "C" {
+#if defined(_HELENOS_SOURCE) && !defined(__cplusplus)
+#define PRIdn  PRIdPTR  /**< Format for native_t. */
+#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
+#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
 #endif
+
+__C_DECLS_BEGIN;
 
 typedef struct {
@@ -343,11 +341,11 @@
 intmax_t strtoimax(const char *__restrict__, char **__restrict__, int);
 uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int);
-
-#ifdef __cplusplus
-}
+intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
+uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
+
+__C_DECLS_END;
+
 #endif
 
-#endif
-
 /** @}
  */
Index: abi/include/limits.h
===================================================================
--- abi/include/limits.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/limits.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -84,4 +84,7 @@
 #define MB_LEN_MAX 4
 
+#define __NAME_MAX  256
+
+#ifdef _HELENOS_SOURCE
 #define UCHAR_MIN   0
 #define USHRT_MIN   0
@@ -89,4 +92,19 @@
 #define ULONG_MIN   (0ul)
 #define ULLONG_MIN  (0ull)
+#define SSIZE_MIN   INTPTR_MIN
+#define UINT8_MIN   0
+#define UINT16_MIN  0
+#define UINT32_MIN  0
+#define UINT64_MIN  0
+#endif
+
+#if defined(_HELENOS_SOURCE) || defined(_POSIX_SOURCE) || \
+    defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define SSIZE_MAX  INTPTR_MAX
+#define NAME_MAX   __NAME_MAX
+
+#endif
 
 /* GCC's <limits.h> doesn't define these for C++11, even though it should. */
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ kernel/Makefile	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -87,5 +87,5 @@
 INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
 
-DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
+DEFS = -D_HELENOS_SOURCE -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
 
 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
Index: uspace/lib/c/generic/private/stdio.h
===================================================================
--- uspace/lib/c/generic/private/stdio.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/generic/private/stdio.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -40,4 +40,5 @@
 #include <async.h>
 #include <stddef.h>
+#include <offset.h>
 
 /** Maximum characters that can be pushed back by ungetc() */
@@ -54,4 +55,15 @@
 	int (*flush)(FILE *stream);
 } __stream_ops_t;
+
+enum __buffer_state {
+	/** Buffer is empty */
+	_bs_empty,
+
+	/** Buffer contains data to be written */
+	_bs_write,
+
+	/** Buffer contains prefetched data for reading */
+	_bs_read
+};
 
 struct _IO_FILE {
@@ -87,5 +99,5 @@
 
 	/** Buffering type */
-	enum _buffer_type btype;
+	enum __buffer_type btype;
 
 	/** Buffer */
@@ -96,5 +108,5 @@
 
 	/** Buffer state */
-	enum _buffer_state buf_state;
+	enum __buffer_state buf_state;
 
 	/** Buffer I/O pointer */
Index: uspace/lib/c/include/adt/list.h
===================================================================
--- uspace/lib/c/include/adt/list.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/adt/list.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -42,19 +42,14 @@
 #include <stdint.h>
 #include <trace.h>
-
-/** Doubly linked list link. */
-typedef struct link {
-	struct link *prev;  /**< Pointer to the previous item in the list. */
-	struct link *next;  /**< Pointer to the next item in the list. */
-} link_t;
-
-/** Doubly linked list. */
-typedef struct list {
-	link_t head;  /**< List head. Does not have any data. */
-} list_t;
-
-extern bool list_member(const link_t *, const list_t *);
-extern void list_splice(list_t *, link_t *);
-extern unsigned long list_count(const list_t *);
+#include <_bits/decls.h>
+
+#ifndef __cplusplus
+
+/**
+ * We don't define the macros in C++ to avoid polluting headers with
+ * namespaceless names. We don't actually need them, so this is fine.
+ * We still allow including the rest of the file (in `helenos` namespace)
+ * so that we can expose publicly visible types that have list_t members.
+ */
 
 /** Declare and initialize statically allocated list.
@@ -138,4 +133,27 @@
 	assert(!link_used(link))
 
+#define list_pop(list, type, member) \
+	((type *) list_pop_internal(list, \
+	    (list_link_to_void(&(((type *) NULL)->member)) - NULL)))
+
+#endif  /* !__cplusplus */
+
+__HELENOS_DECLS_BEGIN;
+
+/** Doubly linked list link. */
+typedef struct __adt_list_link {
+	struct __adt_list_link *prev;  /**< Pointer to the previous item in the list. */
+	struct __adt_list_link *next;  /**< Pointer to the next item in the list. */
+} link_t;
+
+/** Doubly linked list. */
+typedef struct {
+	link_t head;  /**< List head. Does not have any data. */
+} list_t;
+
+extern bool list_member(const link_t *, const list_t *);
+extern void list_splice(list_t *, link_t *);
+extern unsigned long list_count(const list_t *);
+
 /** Returns true if the link is definitely part of a list. False if not sure. */
 static inline bool link_in_use(const link_t *link)
@@ -425,7 +443,5 @@
 }
 
-#define list_pop(list, type, member) \
-	((type *) list_pop_internal(list, \
-	    (list_link_to_void(&(((type *) NULL)->member)) - NULL)))
+__HELENOS_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/assert.h
===================================================================
--- uspace/lib/c/include/assert.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/assert.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,7 +41,11 @@
 #define _LIBC_ASSERT_H_
 
+#include <_bits/decls.h>
+
 #ifndef __cplusplus
 #define static_assert _Static_assert
 #endif
+
+__C_DECLS_BEGIN;
 
 extern void __helenos_assert_abort(const char *, const char *, unsigned int)
@@ -50,4 +54,6 @@
 extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int)
     __attribute__((noreturn));
+
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/bsearch.h
===================================================================
--- uspace/lib/c/include/bsearch.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/bsearch.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,7 +37,12 @@
 
 #include <stddef.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 extern void *bsearch(const void *, const void *, size_t, size_t,
     int (*)(const void *, const void *));
+
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/ctype.h
===================================================================
--- uspace/lib/c/include/ctype.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/ctype.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,4 +30,7 @@
 #define _LIBC_CTYPE_H_
 
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 int islower(int);
 int isupper(int);
@@ -44,4 +47,5 @@
 int tolower(int);
 int toupper(int);
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/dirent.h
===================================================================
--- uspace/lib/c/include/dirent.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/dirent.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,8 +36,11 @@
 #define _LIBC_DIRENT_H_
 
-#define NAME_MAX  256
+#include <limits.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 struct dirent {
-	char d_name[NAME_MAX + 1];
+	char d_name[__NAME_MAX + 1];
 };
 
@@ -49,4 +52,6 @@
 extern int closedir(DIR *);
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/c/include/dlfcn.h
===================================================================
--- uspace/lib/c/include/dlfcn.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/dlfcn.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,6 +37,12 @@
 #define _LIBC_DLFCN_H_
 
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
+
 void *dlopen(const char *, int);
 void *dlsym(void *, const char *);
+
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/errno.h
===================================================================
--- uspace/lib/c/include/errno.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/errno.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -38,8 +38,17 @@
 #include <_bits/errno.h>
 #include <abi/errno.h>
+#include <_bits/decls.h>
 
-#define errno  (*(__errno()))
+__HELENOS_DECLS_BEGIN;
 
 extern errno_t *__errno(void) __attribute__((const));
+
+__HELENOS_DECLS_END;
+
+#ifdef __cplusplus
+#define errno  (*(::helenos::__errno()))
+#else
+#define errno  (*(__errno()))
+#endif
 
 #endif
Index: uspace/lib/c/include/fibril.h
===================================================================
--- uspace/lib/c/include/fibril.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/fibril.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,7 +36,10 @@
 #define _LIBC_FIBRIL_H_
 
-#include <types/common.h>
 #include <time.h>
+#include <_bits/errno.h>
 #include <_bits/__noreturn.h>
+#include <_bits/decls.h>
+
+__HELENOS_DECLS_BEGIN;
 
 typedef struct fibril fibril_t;
@@ -71,4 +74,6 @@
 extern __noreturn void fibril_exit(long);
 
+__HELENOS_DECLS_END;
+
 #endif
 
Index: uspace/lib/c/include/fibril_synch.h
===================================================================
--- uspace/lib/c/include/fibril_synch.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/fibril_synch.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -40,10 +40,7 @@
 #include <time.h>
 #include <stdbool.h>
-
-typedef struct {
-	fibril_owner_info_t oi;  /**< Keep this the first thing. */
-	int counter;
-	list_t waiters;
-} fibril_mutex_t;
+#include <_bits/decls.h>
+
+#ifndef __cplusplus
 
 #define FIBRIL_MUTEX_INITIALIZER(name) \
@@ -58,11 +55,4 @@
 #define FIBRIL_MUTEX_INITIALIZE(name) \
 	fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
-
-typedef struct {
-	fibril_owner_info_t oi;  /**< Keep this the first thing. */
-	unsigned int writers;
-	unsigned int readers;
-	list_t waiters;
-} fibril_rwlock_t;
 
 #define FIBRIL_RWLOCK_INITIALIZER(name) \
@@ -79,8 +69,4 @@
 	fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
 
-typedef struct {
-	list_t waiters;
-} fibril_condvar_t;
-
 #define FIBRIL_CONDVAR_INITIALIZER(name) \
 	{ \
@@ -90,4 +76,34 @@
 #define FIBRIL_CONDVAR_INITIALIZE(name) \
 	fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
+
+#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
+	{ \
+		.count = (cnt), \
+		.waiters = LIST_INITIALIZER((name).waiters), \
+	}
+
+#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
+	fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
+
+#endif
+
+__HELENOS_DECLS_BEGIN;
+
+typedef struct {
+	fibril_owner_info_t oi;  /**< Keep this the first thing. */
+	int counter;
+	list_t waiters;
+} fibril_mutex_t;
+
+typedef struct {
+	fibril_owner_info_t oi;  /**< Keep this the first thing. */
+	unsigned int writers;
+	unsigned int readers;
+	list_t waiters;
+} fibril_rwlock_t;
+
+typedef struct {
+	list_t waiters;
+} fibril_condvar_t;
 
 typedef void (*fibril_timer_fun_t)(void *);
@@ -134,13 +150,4 @@
 } fibril_semaphore_t;
 
-#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
-	{ \
-		.count = (cnt), \
-		.waiters = LIST_INITIALIZER((name).waiters), \
-	}
-
-#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
-	fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
-
 extern void __fibril_synch_init(void);
 extern void __fibril_synch_fini(void);
@@ -190,4 +197,6 @@
 extern void mpsc_close(mpsc_t *);
 
+__HELENOS_DECLS_END;
+
 #endif
 
Index: uspace/lib/c/include/malloc.h
===================================================================
--- uspace/lib/c/include/malloc.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/malloc.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,4 +37,7 @@
 
 #include <stddef.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 extern void *malloc(size_t size)
@@ -42,10 +45,19 @@
 extern void *calloc(size_t nmemb, size_t size)
     __attribute__((malloc));
-extern void *memalign(size_t align, size_t size)
-    __attribute__((malloc));
 extern void *realloc(void *addr, size_t size)
     __attribute__((warn_unused_result));
 extern void free(void *addr);
+
+__C_DECLS_END;
+
+#ifdef _HELENOS_SOURCE
+__HELENOS_DECLS_BEGIN;
+
+extern void *memalign(size_t align, size_t size)
+    __attribute__((malloc));
 extern void *heap_check(void);
+
+__HELENOS_DECLS_END;
+#endif
 
 #endif
Index: uspace/lib/c/include/mem.h
===================================================================
--- uspace/lib/c/include/mem.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/mem.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -38,4 +38,7 @@
 
 #include <stddef.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 extern void *memset(void *, int, size_t)
@@ -50,4 +53,6 @@
     __attribute__((nonnull(1)));
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/c/include/offset.h
===================================================================
--- uspace/lib/c/include/offset.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/offset.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,5 +36,11 @@
 #define _LIBC_OFFSET_H_
 
+#ifndef _HELENOS_SOURCE
+#error This file should only be included from HelenOS sources
+#endif
+
 #include <stdint.h>
+#include <_bits/decls.h>
+#include <_bits/off64_t.h>
 
 /* off64_t */
@@ -52,9 +58,10 @@
 #define PRIXOFF64 PRIX64
 
-/** Relative offset */
-typedef int64_t off64_t;
+__HELENOS_DECLS_BEGIN;
 
 /** Absolute offset */
 typedef uint64_t aoff64_t;
+
+__HELENOS_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/qsort.h
===================================================================
--- uspace/lib/c/include/qsort.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/qsort.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,9 +37,17 @@
 
 #include <stddef.h>
+#include <_bits/decls.h>
 
+__C_DECLS_BEGIN;
 extern void qsort(void *, size_t, size_t, int (*)(const void *,
     const void *));
+__C_DECLS_END;
+
+#ifdef _HELENOS_SOURCE
+__HELENOS_DECLS_BEGIN;
 extern void qsort_r(void *, size_t, size_t, int (*)(const void *,
     const void *, void *), void *);
+__HELENOS_DECLS_END;
+#endif
 
 #endif
Index: uspace/lib/c/include/setjmp.h
===================================================================
--- uspace/lib/c/include/setjmp.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/setjmp.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -34,10 +34,9 @@
 #define _LIBC_SETJMP_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <libarch/fibril_context.h>
 #include <_bits/__noreturn.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 typedef __context_t jmp_buf[1];
@@ -46,10 +45,9 @@
 extern __noreturn void __context_restore(__context_t *, int);
 
-#define setjmp __context_save
 extern __noreturn void longjmp(jmp_buf, int);
 
-#ifdef __cplusplus
-}
-#endif
+__C_DECLS_END;
+
+#define setjmp __context_save
 
 #endif
Index: uspace/lib/c/include/stdio.h
===================================================================
--- uspace/lib/c/include/stdio.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/stdio.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,9 +37,4 @@
 #define _LIBC_STDIO_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <offset.h>
 #include <stdarg.h>
 #include <io/verify.h>
@@ -48,13 +43,5 @@
 #include <_bits/wchar_t.h>
 #include <_bits/wint_t.h>
-
-/** Forward declaration */
-struct _IO_FILE;
-typedef struct _IO_FILE FILE;
-
-/** File position */
-typedef struct {
-	off64_t pos;
-} fpos_t;
+#include <_bits/decls.h>
 
 #ifndef _HELENOS_SOURCE
@@ -70,5 +57,5 @@
 
 /** Max number of files that is guaranteed to be able to open at the same time */
-#define FOPEN_MAX VFS_MAX_OPEN_FILES
+#define FOPEN_MAX 16
 
 /** Recommended size of fixed-size array for holding file names. */
@@ -92,4 +79,15 @@
 /** Minimum number of unique temporary file names */
 #define TMP_MAX 1000000
+
+__C_DECLS_BEGIN;
+
+/** Forward declaration */
+struct _IO_FILE;
+typedef struct _IO_FILE FILE;
+
+/** File position */
+typedef struct {
+	long long pos;
+} fpos_t;
 
 extern FILE *stdin;
@@ -98,15 +96,23 @@
 
 /* Character and string input functions */
-#define getc fgetc
 extern int fgetc(FILE *);
 extern char *fgets(char *, int, FILE *);
 extern char *gets(char *, size_t) __attribute__((deprecated));
 
+static inline int getc(FILE *f)
+{
+	return fgetc(f);
+}
+
 extern int getchar(void);
 
 /* Character and string output functions */
-#define putc fputc
 extern int fputc(int, FILE *);
 extern int fputs(const char *, FILE *);
+
+static inline int putc(int i, FILE *f)
+{
+	return fputc(i, f);
+}
 
 extern int putchar(int);
@@ -180,9 +186,15 @@
 extern char *tmpnam(char *s);
 
+__C_DECLS_END;
+
 #ifdef _HELENOS_SOURCE
 
+#include <_bits/off64_t.h>
+
+__HELENOS_DECLS_BEGIN;
+
 /* Nonstandard extensions. */
 
-enum _buffer_type {
+enum __buffer_type {
 	/** No buffering */
 	_IONBF,
@@ -193,15 +205,4 @@
 };
 
-enum _buffer_state {
-	/** Buffer is empty */
-	_bs_empty,
-
-	/** Buffer contains data to be written */
-	_bs_write,
-
-	/** Buffer contains prefetched data for reading */
-	_bs_read
-};
-
 extern int vprintf_length(const char *, va_list);
 extern int printf_length(const char *, ...)
@@ -210,13 +211,8 @@
 extern int fileno(FILE *);
 
-#include <offset.h>
-
 extern int fseek64(FILE *, off64_t, int);
 extern off64_t ftell64(FILE *);
 
-#endif
-
-#ifdef __cplusplus
-}
+__HELENOS_DECLS_END;
 #endif
 
Index: uspace/lib/c/include/stdlib.h
===================================================================
--- uspace/lib/c/include/stdlib.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/stdlib.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,13 +36,19 @@
 #define _LIBC_STDLIB_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <_bits/size_t.h>
 #include <_bits/wchar_t.h>
+#include <_bits/decls.h>
 #include <bsearch.h>
 #include <malloc.h>
 #include <qsort.h>
+
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+#define RAND_MAX  714025
+
+#define MB_CUR_MAX 4
+
+__C_DECLS_BEGIN;
 
 /** Type returned by the div function */
@@ -69,11 +75,4 @@
 	long long rem;
 } lldiv_t;
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#define RAND_MAX  714025
-
-#define MB_CUR_MAX 4
 
 extern long double strtold(const char *, char **);
@@ -109,7 +108,5 @@
 extern lldiv_t lldiv(long long, long long);
 
-#ifdef __cplusplus
-}
-#endif
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/str.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -38,8 +38,4 @@
 #define _LIBC_STR_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <errno.h>
 #include <stdbool.h>
@@ -48,4 +44,7 @@
 
 #include <mem.h>
+#include <_bits/decls.h>
+
+#ifndef __cplusplus
 
 /* Common Unicode characters */
@@ -63,4 +62,8 @@
  */
 #define SPASCII_STR_BUFSIZE(spa_size) ((spa_size) + 1)
+
+#endif
+
+__HELENOS_DECLS_BEGIN;
 
 extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
@@ -147,7 +150,5 @@
 extern unsigned long strtoul(const char *, char **, int);
 
-#ifdef __cplusplus
-}
-#endif
+__HELENOS_DECLS_END;
 
 #endif
Index: uspace/lib/c/include/string.h
===================================================================
--- uspace/lib/c/include/string.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/string.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,7 +41,10 @@
 #endif
 
+#include <_bits/decls.h>
 #include <_bits/size_t.h>
 #include <_bits/NULL.h>
 #include <mem.h>
+
+__C_DECLS_BEGIN;
 
 extern char *strcpy(char *, const char *);
@@ -70,4 +73,6 @@
 #endif
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/c/include/time.h
===================================================================
--- uspace/lib/c/include/time.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/time.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,7 +36,5 @@
 #define _LIBC_TIME_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <_bits/decls.h>
 
 /* ISO/IEC 9899:2011 7.27.1 (2) */
@@ -51,4 +49,6 @@
 
 #include <_bits/size_t.h>
+
+__C_DECLS_BEGIN;
 
 /* ISO/IEC 9899:2011 7.27.1 (3), (4) */
@@ -106,4 +106,6 @@
     const struct tm *__restrict__);
 
+__C_DECLS_END;
+
 #ifdef _HELENOS_SOURCE
 
@@ -114,4 +116,6 @@
 #include <stdbool.h>
 #include <_bits/errno.h>
+
+__HELENOS_DECLS_BEGIN;
 
 typedef long long sec_t;
@@ -155,9 +159,7 @@
 extern void udelay(sysarg_t);
 
+__HELENOS_DECLS_END;
+
 #endif /* _HELENOS_SOURCE */
-
-#ifdef __cplusplus
-}
-#endif
 
 #endif
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/c/include/vfs/vfs.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -44,6 +44,4 @@
 #include <async.h>
 #include <offset.h>
-
-#define VFS_MAX_OPEN_FILES  128
 
 enum vfs_change_state_type {
Index: uspace/lib/cpp/include/__bits/chrono.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/chrono.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/chrono.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -611,6 +611,6 @@
             static time_point now()
             {
-                hel::timespec ts{};
-                hel::getrealtime(&ts);
+                ::std::timespec ts{};
+                ::helenos::getrealtime(&ts);
 
                 rep time = NSEC2USEC(ts.tv_nsec);
@@ -654,6 +654,6 @@
             static time_point now()
             {
-                hel::timespec ts{};
-                hel::getuptime(&ts);
+                ::std::timespec ts{};
+                ::helenos::getuptime(&ts);
 
                 rep time = NSEC2USEC(ts.tv_nsec);
Index: uspace/lib/cpp/include/__bits/io/ios.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/ios.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/io/ios.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,5 +41,5 @@
 {
     using streamoff = long long;
-    using streamsize = hel::ssize_t;
+    using streamsize = ::ssize_t;
 
     /**
Index: uspace/lib/cpp/include/__bits/limits.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/limits.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/limits.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -528,5 +528,5 @@
             static constexpr unsigned short min()
             {
-                return USHRT_MIN;
+                return 0;
             }
 
@@ -552,5 +552,5 @@
             static constexpr unsigned int min()
             {
-                return UINT_MIN;
+                return 0;
             }
 
@@ -576,5 +576,5 @@
             static constexpr unsigned long min()
             {
-                return ULONG_MIN;
+                return 0;
             }
 
@@ -600,5 +600,5 @@
             static constexpr unsigned long long min()
             {
-                return ULLONG_MIN;
+                return 0;
             }
 
Index: uspace/lib/cpp/include/__bits/locale/num_get.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/num_get.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/locale/num_get.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -301,16 +301,18 @@
                 if (size > 0)
                 {
-                    int ret{};
+                    int olderrno{errno};
+                    errno = EOK;
+
                     if constexpr (is_signed<BaseType>::value)
-                        ret = std::hel::str_int64_t(base.buffer_, nullptr, num_base, false, &res);
-                    else
-                        ret = std::hel::str_uint64_t(base.buffer_, nullptr, num_base, false, &res);
-
-                    if (ret != EOK)
-                    {
+                        res = ::strtoll(base.buffer_, nullptr, num_base);
+                    else
+                        res = ::strtoull(base.buffer_, nullptr, num_base);
+
+                    if (errno != EOK)
                         err |= ios_base::failbit;
-                        v = 0;
-                    }
-                    else if (res > static_cast<BaseType>(numeric_limits<T>::max()))
+
+                    errno = olderrno;
+
+                    if (res > static_cast<BaseType>(numeric_limits<T>::max()))
                     {
                         err |= ios_base::failbit;
Index: uspace/lib/cpp/include/__bits/random.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/random.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/random.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -1030,10 +1030,10 @@
              *       something better.
              */
-            hel::srand(hel::time(nullptr));
+            ::srand(::time(nullptr));
         }
 
         result_type operator()()
         {
-            return hel::rand();
+            return ::rand();
         }
 
Index: uspace/lib/cpp/include/__bits/string/string.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/string/string.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/string/string.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -82,10 +82,10 @@
         static int compare(const char_type* s1, const char_type* s2, size_t n)
         {
-            return hel::str_lcmp(s1, s2, n);
+            return ::strncmp(s1, s2, n);
         }
 
         static size_t length(const char_type* s)
         {
-            return hel::str_size(s);
+            return ::strlen(s);
         }
 
@@ -367,5 +367,4 @@
             // TODO: This function does not exits...
             __unimplemented();
-            //return hel::wstr_lcmp(s1, s2, n);
             return 0;
         }
@@ -373,5 +372,8 @@
         static size_t length(const char_type* s)
         {
-            return hel::wstr_size(s);
+            size_t i = 0;
+            while (s[i] != 0)
+                i++;
+            return i;
         }
 
Index: uspace/lib/cpp/include/__bits/thread/condition_variable.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/condition_variable.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/thread/condition_variable.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -35,9 +35,4 @@
 namespace std
 {
-    extern "C" {
-        #include <fibril.h>
-        #include <fibril_synch.h>
-    }
-
     enum class cv_status
     {
Index: uspace/lib/cpp/include/__bits/thread/threading.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/threading.hpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/__bits/thread/threading.hpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,13 +30,8 @@
 #define LIBCPP_BITS_THREAD_THREADING
 
-namespace std::hel
-{
-    extern "C" {
-        #include <fibril.h>
-        #include <fibril_synch.h>
-    }
-}
-
 #include <chrono>
+
+#include <fibril.h>
+#include <fibril_synch.h>
 
 namespace std::aux
@@ -54,9 +49,9 @@
     struct threading_policy<fibril_tag>
     {
-        using mutex_type        = hel::fibril_mutex_t;
-        using thread_type       = hel::fid_t;
-        using condvar_type      = hel::fibril_condvar_t;
-        using time_unit         = hel::usec_t;
-        using shared_mutex_type = hel::fibril_rwlock_t;
+        using mutex_type        = ::helenos::fibril_mutex_t;
+        using thread_type       = ::helenos::fid_t;
+        using condvar_type      = ::helenos::fibril_condvar_t;
+        using time_unit         = ::helenos::usec_t;
+        using shared_mutex_type = ::helenos::fibril_rwlock_t;
 
         struct thread
@@ -65,20 +60,20 @@
             static thread_type create(Callable clbl, Payload& pld)
             {
-                return hel::fibril_create(clbl, (void*)&pld);
+                return ::helenos::fibril_create(clbl, (void*)&pld);
             }
 
             static void start(thread_type thr)
             {
-                hel::fibril_add_ready(thr);
+                ::helenos::fibril_add_ready(thr);
             }
 
             static thread_type this_thread()
             {
-                return hel::fibril_get_id();
+                return ::helenos::fibril_get_id();
             }
 
             static void yield()
             {
-                hel::fibril_yield();
+                ::helenos::fibril_yield();
             }
 
@@ -94,20 +89,20 @@
             static void init(mutex_type& mtx)
             {
-                hel::fibril_mutex_initialize(&mtx);
+                ::helenos::fibril_mutex_initialize(&mtx);
             }
 
             static void lock(mutex_type& mtx)
             {
-                hel::fibril_mutex_lock(&mtx);
+                ::helenos::fibril_mutex_lock(&mtx);
             }
 
             static void unlock(mutex_type& mtx)
             {
-                hel::fibril_mutex_unlock(&mtx);
+                ::helenos::fibril_mutex_unlock(&mtx);
             }
 
             static bool try_lock(mutex_type& mtx)
             {
-                return hel::fibril_mutex_trylock(&mtx);
+                return ::helenos::fibril_mutex_trylock(&mtx);
             }
 
@@ -123,25 +118,25 @@
             static void init(condvar_type& cv)
             {
-                hel::fibril_condvar_initialize(&cv);
+                ::helenos::fibril_condvar_initialize(&cv);
             }
 
             static void wait(condvar_type& cv, mutex_type& mtx)
             {
-                hel::fibril_condvar_wait(&cv, &mtx);
+                ::helenos::fibril_condvar_wait(&cv, &mtx);
             }
 
             static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout)
             {
-                return hel::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
+                return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
             }
 
             static void signal(condvar_type& cv)
             {
-                hel::fibril_condvar_signal(&cv);
+                ::helenos::fibril_condvar_signal(&cv);
             }
 
             static void broadcast(condvar_type& cv)
             {
-                hel::fibril_condvar_broadcast(&cv);
+                ::helenos::fibril_condvar_broadcast(&cv);
             }
         };
@@ -157,5 +152,5 @@
             static void sleep(time_unit time)
             {
-                hel::fibril_usleep(time);
+                ::helenos::fibril_usleep(time);
             }
         };
@@ -165,25 +160,25 @@
             static void init(shared_mutex_type& mtx)
             {
-                hel::fibril_rwlock_initialize(&mtx);
+                ::helenos::fibril_rwlock_initialize(&mtx);
             }
 
             static void lock(shared_mutex_type& mtx)
             {
-                hel::fibril_rwlock_write_lock(&mtx);
+                ::helenos::fibril_rwlock_write_lock(&mtx);
             }
 
             static void unlock(shared_mutex_type& mtx)
             {
-                hel::fibril_rwlock_write_unlock(&mtx);
+                ::helenos::fibril_rwlock_write_unlock(&mtx);
             }
 
             static void lock_shared(shared_mutex_type& mtx)
             {
-                hel::fibril_rwlock_read_lock(&mtx);
+                ::helenos::fibril_rwlock_read_lock(&mtx);
             }
 
             static void unlock_shared(shared_mutex_type& mtx)
             {
-                hel::fibril_rwlock_read_unlock(&mtx);
+                ::helenos::fibril_rwlock_read_unlock(&mtx);
             }
 
Index: uspace/lib/cpp/include/cassert
===================================================================
--- uspace/lib/cpp/include/cassert	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cassert	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,14 +30,5 @@
 #define LIBCPP_CASSERT
 
-
-extern "C" {
-    #include <assert.h>
-}
-
-// TODO: For some reason, this function isn't visible (maybe the
-//       noreturn attribute?), adding a redeclaration here for the
-//       time being.
-
-extern void __helenos_assert_abort(const char *, const char *, unsigned int);
+#include <assert.h>
 
 #define __unimplemented() assert(!"Not implemented!")
Index: uspace/lib/cpp/include/cctype
===================================================================
--- uspace/lib/cpp/include/cctype	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cctype	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,28 +30,22 @@
 #define LIBCPP_CCTYPE
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <ctype.h>
-    }
-}
+#include <ctype.h>
 
 namespace std
 {
-    using std::hel::isalnum;
-    using std::hel::isalpha;
-    using std::hel::islower;
-    using std::hel::isupper;
-    using std::hel::isdigit;
-    /* using std::hel::isxdigit; */
-    /* using std::hel::iscntrl; */
-    /* using std::hel::isgraph; */
-    using std::hel::isspace;
-    /* using std::hel::isblank; */
-    /* using std::hel::isprint; */
-    /* using std::hel::ispunct; */
-    using std::hel::tolower;
-    using std::hel::toupper;
+    using ::isalnum;
+    using ::isalpha;
+    using ::islower;
+    using ::isupper;
+    using ::isdigit;
+    using ::isxdigit;
+    using ::iscntrl;
+    using ::isgraph;
+    using ::isspace;
+    using ::isblank;
+    using ::isprint;
+    using ::ispunct;
+    using ::tolower;
+    using ::toupper;
 }
 
Index: uspace/lib/cpp/include/cerrno
===================================================================
--- uspace/lib/cpp/include/cerrno	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cerrno	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,16 +30,5 @@
 #define LIBCPP_CERRNO
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <errno.h>
-    }
-}
-
-namespace std
-{
-    // Note: Only macros are imported here.
-}
+#include <errno.h>
 
 #endif
Index: uspace/lib/cpp/include/cinttypes
===================================================================
--- uspace/lib/cpp/include/cinttypes	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cinttypes	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,36 +30,17 @@
 #define LIBCPP_CINTTYPES
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <inttypes.h>
-    }
-}
+#include <cstdint>
+#include <inttypes.h>
 
 namespace std
 {
-    using std::hel::imaxdiv_t;
-    /* using std::hel::abs; */
-    /* using std::hel::div; */
-    /* using std::hel::imaxabs; */
-    /* using std::hel::imaxdiv; */
-    /* using std::hel::strtoimax; */
-    /* using std::hel::strtoumax; */
-    /* using std::hel::wcstoimax; */
-    /* using std::hel::wcstoumax; */
+    using ::imaxdiv_t;
+    using ::imaxabs;
+    using ::imaxdiv;
+    using ::strtoimax;
+    using ::strtoumax;
+    using ::wcstoimax;
+    using ::wcstoumax;
 }
 
-using std::hel::imaxdiv_t;
-/* using std::hel::abs; */
-/* using std::hel::div; */
-/* using std::hel::imaxabs; */
-/* using std::hel::imaxdiv; */
-/* using std::hel::strtoimax; */
-/* using std::hel::strtoumax; */
-/* using std::hel::wcstoimax; */
-/* using std::hel::wcstoumax; */
-
-#include <cstdint>
-
 #endif
Index: uspace/lib/cpp/include/climits
===================================================================
--- uspace/lib/cpp/include/climits	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/climits	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,16 +30,5 @@
 #define LIBCPP_CLIMITS
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <limits.h>
-    }
-}
-
-namespace std
-{
-    // Note: Only macros imported here.
-}
+#include <limits.h>
 
 #endif
Index: uspace/lib/cpp/include/csetjmp
===================================================================
--- uspace/lib/cpp/include/csetjmp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/csetjmp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,25 +30,11 @@
 #define LIBCPP_CSETJMP
 
-
-/**
- * TODO: Currently the <setjmp.h> header uses
- *       _Noreturn, which is not available in C++.
- */
-
-namespace std::hel
-{
-    extern "C" {
-        //#include <setjmp.h>
-    }
-}
+#include <setjmp.h>
 
 namespace std
 {
-    /* using std::hel::jmp_buf; */
-    /* using std::hel::longjmp; */
+    using ::jmp_buf;
+    using ::longjmp;
 }
 
-/* using std::hel::jmp_buf; */
-/* using std::hel::longjmp; */
-
 #endif
Index: uspace/lib/cpp/include/cstdarg
===================================================================
--- uspace/lib/cpp/include/cstdarg	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstdarg	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,18 +30,10 @@
 #define LIBCPP_CSTDARG
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <stdarg.h>
-    }
-}
+#include <stdarg.h>
 
 namespace std
 {
-    using std::hel::va_list;
+    using ::va_list;
 }
 
-using std::hel::va_list;
-
 #endif
Index: uspace/lib/cpp/include/cstddef
===================================================================
--- uspace/lib/cpp/include/cstddef	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstddef	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,26 +30,13 @@
 #define LIBCPP_CSTDDEF
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <stddef.h>
-    }
-}
-
+#include <stddef.h>
 
 namespace std
 {
-    using nullptr_t = decltype(nullptr);
-
-    using std::hel::size_t;
-    using std::hel::ptrdiff_t;
-    /* using std::hel::max_align_t; */
+    using ::nullptr_t;
+    using ::size_t;
+    using ::ptrdiff_t;
+    using ::max_align_t;
 }
 
-using std::nullptr_t;
-using std::hel::size_t;
-using std::hel::ptrdiff_t;
-/* using std::hel::max_align_t; */
-
 #endif
Index: uspace/lib/cpp/include/cstdint
===================================================================
--- uspace/lib/cpp/include/cstdint	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstdint	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,86 +30,44 @@
 #define LIBCPP_CSTDINT
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <stdint.h>
-    }
-}
+#include <stdint.h>
 
 namespace std
 {
-    using int8_t  = std::hel::int8_t;
-    using int16_t = std::hel::int16_t;
-    using int32_t = std::hel::int32_t;
-    using int64_t = std::hel::int64_t;
+    using ::int8_t;
+    using ::int16_t;
+    using ::int32_t;
+    using ::int64_t;
 
-    using intmax_t = std::hel::intmax_t;
-    using intptr_t = std::hel::intptr_t;
+    using ::intmax_t;
+    using ::intptr_t;
 
-    using int_fast8_t  = std::hel::int_fast8_t;
-    using int_fast16_t = std::hel::int_fast16_t;
-    using int_fast32_t = std::hel::int_fast32_t;
-    using int_fast64_t = std::hel::int_fast64_t;
+    using ::int_fast8_t;
+    using ::int_fast16_t;
+    using ::int_fast32_t;
+    using ::int_fast64_t;
 
-    using int_least8_t  = std::hel::int_least8_t;
-    using int_least16_t = std::hel::int_least16_t;
-    using int_least32_t = std::hel::int_least32_t;
-    using int_least64_t = std::hel::int_least64_t;
+    using ::int_least8_t;
+    using ::int_least16_t;
+    using ::int_least32_t;
+    using ::int_least64_t;
 
-    using uint8_t  = std::hel::uint8_t;
-    using uint16_t = std::hel::uint16_t;
-    using uint32_t = std::hel::uint32_t;
-    using uint64_t = std::hel::uint64_t;
+    using ::uint8_t;
+    using ::uint16_t;
+    using ::uint32_t;
+    using ::uint64_t;
 
-    using uintmax_t = std::hel::uintmax_t;
-    using uintptr_t = std::hel::uintptr_t;
+    using ::uintmax_t;
+    using ::uintptr_t;
 
-    using uint_fast8_t  = std::hel::uint_fast8_t;
-    using uint_fast16_t = std::hel::uint_fast16_t;
-    using uint_fast32_t = std::hel::uint_fast32_t;
-    using uint_fast64_t = std::hel::uint_fast64_t;
+    using ::uint_fast8_t;
+    using ::uint_fast16_t;
+    using ::uint_fast32_t;
+    using ::uint_fast64_t;
 
-    using uint_least8_t  = std::hel::uint_least8_t;
-    using uint_least16_t = std::hel::uint_least16_t;
-    using uint_least32_t = std::hel::uint_least32_t;
-    using uint_least64_t = std::hel::uint_least64_t;
+    using ::uint_least8_t;
+    using ::uint_least16_t;
+    using ::uint_least32_t;
+    using ::uint_least64_t;
 }
 
-using int8_t  = std::hel::int8_t;
-using int16_t = std::hel::int16_t;
-using int32_t = std::hel::int32_t;
-using int64_t = std::hel::int64_t;
-
-using intmax_t = std::hel::intmax_t;
-using intptr_t = std::hel::intptr_t;
-
-using int_fast8_t  = std::hel::int_fast8_t;
-using int_fast16_t = std::hel::int_fast16_t;
-using int_fast32_t = std::hel::int_fast32_t;
-using int_fast64_t = std::hel::int_fast64_t;
-
-using int_least8_t  = std::hel::int_least8_t;
-using int_least16_t = std::hel::int_least16_t;
-using int_least32_t = std::hel::int_least32_t;
-using int_least64_t = std::hel::int_least64_t;
-
-using uint8_t  = std::hel::uint8_t;
-using uint16_t = std::hel::uint16_t;
-using uint32_t = std::hel::uint32_t;
-using uint64_t = std::hel::uint64_t;
-
-using uintmax_t = std::hel::uintmax_t;
-using uintptr_t = std::hel::uintptr_t;
-
-using uint_fast8_t  = std::hel::uint_fast8_t;
-using uint_fast16_t = std::hel::uint_fast16_t;
-using uint_fast32_t = std::hel::uint_fast32_t;
-using uint_fast64_t = std::hel::uint_fast64_t;
-
-using uint_least8_t  = std::hel::uint_least8_t;
-using uint_least16_t = std::hel::uint_least16_t;
-using uint_least32_t = std::hel::uint_least32_t;
-using uint_least64_t = std::hel::uint_least64_t;
-
 #endif
Index: uspace/lib/cpp/include/cstdio
===================================================================
--- uspace/lib/cpp/include/cstdio	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstdio	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,115 +30,60 @@
 #define LIBCPP_CSTDIO
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <stdio.h>
-    }
-}
+#include <stdio.h>
 
 namespace std
 {
-    using std::hel::FILE;
-    using std::hel::stdin;
-    using std::hel::stdout;
-    using std::hel::stderr;
-    /* using std::hel::fpos_t */
-    using std::hel::size_t;
+    using ::FILE;
+    using ::stdin;
+    using ::stdout;
+    using ::stderr;
+    using ::fpos_t;
+    using ::size_t;
 
-    using std::hel::clearerr;
-    using std::hel::fclose;
-    using std::hel::feof;
-    using std::hel::ferror;
-    using std::hel::fflush;
-    using std::hel::fgetc;
-    /* using std::hel::fgetpos; */
-    using std::hel::fgets;
-    using std::hel::fopen;
-    using std::hel::fprintf;
-    using std::hel::fputc;
-    using std::hel::fputs;
-    using std::hel::fread;
-    using std::hel::freopen;
-    /* using std::hel::fscanf; */
-    using std::hel::fseek;
-    /* using std::hel::fsetpos; */
-    using std::hel::ftell;
-    using std::hel::fwrite;
-    /* using std::hel::getc; */
-    using std::hel::getchar;
-    /* using std::hel::perror; */
-    using std::hel::printf;
-    /* using std::hel::putc; */
-    using std::hel::putchar;
-    using std::hel::puts;
-    using std::hel::remove;
-    using std::hel::rename;
-    using std::hel::rewind;
-    /* using std::hel::scanf; */
-    using std::hel::setbuf;
-    using std::hel::setvbuf;
-    using std::hel::snprintf;
-    /* using std::hel::sprintf; */
-    /* using std::hel::sscanf; */
-    /* using std::hel::tmpfile; */
-    /* using std::hel::tmpnam; */
-    using std::hel::ungetc;
-    using std::hel::vfprintf;
-    using std::hel::vprintf;
-    /* using std::hel::vscanf; */
-    using std::hel::vsnprintf;
-    /* using std::hel::vsprintf; */
-    /* using std::hel::vsscanf; */
+    using ::clearerr;
+    using ::fclose;
+    using ::feof;
+    using ::ferror;
+    using ::fflush;
+    using ::fgetc;
+    using ::fgetpos;
+    using ::fgets;
+    using ::fopen;
+    using ::fprintf;
+    using ::fputc;
+    using ::fputs;
+    using ::fread;
+    using ::freopen;
+    using ::fscanf;
+    using ::fseek;
+    using ::fsetpos;
+    using ::ftell;
+    using ::fwrite;
+    using ::getc;
+    using ::getchar;
+    using ::perror;
+    using ::printf;
+    using ::putc;
+    using ::putchar;
+    using ::puts;
+    using ::remove;
+    using ::rename;
+    using ::rewind;
+    using ::scanf;
+    using ::setbuf;
+    using ::setvbuf;
+    using ::snprintf;
+    /* using ::sprintf; */
+    /* using ::sscanf; */
+    /* using ::tmpfile; */
+    /* using ::tmpnam; */
+    using ::ungetc;
+    using ::vfprintf;
+    using ::vprintf;
+    /* using ::vscanf; */
+    using ::vsnprintf;
+    /* using ::vsprintf; */
+    /* using ::vsscanf; */
 }
 
-using std::hel::FILE;
-/* using std::hel::fpos_t */
-using std::hel::size_t;
-
-using std::hel::clearerr;
-using std::hel::fclose;
-using std::hel::feof;
-using std::hel::ferror;
-using std::hel::fflush;
-using std::hel::fgetc;
-/* using std::hel::fgetpos; */
-using std::hel::fgets;
-using std::hel::fopen;
-using std::hel::fprintf;
-using std::hel::fputc;
-using std::hel::fputs;
-using std::hel::fread;
-using std::hel::freopen;
-/* using std::hel::fscanf; */
-using std::hel::fseek;
-/* using std::hel::fsetpos; */
-using std::hel::ftell;
-using std::hel::fwrite;
-/* using std::hel::getc; */
-using std::hel::getchar;
-/* using std::hel::perror; */
-using std::hel::printf;
-/* using std::hel::putc; */
-using std::hel::putchar;
-using std::hel::puts;
-using std::hel::remove;
-using std::hel::rename;
-using std::hel::rewind;
-/* using std::hel::scanf; */
-using std::hel::setbuf;
-using std::hel::setvbuf;
-using std::hel::snprintf;
-/* using std::hel::sprintf; */
-/* using std::hel::sscanf; */
-/* using std::hel::tmpfile; */
-/* using std::hel::tmpnam; */
-using std::hel::ungetc;
-using std::hel::vfprintf;
-using std::hel::vprintf;
-/* using std::hel::vscanf; */
-using std::hel::vsnprintf;
-/* using std::hel::vsprintf; */
-/* using std::hel::vsscanf; */
-
 #endif
Index: uspace/lib/cpp/include/cstdlib
===================================================================
--- uspace/lib/cpp/include/cstdlib	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstdlib	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,111 +30,57 @@
 #define LIBCPP_CSTDLIB
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <stdlib.h>
-        #include <_bits/ssize_t.h>
-    }
-}
+#include <stdlib.h>
+#include <_bits/ssize_t.h>
 
 namespace std
 {
-    /* using std::hel::div_t; */
-    /* using std::hel::ldiv_t; */
-    /* using std::hel::lldiv_t; */
-    using std::hel::size_t;
+    /* using ::div_t; */
+    /* using ::ldiv_t; */
+    /* using ::lldiv_t; */
+    using ::size_t;
 
-    using std::hel::abort;
-    using std::hel::exit;
-    /* using std::hel::quick_exit; */
-    /* using std::hel::_Exit; */
-    using std::hel::atexit;
-    /* using std::hel::at_quick_exit; */
-    /* using std::hel::system; */
-    /* using std::hel::getenv; */
+    using ::abort;
+    using ::exit;
+    /* using ::quick_exit; */
+    /* using ::_Exit; */
+    using ::atexit;
+    /* using ::at_quick_exit; */
+    /* using ::system; */
+    /* using ::getenv; */
 
-    using std::hel::malloc;
-    using std::hel::calloc;
-    using std::hel::realloc;
-    using std::hel::free;
+    using ::malloc;
+    using ::calloc;
+    using ::realloc;
+    using ::free;
 
-    /* using std::hel::atof; */
-    /* using std::hel::atoi; */
-    /* using std::hel::atol; */
-    /* using std::hel::atoll; */
-    /* using std::hel::strtol; */
-    /* using std::hel::strtoll; */
-    /* using std::hel::strtoul; */
-    /* using std::hel::strtoull; */
-    /* using std::hel::strtof; */
-    /* using std::hel::strtod; */
-    /* using std::hel::strtold; */
+    /* using ::atof; */
+    /* using ::atoi; */
+    /* using ::atol; */
+    /* using ::atoll; */
+    /* using ::strtol; */
+    /* using ::strtoll; */
+    /* using ::strtoul; */
+    /* using ::strtoull; */
+    /* using ::strtof; */
+    /* using ::strtod; */
+    /* using ::strtold; */
 
-    /* using std::hel::mblen; */
-    /* using std::hel::mbtowc; */
-    /* using std::hel::wctomb; */
-    /* using std::hel::mbstowcs; */
-    /* using std::hel::wcstombs; */
+    /* using ::mblen; */
+    /* using ::mbtowc; */
+    /* using ::wctomb; */
+    /* using ::mbstowcs; */
+    /* using ::wcstombs; */
 
-    using std::hel::rand;
-    using std::hel::srand;
-    using std::hel::qsort;
-    /* using std::hel::bsearch; */
-    /* using std::hel::abs; */
-    /* using std::hel::labs; */
-    /* using std::hel::llabs; */
-    /* using std::hel::div; */
-    /* using std::hel::ldiv; */
-    /* using std::hel::lldiv; */
+    using ::rand;
+    using ::srand;
+    using ::qsort;
+    /* using ::bsearch; */
+    /* using ::abs; */
+    /* using ::labs; */
+    /* using ::llabs; */
+    /* using ::div; */
+    /* using ::ldiv; */
+    /* using ::lldiv; */
 }
 
-/* using std::hel::div_t; */
-/* using std::hel::ldiv_t; */
-/* using std::hel::lldiv_t; */
-using std::hel::size_t;
-
-using std::hel::abort;
-using std::hel::exit;
-/* using std::hel::quick_exit; */
-/* using std::hel::_Exit; */
-using std::hel::atexit;
-/* using std::hel::at_quick_exit; */
-/* using std::hel::system; */
-/* using std::hel::getenv; */
-
-using std::hel::malloc;
-using std::hel::calloc;
-using std::hel::realloc;
-using std::hel::free;
-
-/* using std::hel::atof; */
-/* using std::hel::atoi; */
-/* using std::hel::atol; */
-/* using std::hel::atoll; */
-/* using std::hel::strtol; */
-/* using std::hel::strtoll; */
-/* using std::hel::strtoul; */
-/* using std::hel::strtoull; */
-/* using std::hel::strtof; */
-/* using std::hel::strtod; */
-/* using std::hel::strtold; */
-
-/* using std::hel::mblen; */
-/* using std::hel::mbtowc; */
-/* using std::hel::wctomb; */
-/* using std::hel::mbstowcs; */
-/* using std::hel::wcstombs; */
-
-using std::hel::rand;
-using std::hel::srand;
-using std::hel::qsort;
-/* using std::hel::bsearch; */
-/* using std::hel::abs; */
-/* using std::hel::labs; */
-/* using std::hel::llabs; */
-/* using std::hel::div; */
-/* using std::hel::ldiv; */
-/* using std::hel::lldiv; */
-
 #endif
Index: uspace/lib/cpp/include/cstring
===================================================================
--- uspace/lib/cpp/include/cstring	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cstring	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,70 +30,37 @@
 #define LIBCPP_CSTRING
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <str.h>
-    }
-}
+#define _REALLY_WANT_STRING_H
+#include <string.h>
 
 namespace std
 {
-    using std::hel::size_t;
+    using ::size_t;
 
-    /* using std::hel::strcpy; */
-    /* using std::hel::strncpy; */
-    /* using std::hel::strcat; */
-    /* using std::hel::strncat; */
-    /* using std::hel::strxfrm; */
+    using ::strcpy;
+    using ::strncpy;
+    using ::strcat;
+    using ::strncat;
+    using ::strxfrm;
 
-    /* using std::hel::strlen; */
-    /* using std::hel::strcmp; */
-    /* using std::hel::strncmp; */
-    /* using std::hel::strcoll; */
-    /* using std::hel::strchr; */
-    /* using std::hel::strrchr; */
-    /* using std::hel::strspn; */
-    /* using std::hel::strcspn; */
-    /* using std::hel::strpbrk; */
-    /* using std::hel::strstr; */
-    /* using std::hel::strok; */
+    using ::strlen;
+    using ::strcmp;
+    using ::strncmp;
+    using ::strcoll;
+    using ::strchr;
+    using ::strrchr;
+    using ::strspn;
+    using ::strcspn;
+    using ::strpbrk;
+    using ::strstr;
+    using ::strtok;
 
-    /* using std::hel::memchr; */
-    using std::hel::memcmp;
-    using std::hel::memset;
-    using std::hel::memcpy;
-    using std::hel::memmove;
+    using ::memchr;
+    using ::memcmp;
+    using ::memset;
+    using ::memcpy;
+    using ::memmove;
 
-    /* using std::hel::strerror; */
+    using ::strerror;
 }
 
-using std::hel::size_t;
-
-/* using std::hel::strcpy; */
-/* using std::hel::strncpy; */
-/* using std::hel::strcat; */
-/* using std::hel::strncat; */
-/* using std::hel::strxfrm; */
-
-/* using std::hel::strlen; */
-/* using std::hel::strcmp; */
-/* using std::hel::strncmp; */
-/* using std::hel::strcoll; */
-/* using std::hel::strchr; */
-/* using std::hel::strrchr; */
-/* using std::hel::strspn; */
-/* using std::hel::strcspn; */
-/* using std::hel::strpbrk; */
-/* using std::hel::strstr; */
-/* using std::hel::strok; */
-
-/* using std::hel::memchr; */
-using std::hel::memcmp;
-using std::hel::memset;
-using std::hel::memcpy;
-using std::hel::memmove;
-
-/* using std::hel::strerror; */
-
 #endif
Index: uspace/lib/cpp/include/ctime
===================================================================
--- uspace/lib/cpp/include/ctime	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/ctime	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,50 +30,26 @@
 #define LIBCPP_CTIME
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <time.h>
-    }
-}
+#include <time.h>
 
 namespace std
 {
-    /* using std::hel::clock_t; */
-    using std::hel::size_t;
-    using std::hel::time_t;
-    using std::hel::tm;
-    /* using std::hel::timespec; */
+    using ::clock_t;
+    using ::size_t;
+    using ::time_t;
+    using ::tm;
+    using ::timespec;
 
-    /* using std::hel::clock; */
-    using std::hel::time;
-    using std::hel::difftime;
+    using ::clock;
+    using ::time;
+    using ::difftime;
 
-    /* using std::hel::ctime; */
-    /* using std::hel::asctime; */
-    using std::hel::strftime;
-    /* using std::hel::wcsftime; */
-    /* using std::hel::gmtime; */
-    /* using std::hel::localtime; */
-    using std::hel::mktime;
+    using ::ctime;
+    using ::asctime;
+    using ::strftime;
+    /* using ::wcsftime; */
+    /* using ::gmtime; */
+    /* using ::localtime; */
+    using ::mktime;
 }
 
-/* using std::hel::clock_t; */
-using std::hel::size_t;
-using std::hel::time_t;
-using std::hel::tm;
-/* using std::hel::timespec; */
-
-/* using std::hel::clock; */
-using std::hel::time;
-using std::hel::difftime;
-
-/* using std::hel::ctime; */
-/* using std::hel::asctime; */
-using std::hel::strftime;
-/* using std::hel::wcsftime; */
-/* using std::hel::gmtime; */
-/* using std::hel::localtime; */
-using std::hel::mktime;
-
 #endif
Index: uspace/lib/cpp/include/cwchar
===================================================================
--- uspace/lib/cpp/include/cwchar	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/include/cwchar	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -30,149 +30,76 @@
 #define LIBCPP_WCHAR
 
-
-namespace std::hel
-{
-    extern "C" {
-        #include <wchar.h>
-        #include <time.h>
-    }
-}
+#include <wchar.h>
+#include <time.h>
 
 namespace std
 {
-    /* using std::hel::mbstate_t; */
-    using std::hel::size_t;
-    using std::hel::wint_t;
-    using std::hel::tm;
+    /* using ::mbstate_t; */
+    using ::size_t;
+    using ::wint_t;
+    using ::tm;
 
-    /* using std::hel::wcscpy; */
-    /* using std::hel::wcsncpy; */
-    /* using std::hel::wcscat; */
-    /* using std::hel::wcsncat; */
-    /* using std::hel::wcsnxfrm; */
+    /* using ::wcscpy; */
+    /* using ::wcsncpy; */
+    /* using ::wcscat; */
+    /* using ::wcsncat; */
+    /* using ::wcsnxfrm; */
 
-    /* using std::hel::wcslen; */
-    /* using std::hel::wcscmp; */
-    /* using std::hel::wcsncmp; */
-    /* using std::hel::wcscoll; */
-    /* using std::hel::wcschr; */
-    /* using std::hel::wcsrchr; */
-    /* using std::hel::wcsspn; */
-    /* using std::hel::wcscspn; */
-    /* using std::hel::wcspbrk; */
-    /* using std::hel::wcsstr; */
-    /* using std::hel::wcstok; */
+    /* using ::wcslen; */
+    /* using ::wcscmp; */
+    /* using ::wcsncmp; */
+    /* using ::wcscoll; */
+    /* using ::wcschr; */
+    /* using ::wcsrchr; */
+    /* using ::wcsspn; */
+    /* using ::wcscspn; */
+    /* using ::wcspbrk; */
+    /* using ::wcsstr; */
+    /* using ::wcstok; */
 
-    /* using std::hel::wmemcpy; */
-    /* using std::hel::wmemmove; */
-    /* using std::hel::wmemcmp; */
-    /* using std::hel::wmemchr; */
-    /* using std::hel::wmemset; */
+    /* using ::wmemcpy; */
+    /* using ::wmemmove; */
+    /* using ::wmemcmp; */
+    /* using ::wmemchr; */
+    /* using ::wmemset; */
 
-    /* using std::hel::msbinit; */
-    /* using std::hel::btowc; */
-    /* using std::hel::wctob; */
-    /* using std::hel::mbrlen; */
-    /* using std::hel::mbrtowc; */
-    /* using std::hel::wctomb; */
-    /* using std::hel::mbsrtowcs; */
-    /* using std::hel::wcsrtombs; */
+    /* using ::msbinit; */
+    /* using ::btowc; */
+    /* using ::wctob; */
+    /* using ::mbrlen; */
+    /* using ::mbrtowc; */
+    /* using ::wctomb; */
+    /* using ::mbsrtowcs; */
+    /* using ::wcsrtombs; */
 
-    /* using std::hel::fgetwc; */
-    /* using std::hel::getwc; */
-    /* using std::hel::fgetws; */
-    /* using std::hel::fputwc; */
-    /* using std::hel::putwc; */
-    /* using std::hel::fputws; */
-    /* using std::hel::getwchar; */
-    /* using std::hel::putwchar; */
-    /* using std::hel::ungetwc; */
-    /* using std::hel::fwide; */
-    /* using std::hel::wscanf; */
-    /* using std::hel::fwscanf; */
-    /* using std::hel::swscanf; */
-    /* using std::hel::vwscanf; */
-    /* using std::hel::vfwscanf; */
-    /* using std::hel::vswscanf; */
-    /* using std::hel::wprintf; */
-    /* using std::hel::fwprintf; */
-    /* using std::hel::swprintf; */
+    /* using ::fgetwc; */
+    /* using ::getwc; */
+    /* using ::fgetws; */
+    /* using ::fputwc; */
+    /* using ::putwc; */
+    /* using ::fputws; */
+    /* using ::getwchar; */
+    /* using ::putwchar; */
+    /* using ::ungetwc; */
+    /* using ::fwide; */
+    /* using ::wscanf; */
+    /* using ::fwscanf; */
+    /* using ::swscanf; */
+    /* using ::vwscanf; */
+    /* using ::vfwscanf; */
+    /* using ::vswscanf; */
+    /* using ::wprintf; */
+    /* using ::fwprintf; */
+    /* using ::swprintf; */
 
-    /* using std::hel::wcsftime; */
-    /* using std::hel::wcstol; */
-    /* using std::hel::wcstoll; */
-    /* using std::hel::wcstoul; */
-    /* using std::hel::wcstoull; */
-    /* using std::hel::wcstof; */
-    /* using std::hel::wcstod; */
-    /* using std::hel::wcstold; */
+    /* using ::wcsftime; */
+    /* using ::wcstol; */
+    /* using ::wcstoll; */
+    /* using ::wcstoul; */
+    /* using ::wcstoull; */
+    /* using ::wcstof; */
+    /* using ::wcstod; */
+    /* using ::wcstold; */
 }
 
-/* using std::hel::mbstate_t; */
-using std::hel::size_t;
-using std::hel::wint_t;
-using std::hel::tm;
-
-/* using std::hel::wcscpy; */
-/* using std::hel::wcsncpy; */
-/* using std::hel::wcscat; */
-/* using std::hel::wcsncat; */
-/* using std::hel::wcsnxfrm; */
-
-/* using std::hel::wcslen; */
-/* using std::hel::wcscmp; */
-/* using std::hel::wcsncmp; */
-/* using std::hel::wcscoll; */
-/* using std::hel::wcschr; */
-/* using std::hel::wcsrchr; */
-/* using std::hel::wcsspn; */
-/* using std::hel::wcscspn; */
-/* using std::hel::wcspbrk; */
-/* using std::hel::wcsstr; */
-/* using std::hel::wcstok; */
-
-/* using std::hel::wmemcpy; */
-/* using std::hel::wmemmove; */
-/* using std::hel::wmemcmp; */
-/* using std::hel::wmemchr; */
-/* using std::hel::wmemset; */
-
-/* using std::hel::msbinit; */
-/* using std::hel::btowc; */
-/* using std::hel::wctob; */
-/* using std::hel::mbrlen; */
-/* using std::hel::mbrtowc; */
-/* using std::hel::wctomb; */
-/* using std::hel::mbsrtowcs; */
-/* using std::hel::wcsrtombs; */
-
-/* using std::hel::fgetwc; */
-/* using std::hel::getwc; */
-/* using std::hel::fgetws; */
-/* using std::hel::fputwc; */
-/* using std::hel::putwc; */
-/* using std::hel::fputws; */
-/* using std::hel::getwchar; */
-/* using std::hel::putwchar; */
-/* using std::hel::ungetwc; */
-/* using std::hel::fwide; */
-/* using std::hel::wscanf; */
-/* using std::hel::fwscanf; */
-/* using std::hel::swscanf; */
-/* using std::hel::vwscanf; */
-/* using std::hel::vfwscanf; */
-/* using std::hel::vswscanf; */
-/* using std::hel::wprintf; */
-/* using std::hel::fwprintf; */
-/* using std::hel::swprintf; */
-
-/* using std::hel::wcsftime; */
-/* using std::hel::wcstol; */
-/* using std::hel::wcstoll; */
-/* using std::hel::wcstoul; */
-/* using std::hel::wcstoull; */
-/* using std::hel::wcstof; */
-/* using std::hel::wcstod; */
-/* using std::hel::wcstold; */
-
 #endif
Index: uspace/lib/cpp/src/stdexcept.cpp
===================================================================
--- uspace/lib/cpp/src/stdexcept.cpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/src/stdexcept.cpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -31,17 +31,18 @@
 #include <stdexcept>
 #include <string>
+#include <str.h>
 
 namespace std
 {
     logic_error::logic_error(const string& what)
-        : what_{hel::str_dup(what.c_str())}
+        : what_{::helenos::str_dup(what.c_str())}
     { /* DUMMY BODY */ }
 
     logic_error::logic_error(const char* what)
-        : what_{hel::str_dup(what)}
+        : what_{::helenos::str_dup(what)}
     { /* DUMMY BODY */ }
 
     logic_error::logic_error(const logic_error& other) noexcept
-        : exception{other}, what_{hel::str_dup(other.what_)}
+        : exception{other}, what_{::helenos::str_dup(other.what_)}
     { /* DUMMY BODY */ }
 
@@ -50,5 +51,5 @@
         if (what_)
             free(what_);
-        what_ = hel::str_dup(other.what_);
+        what_ = ::helenos::str_dup(other.what_);
 
         return *this;
@@ -114,13 +115,13 @@
 
     runtime_error::runtime_error(const string& what)
-        : what_{hel::str_dup(what.c_str())}
+        : what_{::helenos::str_dup(what.c_str())}
     { /* DUMMY BODY */ }
 
     runtime_error::runtime_error(const char* what)
-        : what_{hel::str_dup(what)}
+        : what_{::helenos::str_dup(what)}
     { /* DUMMY BODY */ }
 
     runtime_error::runtime_error(const runtime_error& other) noexcept
-        : exception{other}, what_{hel::str_dup(other.what_)}
+        : exception{other}, what_{::helenos::str_dup(other.what_)}
     { /* DUMMY BODY */ }
 
@@ -129,5 +130,5 @@
         if (what_)
             free(what_);
-        what_ = hel::str_dup(other.what_);
+        what_ = ::helenos::str_dup(other.what_);
 
         return *this;
Index: uspace/lib/cpp/src/string.cpp
===================================================================
--- uspace/lib/cpp/src/string.cpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/src/string.cpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -42,5 +42,5 @@
     {
         char* end;
-        long result = hel::strtol(str.c_str(), &end, base);
+        long result = ::strtol(str.c_str(), &end, base);
 
         if (end != str.c_str())
@@ -58,5 +58,5 @@
     {
         char* end;
-        unsigned long result = hel::strtoul(str.c_str(), &end, base);
+        unsigned long result = ::strtoul(str.c_str(), &end, base);
 
         if (end != str.c_str())
@@ -106,13 +106,8 @@
     }
 
-    namespace hel
-    {
-        extern "C" int asprintf(char**, const char*, ...);
-    }
-
     string to_string(int val)
     {
         char* tmp;
-        hel::asprintf(&tmp, "%d", val);
+        ::asprintf(&tmp, "%d", val);
 
         std::string res{tmp};
@@ -125,5 +120,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%u", val);
+        ::asprintf(&tmp, "%u", val);
 
         std::string res{tmp};
@@ -136,5 +131,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%ld", val);
+        ::asprintf(&tmp, "%ld", val);
 
         std::string res{tmp};
@@ -147,5 +142,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%lu", val);
+        ::asprintf(&tmp, "%lu", val);
 
         std::string res{tmp};
@@ -158,5 +153,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%lld", val);
+        ::asprintf(&tmp, "%lld", val);
 
         std::string res{tmp};
@@ -169,5 +164,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%llu", val);
+        ::asprintf(&tmp, "%llu", val);
 
         std::string res{tmp};
@@ -180,5 +175,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%f", val);
+        ::asprintf(&tmp, "%f", val);
 
         std::string res{tmp};
@@ -191,5 +186,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%f", val);
+        ::asprintf(&tmp, "%f", val);
 
         std::string res{tmp};
@@ -202,5 +197,5 @@
     {
         char* tmp;
-        hel::asprintf(&tmp, "%Lf", val);
+        ::asprintf(&tmp, "%Lf", val);
 
         std::string res{tmp};
Index: uspace/lib/cpp/src/typeinfo.cpp
===================================================================
--- uspace/lib/cpp/src/typeinfo.cpp	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/cpp/src/typeinfo.cpp	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -38,6 +38,5 @@
     bool type_info::operator==(const type_info& other) const noexcept
     {
-        return (this == &other) ||
-               std::hel::str_cmp(name(), other.name());
+        return (this == &other) || ::strcmp(name(), other.name()) == 0;
     }
 
Index: uspace/lib/pcm/src/format.c
===================================================================
--- uspace/lib/pcm/src/format.c	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/pcm/src/format.c	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -40,4 +40,5 @@
 #include <stdio.h>
 #include <inttypes.h>
+#include <limits.h>
 
 #include "format.h"
Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/Makefile	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,4 +41,5 @@
 	../hound/libhound.a \
 	../pcm/libpcm.a \
+	../cpp/libcpp.a \
 	$(LIBC_PREFIX)/libc.a \
 	$(LIBC_PREFIX)/crt0.o \
@@ -96,4 +97,7 @@
 	$(COMMON_CFLAGS)
 
+EXPORT_CXXFLAGS = \
+	$(COMMON_CXXFLAGS)
+
 include $(USPACE_PREFIX)/Makefile.common
 
@@ -109,5 +113,5 @@
 	echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
 	echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
-	echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
+	echo 'HELENOS_CXXFLAGS="$(EXPORT_CXXFLAGS)"' >> $@.new
 	echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
 	echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
@@ -146,3 +150,5 @@
 	mkdir -p $(EXPORT_DIR)/include.new/libpcm
 	cp -r -L -t $(EXPORT_DIR)/include.new/libpcm ../pcm/include/*
+	mkdir -p $(EXPORT_DIR)/include.new/libcpp
+	cp -r -L -t $(EXPORT_DIR)/include.new/libcpp ../cpp/include/*
 	mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
Index: uspace/lib/posix/include/posix/ctype.h
===================================================================
--- uspace/lib/posix/include/posix/ctype.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/ctype.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -39,4 +39,6 @@
 #include <libc/ctype.h>
 
+__C_DECLS_BEGIN;
+
 /* Obsolete Functions and Macros */
 extern int isascii(int c);
@@ -46,4 +48,6 @@
 #define _toupper(c) ((c) - 'a' + 'A')
 
+__C_DECLS_END;
+
 #endif /* POSIX_CTYPE_H_ */
 
Index: uspace/lib/posix/include/posix/dlfcn.h
===================================================================
--- uspace/lib/posix/include/posix/dlfcn.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/dlfcn.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,8 +41,12 @@
 #define RTLD_LOCAL 0
 
+__C_DECLS_BEGIN;
+
 extern void *dlopen(const char *, int);
 extern void *dlsym(void *, const char *);
 extern int dlclose(void *);
 extern char *dlerror(void);
+
+__C_DECLS_END;
 
 #endif
Index: uspace/lib/posix/include/posix/fcntl.h
===================================================================
--- uspace/lib/posix/include/posix/fcntl.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/fcntl.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -38,11 +38,4 @@
 #include <sys/types.h>
 
-#undef O_CREAT
-#undef O_EXCL
-#undef O_TRUNC
-#undef O_APPEND
-#undef O_RDONLY
-#undef O_RDWR
-#undef O_WRONLY
 #define O_CREAT   1
 #define O_EXCL    2
@@ -54,23 +47,10 @@
 
 /* Mask for file access modes. */
-#undef O_ACCMODE
 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
 
 /* Dummy compatibility flag */
-#undef O_NOCTTY
 #define O_NOCTTY 0
 
 /* fcntl commands */
-#undef F_DUPFD
-#undef F_DUPFD_CLOEXEC
-#undef F_GETFD
-#undef F_SETFD
-#undef F_GETFL
-#undef F_SETFL
-#undef F_GETOWN
-#undef F_SETOWN
-#undef F_GETLK
-#undef F_SETLK
-#undef F_SETLKW
 #define F_DUPFD            0 /* Duplicate file descriptor. */
 #define F_DUPFD_CLOEXEC    1 /* Same as F_DUPFD but with FD_CLOEXEC flag set. */
@@ -86,9 +66,12 @@
 
 /* File descriptor flags used with F_GETFD and F_SETFD. */
-#undef FD_CLOEXEC
 #define FD_CLOEXEC         1 /* Close on exec. */
+
+__C_DECLS_BEGIN;
 
 extern int open(const char *pathname, int flags, ...);
 extern int fcntl(int fd, int cmd, ...);
+
+__C_DECLS_END;
 
 #endif /* POSIX_FCNTL_H_ */
Index: uspace/lib/posix/include/posix/fnmatch.h
===================================================================
--- uspace/lib/posix/include/posix/fnmatch.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/fnmatch.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -36,12 +36,10 @@
 #define POSIX_FNMATCH_H_
 
+#include <_bits/decls.h>
+
 /* Error Values */
-#undef FNM_NOMATCH
 #define FNM_NOMATCH 1
 
 /* Flags */
-#undef FNM_PATHNAME
-#undef FNM_PERIOD
-#undef FNM_NOESCAPE
 #define FNM_PATHNAME 1
 #define FNM_PERIOD 2
@@ -49,12 +47,13 @@
 
 /* GNU Extensions */
-#undef FNM_FILE_NAME
-#undef FNM_LEADING_DIR
-#undef FNM_CASEFOLD
 #define FNM_FILE_NAME FNM_PATHNAME
 #define FNM_LEADING_DIR 8
 #define FNM_CASEFOLD 16
 
+__C_DECLS_BEGIN;
+
 extern int fnmatch(const char *pattern, const char *string, int flags);
+
+__C_DECLS_END;
 
 #endif /* POSIX_FNMATCH_H_ */
Index: uspace/lib/posix/include/posix/locale.h
===================================================================
--- uspace/lib/posix/include/posix/locale.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/locale.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,17 +37,6 @@
 
 #include <stddef.h>
+#include <_bits/decls.h>
 
-#ifndef __locale_t_defined
-#define __locale_t_defined
-typedef struct __posix_locale *locale_t;
-#endif
-
-#undef LC_ALL
-#undef LC_COLLATE
-#undef LC_CTYPE
-#undef LC_MESSAGES
-#undef LC_MONETARY
-#undef LC_NUMERIC
-#undef LC_TIME
 #define LC_ALL 0
 #define LC_COLLATE 1
@@ -58,11 +47,4 @@
 #define LC_TIME 6
 
-#undef LC_COLLATE_MASK
-#undef LC_CTYPE_MASK
-#undef LC_MESSAGES_MASK
-#undef LC_MONETARY_MASK
-#undef LC_NUMERIC_MASK
-#undef LC_TIME_MASK
-#undef LC_ALL_MASK
 #define LC_COLLATE_MASK (1 << 0)
 #define LC_CTYPE_MASK (1 << 1)
@@ -74,6 +56,12 @@
     LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
 
-#undef LC_GLOBAL_LOCALE
 #define LC_GLOBAL_LOCALE NULL
+
+__C_DECLS_BEGIN;
+
+#ifndef __locale_t_defined
+#define __locale_t_defined
+typedef struct __posix_locale *locale_t;
+#endif
 
 struct lconv {
@@ -114,4 +102,6 @@
 extern locale_t uselocale(locale_t newloc);
 
+__C_DECLS_END;
+
 #endif /* POSIX_LOCALE_H_ */
 
Index: uspace/lib/posix/include/posix/pthread.h
===================================================================
--- uspace/lib/posix/include/posix/pthread.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/pthread.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -34,4 +34,13 @@
 
 #include <time.h>
+#include <_bits/decls.h>
+
+#define PTHREAD_MUTEX_RECURSIVE 1
+
+#define PTHREAD_MUTEX_INITIALIZER { 0 }
+
+#define PTHREAD_COND_INITIALIZER { 0 }
+
+__C_DECLS_BEGIN;
 
 typedef void *pthread_t;
@@ -43,11 +52,7 @@
 typedef int pthread_key_t;
 
-#define PTHREAD_MUTEX_RECURSIVE 1
-
 typedef struct pthread_mutex {
 	int dummy;
 } pthread_mutex_t;
-
-#define PTHREAD_MUTEX_INITIALIZER { 0 }
 
 typedef struct {
@@ -62,6 +67,4 @@
 	int dummy;
 } pthread_cond_t;
-
-#define PTHREAD_COND_INITIALIZER { 0 }
 
 extern pthread_t pthread_self(void);
@@ -106,4 +109,6 @@
 extern int pthread_key_create(pthread_key_t *, void (*)(void *));
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/posix/include/posix/pwd.h
===================================================================
--- uspace/lib/posix/include/posix/pwd.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/pwd.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,4 +37,7 @@
 
 #include <sys/types.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 struct passwd {
@@ -58,4 +61,6 @@
     char *buffer, size_t bufsize, struct passwd **result);
 
+__C_DECLS_END;
+
 #endif /* POSIX_PWD_H_ */
 
Index: uspace/lib/posix/include/posix/signal.h
===================================================================
--- uspace/lib/posix/include/posix/signal.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/signal.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -39,67 +39,21 @@
 #include <ucontext.h>
 
-extern void __posix_default_signal_handler(int signo);
-extern void __posix_hold_signal_handler(int signo);
-extern void __posix_ignore_signal_handler(int signo);
-
-#undef SIG_DFL
 #define SIG_DFL ((void (*)(int)) __posix_default_signal_handler)
-#undef SIG_ERR
 #define SIG_ERR ((void (*)(int)) NULL)
-#undef SIG_HOLD
 #define SIG_HOLD ((void (*)(int)) __posix_hold_signal_handler)
-#undef SIG_IGN
 #define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
 
-typedef struct {
-	int si_signo;
-	int si_code;
-
-	int si_errno;
-
-	pid_t si_pid;
-	uid_t si_uid;
-	void *si_addr;
-	int si_status;
-
-	long si_band;
-
-	union sigval si_value;
-} siginfo_t;
-
-struct sigaction {
-	void (*sa_handler)(int);
-	sigset_t sa_mask;
-	int sa_flags;
-	void (*sa_sigaction)(int, siginfo_t *, void *);
-};
-
 /* Values of sigevent::sigev_notify */
-#undef SIGEV_NONE
-#undef SIGEV_SIGNAL
-#undef SIGEV_THREAD
 #define SIGEV_NONE 0
 #define SIGEV_SIGNAL 0
 #define SIGEV_THREAD 0
 
-#undef SIGRT_MIN
-#undef SIGRT_MAX
 #define SIGRT_MIN 0
 #define SIGRT_MAX 0
 
-#undef SIG_BLOCK
-#undef SIG_UNBLOCK
-#undef SIG_SETMASK
 #define SIG_BLOCK 0
 #define SIG_UNBLOCK 1
 #define SIG_SETMASK 2
 
-#undef SA_NOCLDSTOP
-#undef SA_ONSTACK
-#undef SA_RESETHAND
-#undef SA_RESTART
-#undef SA_SIGINFO
-#undef SA_NOCLDWAIT
-#undef SA_NODEFER
 #define SA_NOCLDSTOP (1 << 0)
 #define SA_ONSTACK (1 << 1)
@@ -110,13 +64,38 @@
 #define SA_NODEFER (1 << 6)
 
-#undef SS_ONSTACK
-#undef SS_DISABLE
 #define SS_ONSTACK 0
 #define SS_DISABLE 0
 
-#undef MINSIGSTKSZ
-#undef SIGSTKSZ
 #define MINSIGSTKSZ 0
 #define SIGSTKSZ 0
+
+__C_DECLS_BEGIN;
+
+extern void __posix_default_signal_handler(int signo);
+extern void __posix_hold_signal_handler(int signo);
+extern void __posix_ignore_signal_handler(int signo);
+
+typedef struct {
+	int si_signo;
+	int si_code;
+
+	int si_errno;
+
+	pid_t si_pid;
+	uid_t si_uid;
+	void *si_addr;
+	int si_status;
+
+	long si_band;
+
+	union sigval si_value;
+} siginfo_t;
+
+struct sigaction {
+	void (*sa_handler)(int);
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_sigaction)(int, siginfo_t *, void *);
+};
 
 /* Full POSIX set */
@@ -245,4 +224,6 @@
     sigset_t *__restrict__ oset);
 
+__C_DECLS_END;
+
 #endif /* POSIX_SIGNAL_H_ */
 
Index: uspace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/stdio.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -45,12 +45,14 @@
 #include <limits.h>
 
+#define P_tmpdir "/tmp"
+
+#define L_ctermid PATH_MAX
+
+__C_DECLS_BEGIN;
+
 extern FILE *fdopen(int, const char *);
 extern int fileno(FILE *);
 
-#define P_tmpdir "/tmp"
-
 /* Identifying the Terminal */
-#undef L_ctermid
-#define L_ctermid PATH_MAX
 extern char *ctermid(char *s);
 
@@ -98,4 +100,6 @@
 extern char *tempnam(const char *dir, const char *pfx);
 
+__C_DECLS_END;
+
 #endif /* POSIX_STDIO_H_ */
 
Index: uspace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/stdlib.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -42,4 +42,6 @@
 #include <stddef.h>
 
+__C_DECLS_BEGIN;
+
 /* Environment Access */
 extern int putenv(char *string);
@@ -60,4 +62,6 @@
 extern int bsd_getloadavg(double loadavg[], int nelem);
 
+__C_DECLS_END;
+
 #endif  // POSIX_STDLIB_H_
 
Index: uspace/lib/posix/include/posix/string.h
===================================================================
--- uspace/lib/posix/include/posix/string.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/string.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -47,11 +47,9 @@
 
 #include <libc/mem.h>
-#ifdef _HELENOS_SOURCE
-#undef _HELENOS_SOURCE
+
+#define _REALLY_WANT_STRING_H
 #include <libc/string.h>
-#define _HELENOS_SOURCE
-#else
-#include <libc/string.h>
-#endif
+
+__C_DECLS_BEGIN;
 
 /* Copying and Concatenation */
@@ -73,9 +71,9 @@
 
 /* Legacy Declarations */
-#ifndef POSIX_STRINGS_H_
 extern int ffs(int i);
 extern int strcasecmp(const char *s1, const char *s2);
 extern int strncasecmp(const char *s1, const char *s2, size_t n);
-#endif
+
+__C_DECLS_END;
 
 #endif  // POSIX_STRING_H_
Index: uspace/lib/posix/include/posix/strings.h
===================================================================
--- uspace/lib/posix/include/posix/strings.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/strings.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -39,14 +39,12 @@
 #include <types/common.h>
 
+__C_DECLS_BEGIN;
+
 /* Search Functions */
-#ifndef POSIX_STRING_H_
 extern int ffs(int i);
-#endif
 
 /* String/Array Comparison */
-#ifndef POSIX_STRING_H_
 extern int strcasecmp(const char *s1, const char *s2);
 extern int strncasecmp(const char *s1, const char *s2, size_t n);
-#endif
 
 /*
@@ -64,4 +62,6 @@
 extern char *rindex(const char *s, int c);
 
+__C_DECLS_END;
+
 #endif  // POSIX_STRINGS_H_
 
Index: uspace/lib/posix/include/posix/sys/mman.h
===================================================================
--- uspace/lib/posix/include/posix/sys/mman.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/sys/mman.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,7 +37,7 @@
 
 #include <sys/types.h>
-#include <abi/mm/as.h>
+#include <_bits/decls.h>
 
-#define MAP_FAILED ((void *) -1)
+#define MAP_FAILED  ((void *) -1)
 
 #define MAP_SHARED     (1 << 0)
@@ -45,14 +45,12 @@
 #define MAP_FIXED      (1 << 2)
 #define MAP_ANONYMOUS  (1 << 3)
-#define MAP_ANON MAP_ANONYMOUS
+#define MAP_ANON       MAP_ANONYMOUS
 
-#undef PROT_NONE
-#undef PROT_READ
-#undef PROT_WRITE
-#undef PROT_EXEC
-#define PROT_NONE  0
-#define PROT_READ  AS_AREA_READ
-#define PROT_WRITE AS_AREA_WRITE
-#define PROT_EXEC  AS_AREA_EXEC
+#define PROT_NONE   0
+#define PROT_READ   1
+#define PROT_WRITE  2
+#define PROT_EXEC   4
+
+__C_DECLS_BEGIN;
 
 extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
@@ -60,4 +58,6 @@
 extern int munmap(void *start, size_t length);
 
+__C_DECLS_END;
+
 #endif /* POSIX_SYS_MMAN_H_ */
 
Index: uspace/lib/posix/include/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/include/posix/sys/stat.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/sys/stat.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -39,15 +39,8 @@
 #include <sys/types.h>
 #include <time.h>
+#include <_bits/decls.h>
 
 /* values are the same as on Linux */
 
-#undef S_IFMT
-#undef S_IFSOCK
-#undef S_IFLNK
-#undef S_IFREG
-#undef S_IFBLK
-#undef S_IFDIR
-#undef S_IFCHR
-#undef S_IFIFO
 #define S_IFMT     0170000   /* all file types */
 #define S_IFSOCK   0140000   /* socket */
@@ -59,15 +52,8 @@
 #define S_IFIFO    0010000   /* FIFO */
 
-#undef S_ISUID
-#undef S_ISGID
-#undef S_ISVTX
 #define S_ISUID    0004000   /* SUID */
 #define S_ISGID    0002000   /* SGID */
 #define S_ISVTX    0001000   /* sticky */
 
-#undef S_IRWXU
-#undef S_IRUSR
-#undef S_IWUSR
-#undef S_IXUSR
 #define S_IRWXU    00700     /* owner permissions */
 #define S_IRUSR    00400
@@ -75,8 +61,4 @@
 #define S_IXUSR    00100
 
-#undef S_IRWXG
-#undef S_IRGRP
-#undef S_IWGRP
-#undef S_IXGRP
 #define S_IRWXG    00070     /* group permissions */
 #define S_IRGRP    00040
@@ -84,8 +66,4 @@
 #define S_IXGRP    00010
 
-#undef S_IRWXO
-#undef S_IROTH
-#undef S_IWOTH
-#undef S_IXOTH
 #define S_IRWXO    00007     /* other permissions */
 #define S_IROTH    00004
@@ -93,11 +71,4 @@
 #define S_IXOTH    00001
 
-#undef S_ISREG
-#undef S_ISDIR
-#undef S_ISCHR
-#undef S_ISBLK
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISSOCK
 #define S_ISREG(m) ((m & S_IFREG) != 0)
 #define S_ISDIR(m) ((m & S_IFDIR) != 0)
@@ -107,4 +78,6 @@
 #define S_ISLNK(m) ((m & S_IFLNK) != 0) /* symbolic link? (Not in POSIX.1-1996.) */
 #define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
+
+__C_DECLS_BEGIN;
 
 struct stat {
@@ -131,4 +104,6 @@
 extern int mkdir(const char *path, mode_t mode);
 
+__C_DECLS_END;
+
 #endif /* POSIX_SYS_STAT_H */
 
Index: uspace/lib/posix/include/posix/sys/time.h
===================================================================
--- uspace/lib/posix/include/posix/sys/time.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/sys/time.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -35,4 +35,7 @@
 
 #include <time.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 struct timeval {
@@ -43,4 +46,6 @@
 extern int gettimeofday(struct timeval *, void *);
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/posix/include/posix/sys/types.h
===================================================================
--- uspace/lib/posix/include/posix/sys/types.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/sys/types.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,5 +37,10 @@
 #define POSIX_SYS_TYPES_H_
 
-#include <types/common.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <_bits/ssize_t.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 typedef unsigned int ino_t;
@@ -46,5 +51,5 @@
 typedef long blkcnt_t;
 typedef int pid_t;
-typedef sysarg_t dev_t;
+typedef unsigned long dev_t;
 typedef unsigned int mode_t;
 
@@ -67,4 +72,6 @@
 typedef long suseconds_t;
 
+__C_DECLS_END;
+
 #endif /* POSIX_SYS_TYPES_H_ */
 
Index: uspace/lib/posix/include/posix/sys/wait.h
===================================================================
--- uspace/lib/posix/include/posix/sys/wait.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/sys/wait.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,13 +37,12 @@
 
 #include <sys/types.h>
+#include <_bits/decls.h>
 
-#undef WIFEXITED
-#undef WEXITSTATUS
-#undef WIFSIGNALED
-#undef WTERMSIG
 #define WIFEXITED(status) __posix_wifexited(status)
 #define WEXITSTATUS(status) __posix_wexitstatus(status)
 #define WIFSIGNALED(status) __posix_wifsignaled(status)
 #define WTERMSIG(status) __posix_wtermsig(status)
+
+__C_DECLS_BEGIN;
 
 extern int __posix_wifexited(int status);
@@ -55,4 +54,6 @@
 extern pid_t waitpid(pid_t pid, int *stat_ptr, int options);
 
+__C_DECLS_END;
+
 #endif /* POSIX_SYS_WAIT_H_ */
 
Index: uspace/lib/posix/include/posix/time.h
===================================================================
--- uspace/lib/posix/include/posix/time.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/time.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -41,4 +41,10 @@
 #include <libc/time.h>
 
+#define CLOCK_REALTIME ((clockid_t) 0)
+
+#define ASCTIME_BUF_LEN  26
+
+__C_DECLS_BEGIN;
+
 #ifndef __locale_t_defined
 #define __locale_t_defined
@@ -46,12 +52,5 @@
 #endif
 
-#ifndef POSIX_SIGNAL_H_
 struct sigevent;
-#endif
-
-#undef CLOCK_REALTIME
-#define CLOCK_REALTIME ((clockid_t) 0)
-
-#define ASCTIME_BUF_LEN  26
 
 struct itimerspec {
@@ -97,4 +96,6 @@
     const struct timespec *rqtp, struct timespec *rmtp);
 
+__C_DECLS_END;
+
 #endif  // POSIX_TIME_H_
 
Index: uspace/lib/posix/include/posix/ucontext.h
===================================================================
--- uspace/lib/posix/include/posix/ucontext.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/ucontext.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -37,4 +37,7 @@
 
 #include <sys/types.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
 
 typedef int sig_atomic_t;
@@ -71,4 +74,6 @@
 } ucontext_t;
 
+__C_DECLS_END;
+
 #endif
 
Index: uspace/lib/posix/include/posix/unistd.h
===================================================================
--- uspace/lib/posix/include/posix/unistd.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/include/posix/unistd.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -46,4 +46,16 @@
 /* Process Termination */
 #define _exit exit
+
+/* Standard Streams */
+#define STDIN_FILENO (fileno(stdin))
+#define STDOUT_FILENO (fileno(stdout))
+#define STDERR_FILENO (fileno(stderr))
+
+#define	F_OK 0 /* Test for existence. */
+#define	X_OK 1 /* Test for execute permission. */
+#define	W_OK 2 /* Test for write permission. */
+#define	R_OK 4 /* Test for read permission. */
+
+__C_DECLS_BEGIN;
 
 extern char *optarg;
@@ -106,21 +118,5 @@
 #endif
 
-/* Standard Streams */
-#undef STDIN_FILENO
-#define STDIN_FILENO (fileno(stdin))
-#undef STDOUT_FILENO
-#define STDOUT_FILENO (fileno(stdout))
-#undef STDERR_FILENO
-#define STDERR_FILENO (fileno(stderr))
-
 /* File Accessibility */
-#undef F_OK
-#undef X_OK
-#undef W_OK
-#undef R_OK
-#define	F_OK 0 /* Test for existence. */
-#define	X_OK 1 /* Test for execute permission. */
-#define	W_OK 2 /* Test for write permission. */
-#define	R_OK 4 /* Test for read permission. */
 extern int access(const char *path, int amode);
 
@@ -171,4 +167,6 @@
 extern unsigned int alarm(unsigned int);
 
+__C_DECLS_END;
+
 #endif /* POSIX_UNISTD_H_ */
 
Index: uspace/lib/posix/src/internal/common.h
===================================================================
--- uspace/lib/posix/src/internal/common.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/src/internal/common.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -67,4 +67,7 @@
 }
 
+// TODO: Remove this arbitrary limit.
+#define VFS_MAX_OPEN_FILES 128
+
 extern aoff64_t posix_pos[VFS_MAX_OPEN_FILES];
 
Index: uspace/lib/posix/src/sys/mman.c
===================================================================
--- uspace/lib/posix/src/sys/mman.c	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/lib/posix/src/sys/mman.c	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -39,4 +39,20 @@
 #include <unistd.h>
 
+static int _prot_to_as(int prot)
+{
+	int ret = 0;
+
+	if (prot & PROT_READ)
+		ret |= AS_AREA_READ;
+
+	if (prot & PROT_WRITE)
+		ret |= AS_AREA_WRITE;
+
+	if (prot & PROT_EXEC)
+		ret |= AS_AREA_EXEC;
+
+	return ret;
+}
+
 void *mmap(void *start, size_t length, int prot, int flags, int fd,
     off_t offset)
@@ -53,5 +69,5 @@
 		return MAP_FAILED;
 
-	return as_area_create(start, length, prot, AS_AREA_UNPAGED);
+	return as_area_create(start, length, _prot_to_as(prot), AS_AREA_UNPAGED);
 }
 
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ uspace/srv/vfs/vfs.h	(revision bc56f30178279e1e59b8add425abe116ecae93b5)
@@ -49,4 +49,8 @@
 #define dprintf(...)
 #endif
+
+// TODO: Remove this arbitrary limit.
+/** Maximum number of open files per client. */
+#define VFS_MAX_OPEN_FILES  128
 
 /**
