Index: uspace/app/msim/arch_helenos/input.c
===================================================================
--- uspace/app/msim/arch_helenos/input.c	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/app/msim/arch_helenos/input.c	(revision 32b3a12dc482e086388221ed04d85afa521e0308)
@@ -32,4 +32,7 @@
 /** @file HelenOS specific functions for MSIM simulator.
  */
+
+/* Because of asprintf. */
+#define _GNU_SOURCE
 #include "../../io/input.h"
 #include "../../io/output.h"
Index: uspace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/include/posix/stdio.h	(revision 32b3a12dc482e086388221ed04d85afa521e0308)
@@ -39,8 +39,76 @@
 #include "stddef.h"
 #include "unistd.h"
-#include "libc/stdio.h"
+#include "libc/io/verify.h"
 #include "sys/types.h"
 #include "stdarg.h"
 #include "limits.h"
+
+/*
+ * These are the same as in HelenOS libc.
+ * It would be possible to directly include <stdio.h> but
+ * it is better not to pollute POSIX namespace with other functions
+ * defined in that header.
+ *
+ * Because libposix is always linked with libc, providing only these
+ * forward declarations ought to be enough.
+ */
+#define EOF (-1)
+
+#define BUFSIZ  4096
+#define SEEK_SET  0
+#define SEEK_CUR  1
+#define SEEK_END  2
+
+typedef struct _IO_FILE FILE;
+
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+
+extern int fgetc(FILE *);
+extern char *fgets(char *, int, FILE *);
+
+extern int getchar(void);
+extern char *gets(char *, size_t);
+
+extern int fputc(wchar_t, FILE *);
+extern int fputs(const char *, FILE *);
+
+extern int putchar(wchar_t);
+extern int puts(const char *);
+
+extern int fprintf(FILE *, const char*, ...) PRINTF_ATTRIBUTE(2, 3);
+extern int vfprintf(FILE *, const char *, va_list);
+
+extern int printf(const char *, ...) PRINTF_ATTRIBUTE(1, 2);
+extern int vprintf(const char *, va_list);
+
+extern int snprintf(char *, size_t , const char *, ...) PRINTF_ATTRIBUTE(3, 4);
+#ifdef _GNU_SOURCE
+extern int asprintf(char **, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
+#endif
+extern int vsnprintf(char *, size_t, const char *, va_list);
+
+extern FILE *fopen(const char *, const char *);
+extern FILE *fdopen(int, const char *);
+extern int fclose(FILE *);
+
+extern size_t fread(void *, size_t, size_t, FILE *);
+extern size_t fwrite(const void *, size_t, size_t, FILE *);
+
+extern int fseek(FILE *, off64_t, int);
+extern void rewind(FILE *);
+extern off64_t ftell(FILE *);
+extern int feof(FILE *);
+extern int fileno(FILE *);
+
+extern int fflush(FILE *);
+extern int ferror(FILE *);
+extern void clearerr(FILE *);
+
+extern void setvbuf(FILE *, void *, int, size_t);
+
+
+/* POSIX specific stuff. */
 
 /* Identifying the Terminal */
Index: uspace/lib/posix/include/posix/string.h
===================================================================
--- uspace/lib/posix/include/posix/string.h	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/include/posix/string.h	(revision 32b3a12dc482e086388221ed04d85afa521e0308)
@@ -37,18 +37,7 @@
 #define POSIX_STRING_H_
 
-#include <mem.h>
-#include <str.h>
+#include "sys/types.h"
 
-/* available in str.h
- *
- * char *strtok(char *restrict, const char *restrict);
- * char *strtok_r(char *restrict, const char *restrict, char **restrict);
- *
- * available in mem.h
- *
- * void *memset(void *, int, size_t);
- * void *memcpy(void *, const void *, size_t);
- * void *memmove(void *, const void *, size_t);
- *
+/*
  * TODO: not implemented due to missing locale support
  *
@@ -61,4 +50,24 @@
 	#define NULL  ((void *) 0)
 #endif
+
+/*
+ * These are the same as in HelenOS libc.
+ * It would be possible to directly include <str.h> and <mem.h> but
+ * it is better not to pollute POSIX namespace with other functions
+ * defined in that header.
+ *
+ * Because libposix is always linked with libc, providing only these
+ * forward declarations ought to be enough.
+ */
+/* From str.h. */
+extern char * strtok_r(char *, const char *, char **);
+extern char * strtok(char *, const char *);
+
+/* From mem.h */
+#define bzero(ptr, len)  memset((ptr), 0, (len))
+extern void *memset(void *, int, size_t);
+extern void *memcpy(void *, const void *, size_t);
+extern void *memmove(void *, const void *, size_t);
+
 
 /* Copying and Concatenation */
Index: uspace/lib/posix/source/pwd.c
===================================================================
--- uspace/lib/posix/source/pwd.c	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/source/pwd.c	(revision 32b3a12dc482e086388221ed04d85afa521e0308)
@@ -35,4 +35,5 @@
 #define LIBPOSIX_INTERNAL
 
+#include "posix/stdbool.h"
 #include "posix/pwd.h"
 #include "posix/string.h"
Index: uspace/lib/posix/source/stdio.c
===================================================================
--- uspace/lib/posix/source/stdio.c	(revision baeeee23912fc1d843ee7dd0045b07467dccb28e)
+++ uspace/lib/posix/source/stdio.c	(revision 32b3a12dc482e086388221ed04d85afa521e0308)
@@ -49,4 +49,5 @@
 #include "posix/unistd.h"
 
+#include "libc/stdio.h"
 #include "libc/io/printf_core.h"
 #include "libc/str.h"
