Index: uspace/lib/posix/include/posix/errno.h
===================================================================
--- uspace/lib/posix/include/posix/errno.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/errno.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -66,6 +66,4 @@
 #undef errno
 #define errno (*__posix_errno())
-
-#include "unistd.h"
 
 extern int *__posix_errno(void);
Index: uspace/lib/posix/include/posix/malloc.h
===================================================================
--- uspace/lib/posix/include/posix/malloc.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/include/posix/malloc.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012 Vojtech Horky
+ * 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 libposix
+ * @{
+ */
+#ifndef POSIX_MALLOC_H_
+#define POSIX_MALLOC_H_
+
+/* Empty. Just to satisfy preprocessor. */
+
+#endif /* POSIX_MALLOC_H_ */
+
+/** @}
+ */
Index: uspace/lib/posix/include/posix/signal.h
===================================================================
--- uspace/lib/posix/include/posix/signal.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/signal.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -36,5 +36,4 @@
 #define POSIX_SIGNAL_H_
 
-#include "libc/errno.h"
 #include "sys/types.h"
 
Index: uspace/lib/posix/include/posix/stdarg.h
===================================================================
--- uspace/lib/posix/include/posix/stdarg.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/include/posix/stdarg.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012 Vojtech Horky
+ * 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 libposix
+ * @{
+ */
+
+#ifndef POSIX_STDARG_H_
+#define POSIX_STDARG_H_
+
+typedef __builtin_va_list va_list;
+
+#define va_start(ap, last)  __builtin_va_start(ap, last)
+#define va_arg(ap, type)    __builtin_va_arg(ap, type)
+#define va_end(ap)          __builtin_va_end(ap)
+#define va_copy(dst, src)   __builtin_va_copy(dst, src)
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/posix/include/posix/stddef.h
===================================================================
--- uspace/lib/posix/include/posix/stddef.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/stddef.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -36,5 +36,5 @@
 #define POSIX_STDDEF_H_
 
-#include "libc/stddef.h"
+#include "sys/types.h"
 
 #ifndef NULL
Index: uspace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/stdio.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -41,5 +41,5 @@
 #include "libc/stdio.h"
 #include "sys/types.h"
-#include "libc/stdarg.h"
+#include "stdarg.h"
 #include "limits.h"
 
Index: uspace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/stdlib.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -37,5 +37,5 @@
 #define POSIX_STDLIB_H_
 
-#include "libc/stdlib.h"
+#include "sys/types.h"
 
 #ifndef NULL
@@ -51,4 +51,5 @@
 extern int posix_atexit(void (*func)(void));
 extern void exit(int status);
+extern void abort(void) __attribute__((noreturn));
 
 /* Absolute Value */
Index: uspace/lib/posix/include/posix/sys/mman.h
===================================================================
--- uspace/lib/posix/include/posix/sys/mman.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/sys/mman.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -36,5 +36,13 @@
 #define POSIX_SYS_MMAN_H_
 
-#include "libc/sys/mman.h"
+#include "sys/types.h"
+#include <abi/mm/as.h>
+
+#define MAP_FAILED ((void *) -1)
+
+#define MAP_SHARED     (1 << 0)
+#define MAP_PRIVATE    (1 << 1)
+#define MAP_FIXED      (1 << 2)
+#define MAP_ANONYMOUS  (1 << 3)
 
 #undef PROT_NONE
@@ -43,7 +51,11 @@
 #undef PROT_EXEC
 #define PROT_NONE  0
-#define PROT_READ  PROTO_READ
-#define PROT_WRITE PROTO_WRITE
-#define PROT_EXEC  PROTO_EXEC
+#define PROT_READ  AS_AREA_READ
+#define PROT_WRITE AS_AREA_WRITE
+#define PROT_EXEC  AS_AREA_EXEC
+
+extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
+    posix_off_t offset);
+extern int munmap(void *start, size_t length);
 
 #endif /* POSIX_SYS_MMAN_H_ */
Index: uspace/lib/posix/include/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/include/posix/sys/stat.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/sys/stat.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -37,5 +37,4 @@
 #define POSIX_SYS_STAT_H_
 
-#include "libc/sys/stat.h"
 #include "types.h"
 #include "../time.h"
@@ -130,4 +129,5 @@
 extern int posix_chmod(const char *path, mode_t mode);
 extern mode_t posix_umask(mode_t mask);
+extern int mkdir(const char *, mode_t);
 
 #ifndef LIBPOSIX_INTERNAL
Index: uspace/lib/posix/include/posix/sys/types.h
===================================================================
--- uspace/lib/posix/include/posix/sys/types.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/sys/types.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -38,4 +38,5 @@
 
 #include "libc/sys/types.h"
+#include "libc/sys/time.h"
 
 typedef unsigned int posix_ino_t;
Index: uspace/lib/posix/include/posix/time.h
===================================================================
--- uspace/lib/posix/include/posix/time.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/time.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -37,5 +37,4 @@
 #define POSIX_TIME_H_
 
-#include "libc/time.h"
 #include "sys/types.h"
 
Index: uspace/lib/posix/include/posix/unistd.h
===================================================================
--- uspace/lib/posix/include/posix/unistd.h	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/include/posix/unistd.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -37,6 +37,6 @@
 #define POSIX_UNISTD_H_
 
-#include "libc/unistd.h"
 #include "sys/types.h"
+#include "stddef.h"
 
 /* Process Termination */
Index: uspace/lib/posix/source/fnmatch.c
===================================================================
--- uspace/lib/posix/source/fnmatch.c	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/source/fnmatch.c	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -42,4 +42,6 @@
  */
 
+#define LIBPOSIX_INTERNAL
+
 #include "posix/stdbool.h"
 #include "posix/ctype.h"
@@ -47,6 +49,4 @@
 #include "posix/stdlib.h"
 #include "posix/assert.h"
-
-#define LIBPOSIX_INTERNAL
 
 #include "internal/common.h"
@@ -182,14 +182,14 @@
 	{ "alnum", isalnum },
 	{ "alpha", isalpha },
-	{ "blank", isblank },
-	{ "cntrl", iscntrl },
+	{ "blank", posix_isblank },
+	{ "cntrl", posix_iscntrl },
 	{ "digit", isdigit },
-	{ "graph", isgraph },
+	{ "graph", posix_isgraph },
 	{ "lower", islower },
-	{ "print", isprint },
-	{ "punct", ispunct },
+	{ "print", posix_isprint },
+	{ "punct", posix_ispunct },
 	{ "space", isspace },
 	{ "upper", isupper },
-	{ "xdigit", isxdigit }
+	{ "xdigit", posix_isxdigit }
 };
 
@@ -204,5 +204,5 @@
 {
 	const struct _char_class *class = elem;
-	return strcmp((const char *) key, class->name);
+	return posix_strcmp((const char *) key, class->name);
 }
 
@@ -217,5 +217,5 @@
 {
 	/* Search for class in the array of supported character classes. */
-	const struct _char_class *class = bsearch(cname, _char_classes,
+	const struct _char_class *class = posix_bsearch(cname, _char_classes,
 	    sizeof(_char_classes) / sizeof(struct _char_class),
 	    sizeof(struct _char_class), _class_compare);
@@ -549,5 +549,5 @@
 			end = string;
 		} else {
-			end = strchrnul(string, pathname ? '/' : '\0');
+			end = gnu_strchrnul(string, pathname ? '/' : '\0');
 		}
 
@@ -581,5 +581,5 @@
 {
 	assert(s != NULL);
-	char *result = strdup(s);
+	char *result = posix_strdup(s);
 	for (char *i = result; *i != '\0'; ++i) {
 		*i = tolower(*i);
Index: uspace/lib/posix/source/sys/stat.c
===================================================================
--- uspace/lib/posix/source/sys/stat.c	(revision f8cbe2c319e3f91e545d3d2749a8c2a1348c1a65)
+++ uspace/lib/posix/source/sys/stat.c	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
@@ -38,4 +38,5 @@
 #include "../internal/common.h"
 #include "posix/sys/stat.h"
+#include "libc/sys/stat.h"
 
 #include "posix/errno.h"
