Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/Makefile	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2011 Petr Koupy
+# Copyright (c) 2011 Jiri Zarevucky
+# 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.
+#
+
+USPACE_PREFIX = ../..
+LIBRARY = libposix
+SLIBRARY = libposix.so.0.0
+LSONAME = libposix.so0
+
+INCLUDE_LIBC = ./libc
+
+PRE_DEPEND = $(INCLUDE_LIBC)
+EXTRA_CLEAN = $(INCLUDE_LIBC)
+
+SOURCES = \
+	ctype.c \
+	stdlib.c \
+	string.c \
+	strings.c \
+	sys/stat.c \
+	time.c \
+	unistd.c
+
+include $(USPACE_PREFIX)/Makefile.common
+
+$(INCLUDE_LIBC): ../c/include
+	ln -s -f -n $^ $@
+
Index: uspace/lib/posix/common.h
===================================================================
--- uspace/lib/posix/common.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/common.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef LIBPOSIX_COMMON_H_
+#define LIBPOSIX_COMMON_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define not_implemented() (fprintf(stderr, "Function %s() in file %s at line %d is not implemented\n", __func__, __FILE__, __LINE__), abort())
+
+#endif /* LIBPOSIX_COMMON_H_ */
+
Index: uspace/lib/posix/ctype.c
===================================================================
--- uspace/lib/posix/ctype.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/ctype.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#include "ctype.h"
+
+int isxdigit(int ch)
+{
+	return isdigit(ch) ||
+	       (ch >= 'a' && ch <= 'f') ||
+	       (ch >= 'A' && ch <= 'F');
+}
+
Index: uspace/lib/posix/ctype.h
===================================================================
--- uspace/lib/posix/ctype.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/ctype.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef POSIX_CTYPE_H_
+#define POSIX_CTYPE_H_
+
+#include "libc/ctype.h"
+
+extern int isxdigit(int ch);
+
+#endif /* POSIX_CTYPE_H_ */
+
Index: uspace/lib/posix/signal.h
===================================================================
--- uspace/lib/posix/signal.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/signal.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef POSIX_SIGNAL_H_
+#define POSIX_SIGNAL_H_
+
+#include <errno.h>
+
+/* HelenOS doesn't have signals, so calls to functions of this header
+ * are just replaced with their respective failure return value.
+ *
+ * Other macros and constants are here just to satisfy the symbol resolver
+ * and have no practical value whatsoever, until HelenOS implements some
+ * equivalent of signals. Maybe something neat based on IPC will be devised
+ * in the future?
+ */
+
+#define SIG_DFL ((void (*)(int)) 0)
+#define SIG_ERR ((void (*)(int)) 0)
+#define SIG_IGN ((void (*)(int)) 0)
+
+#define signal(sig,func) (errno = ENOTSUP, SIG_ERR)
+#define raise(sig) ((int)-1)
+
+typedef int sig_atomic_t;
+
+/* full POSIX set */
+enum {
+	SIGABRT,
+	SIGALRM,
+	SIGBUS,
+	SIGCHLD,
+	SIGCONT,
+	SIGFPE,
+	SIGHUP,
+	SIGILL,
+	SIGINT,
+	SIGKILL,
+	SIGPIPE,
+	SIGQUIT,
+	SIGSEGV,
+	SIGSTOP,
+	SIGTERM,
+	SIGTSTP,
+	SIGTTIN,
+	SIGTTOU,
+	SIGUSR1,
+	SIGUSR2,
+	SIGPOLL,
+	SIGPROF,
+	SIGSYS,
+	SIGTRAP,
+	SIGURG,
+	SIGVTALRM,
+	SIGXCPU,
+	SIGXFSZ
+};
+
+#endif /* POSIX_SIGNAL_H_ */
+
Index: uspace/lib/posix/stdio.h
===================================================================
--- uspace/lib/posix/stdio.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/stdio.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef POSIX_STDIO_H_
+#define POSIX_STDIO_H_
+
+#include "libc/stdio.h"
+
+#define putc fputc
+
+#endif /* POSIX_STDIO_H_ */
+
Index: uspace/lib/posix/stdlib.c
===================================================================
--- uspace/lib/posix/stdlib.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/stdlib.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#define LIBPOSIX_INTERNAL
+
+#include "stdlib.h"
+
+/**
+ *
+ * @param array
+ * @param count
+ * @param size
+ * @param compare
+ */
+void posix_qsort(void *array, size_t count, size_t size, int (*compare)(const void *, const void *))
+{
+	// TODO
+}
+
+/**
+ *
+ * @param name
+ * @return
+ */
+char *posix_getenv(const char *name)
+{
+	// TODO
+	return 0;
+}
+
+/**
+ * 
+ * @param name
+ * @param resolved
+ * @return
+ */
+char *posix_realpath(const char *name, char *resolved)
+{
+	// TODO
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/stdlib.h
===================================================================
--- uspace/lib/posix/stdlib.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/stdlib.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#ifndef POSIX_STDLIB_H_
+#define POSIX_STDLIB_H_
+
+#include "libc/stdlib.h"
+
+#ifndef NULL
+	#define NULL  ((void *) 0)
+#endif
+
+#undef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#undef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+
+#define _exit exit
+#define _Exit exit
+
+/* Array Sort Function */
+extern void posix_qsort(void *array, size_t count, size_t size, int (*compare)(const void *, const void *));
+
+/* Environment Access */
+extern char *posix_getenv(const char *name);
+
+/* Symbolic Links */
+extern char *posix_realpath(const char *restrict name, char *restrict resolved);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define qsort posix_qsort
+	#define getenv posix_getenv
+	#define realpath posix_realpath
+#endif
+
+#endif  // POSIX_STDLIB_H_
+
+/** @}
+ */
Index: uspace/lib/posix/string.c
===================================================================
--- uspace/lib/posix/string.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/string.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#define LIBPOSIX_INTERNAL
+
+#include "string.h"
+
+#include <assert.h>
+#include <str_error.h>
+#include <stdlib.h>
+#include <errno.h>
+
+/* Defined for convenience. Returns pointer to the terminating nul character.
+ */
+static char *strzero(const char *s)
+{
+	while (*s != '\0')
+		s ++;
+
+	return (char*) s;
+}
+
+/* Returns true if s2 is a prefix of s1.
+ */
+static bool begins_with(const char *s1, const char *s2)
+{
+	while (*s1 == *s2 && *s2 != '\0') {
+		s1 ++;
+		s2 ++;
+	}
+	
+	/* true if the end was reached */
+	return *s2 == '\0';
+}
+
+/* The same as strpbrk, except it returns pointer to the nul terminator
+ * if no occurence is found.
+ */
+static char *strpbrk_null(const char *s1, const char *s2)
+{
+	while (!posix_strchr(s2, *s1)) {
+		++ s1;
+	}
+	
+	return (char *) s1;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @return dest
+ */
+char *posix_strcpy(char *dest, const char *src)
+{
+	posix_stpcpy(dest, src);
+	return dest;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @param n
+ * @return dest
+ */
+char *posix_strncpy(char *dest, const char *src, size_t n)
+{
+	posix_stpncpy(dest, src, n);
+	return dest;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @return Pointer to the nul character in the dest string
+ */
+char *posix_stpcpy(char *restrict dest, const char *restrict src)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	for (size_t i = 0; ; ++ i) {
+		dest[i] = src[i];
+		
+		if (src[i] == '\0') {
+			/* pointer to the terminating nul character */
+			return &dest[i];
+		}
+	}
+	
+	/* unreachable */
+	return NULL;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @param n
+ * @return Pointer to the first written nul character or &dest[n]
+ */
+char *posix_stpncpy(char *restrict dest, const char *restrict src, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	for (size_t i = 0; i < n; ++ i) {
+		dest[i] = src[i];
+	
+		/* the standard requires that nul characters
+		 * are appended to the length of n, in case src is shorter
+		 */
+		if (src[i] == '\0') {
+			char *result = &dest[i];
+			for (++ i; i < n; ++ i) {
+				dest[i] = '\0';
+			}
+			return result;
+		}
+	}
+	
+	return &dest[n];
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @return dest
+ */
+char *posix_strcat(char *dest, const char *src)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	posix_strcpy(strzero(dest), src);
+	return dest;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @param n
+ * @return dest
+ */
+char *posix_strncat(char *dest, const char *src, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	char *zeroptr = posix_strncpy(strzero(dest), src, n);
+	/* strncpy doesn't append the nul terminator, so we do it here */
+	zeroptr[n] = '\0';
+	return dest;
+}
+
+/**
+ *
+ * @param dest
+ * @param src
+ * @param c
+ * @param n
+ * @return Pointer to the first byte after c in dest if found, NULL otherwise.
+ */
+void *posix_memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+	
+	unsigned char* bdest = dest;
+	const unsigned char* bsrc = src;
+	
+	for (size_t i = 0; i < n; ++ i) {
+		bdest[i] = bsrc[i];
+	
+		if (bsrc[i] == (unsigned char) c) {
+			/* pointer to the next byte */
+			return &bdest[i + 1];
+		}
+	}
+	
+	return NULL;
+}
+
+/**
+ *
+ * @param s
+ * @return Newly allocated string
+ */
+char *posix_strdup(const char *s)
+{
+	// FIXME: SIZE_MAX doesn't work
+	return posix_strndup(s, STR_NO_LIMIT);
+}
+
+/**
+ *
+ * @param s
+ * @param n
+ * @return Newly allocated string of length at most n
+ */
+char *posix_strndup(const char *s, size_t n)
+{
+	assert(s != NULL);
+
+	size_t len = posix_strnlen(s, n);
+	char *dup = malloc(len + 1);
+	if (dup == NULL) {
+		return NULL;
+	}
+
+	memcpy(dup, s, len);
+	dup[len] = '\0';
+
+	return dup;
+}
+
+/**
+ *
+ * @param mem1
+ * @param mem2
+ * @param n
+ * @return Difference of the first pair of inequal bytes,
+ *          or 0 if areas have the same content
+ */
+int posix_memcmp(const void *mem1, const void *mem2, size_t n)
+{
+	assert(mem1 != NULL);
+	assert(mem2 != NULL);
+
+	const unsigned char *s1 = mem1;
+	const unsigned char *s2 = mem2;
+	
+	for (size_t i = 0; i < n; ++ i) {
+		if (s1[i] != s2[i]) {
+			return s2[i] - s1[i];
+		}
+	}
+	
+	return 0;
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+int posix_strcmp(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	return posix_strncmp(s1, s2, STR_NO_LIMIT);
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @param n
+ * @return
+ */
+int posix_strncmp(const char *s1, const char *s2, size_t n)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	for (size_t i = 0; i < n; ++ i) {
+		if (s1[i] != s2[i]) {
+			return s2[i] - s1[i];
+		}
+		if (s1[i] == '\0') {
+			break;
+		}
+	}
+
+	return 0;
+}
+
+/**
+ *
+ * @param mem
+ * @param c
+ * @param n
+ * @return
+ */
+void *posix_memchr(const void *mem, int c, size_t n)
+{
+	assert(mem != NULL);
+	
+	const unsigned char *s = mem;
+	
+	for (size_t i = 0; i < n; ++ i) {
+		if (s[i] == (unsigned char) c) {
+			return (void *) &s[i];
+		}
+	}
+	return NULL;
+}
+
+/**
+ *
+ * @param s
+ * @param c
+ * @return
+ */
+char *posix_strchr(const char *s, int c)
+{
+	assert(s != NULL);
+	
+	/* special handling for the case that zero is searched for */
+	if (c == '\0')
+		return strzero(s);
+	
+	/* otherwise just loop through the string until found */
+	while (*s != (char) c) {
+		if (*s == '\0')
+			return NULL;
+
+		s ++;
+	}
+	
+	return (char *) s;
+}
+
+/**
+ *
+ * @param s
+ * @param c
+ * @return
+ */
+char *posix_strrchr(const char *s, int c)
+{
+	assert(s != NULL);
+	
+	const char *ptr = strzero(s);
+	
+	/* the same as in strchr, except it loops in reverse direction */
+	while (*ptr != (char) c) {
+		if (ptr == s)
+			return NULL;
+
+		ptr ++;
+	}
+
+	return (char *) ptr;
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+char *posix_strpbrk(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (*ptr == '\0') ? NULL : ptr;
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+size_t posix_strcspn(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (size_t) (ptr - s1);
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+size_t posix_strspn(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	const char *ptr;
+	for (ptr = s1; *ptr != '\0'; ++ ptr) {
+		if (!posix_strchr(s2, *ptr))
+			break;
+	}
+	return ptr - s1;
+}
+
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+char *posix_strstr(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	/* special case - needle is an empty string */
+	if (*s2 == '\0')
+		return (char *) s1;
+
+	// TODO: use faster algorithm
+	/* check for prefix from every position - quadratic complexity */
+	while (*s1 != '\0') {
+		if (begins_with(s1, s2))
+			return (char *) s1;
+		
+		s1 ++;
+	}
+	
+	return NULL;
+}
+
+/**
+ * Currently ignores locale and just calls strcmp.
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+int posix_strcoll(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	return posix_strcmp(s1, s2);
+}
+
+/**
+ * strcoll is equal to strcmp here, so this just makes a copy.
+ *
+ * @param s1
+ * @param s2
+ * @param n
+ * @return
+ */
+size_t posix_strxfrm(char *s1, const char *s2, size_t n)
+{
+	assert(s1 != NULL || n == 0);
+	assert(s2 != NULL);
+
+	size_t len = posix_strlen(s2);
+
+	if (n > len)
+		posix_strcpy(s1, s2);
+
+	return len;
+}
+
+/**
+ *
+ * @param errnum
+ * @return
+ */
+char *posix_strerror(int errnum)
+{
+	/* uses function from libc, we just have to negate errno
+	   (POSIX uses positive errorcodes, HelenOS has negative) */
+	return (char *) str_error (-errnum);
+}
+
+/**
+ *
+ * @param errnum Error code
+ * @param buf    Buffer to store a human readable string to
+ * @param bufsz  Size of buffer pointed to by buf
+ * @return
+ */
+int posix_strerror_r(int errnum, char *buf, size_t bufsz)
+{
+	assert(buf != NULL);
+	
+	char *errstr = posix_strerror(errnum);
+	/* HelenOS str_error can't fail */
+	
+	if (posix_strlen(errstr) + 1 > bufsz) {
+		return -ERANGE;
+	} else {
+		posix_strcpy(buf, errstr);
+	}
+
+	return 0;
+}
+
+/**
+ *
+ * @param s
+ * @return
+ */
+size_t posix_strlen(const char *s)
+{
+	assert(s != NULL);
+	
+	return (size_t) (strzero(s) - s);
+}
+
+/**
+ *
+ * @param s
+ * @param n
+ * @return
+ */
+size_t posix_strnlen(const char *s, size_t n)
+{
+	assert(s != NULL);
+	
+	for (size_t sz = 0; sz < n; ++ sz) {
+		
+		if (s[sz] == '\0') {
+			return sz;
+		}
+	}
+	
+	return n;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/string.h
===================================================================
--- uspace/lib/posix/string.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/string.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#ifndef POSIX_STRING_H_
+#define POSIX_STRING_H_
+
+#include <mem.h>
+#include <str.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);
+ *
+ * unimplemented due to missing locales
+ *
+ * int      strcoll_l(const char *, const char *, locale_t);
+ * char    *strerror_l(int, locale_t);
+ * size_t   strxfrm_l(char *restrict, const char *restrict, size_t, locale_t);
+ *
+ */
+
+// TODO: provide *_l once there is locale.h
+
+#ifndef NULL
+	#define NULL  ((void *) 0)
+#endif
+
+/* Copying and Concatenation */
+extern char *posix_strcpy(char *restrict dest, const char *restrict src);
+extern char *posix_strncpy(char *restrict dest, const char *restrict src, size_t n);
+extern char *posix_stpcpy(char *restrict dest, const char *restrict src);
+extern char *posix_stpncpy(char *restrict dest, const char *restrict src, size_t n);
+extern char *posix_strcat(char *restrict dest, const char *restrict src);
+extern char *posix_strncat(char *restrict dest, const char *restrict src, size_t n);
+extern void *posix_memccpy(void *restrict dest, const void *restrict src, int c, size_t n);
+extern char *posix_strdup(const char *s);
+extern char *posix_strndup(const char *s, size_t n);
+
+/* String/Array Comparison */
+extern int posix_memcmp(const void *mem1, const void *mem2, size_t n);
+extern int posix_strcmp(const char *s1, const char *s2);
+extern int posix_strncmp(const char *s1, const char *s2, size_t n);
+
+/* Search Functions */
+extern void *posix_memchr(const void *mem, int c, size_t n);
+extern char *posix_strchr(const char *s, int c);
+extern char *posix_strrchr(const char *s, int c);
+extern char *posix_strpbrk(const char *s1, const char *s2);
+extern size_t posix_strcspn(const char *s1, const char *s2);
+extern size_t posix_strspn(const char *s1, const char *s2);
+extern char *posix_strstr(const char *s1, const char *s2);
+
+/* Collation Functions */
+extern int posix_strcoll(const char *s1, const char *s2);
+extern size_t posix_strxfrm(char *restrict s1, const char *restrict s2, size_t n);
+
+/* Error Messages */
+extern char *posix_strerror(int errnum);
+extern int posix_strerror_r(int errnum, char *buf, size_t bufsz);
+
+/* String Length */
+extern size_t posix_strlen(const char *s);
+extern size_t posix_strnlen(const char *s, size_t n);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define strcpy posix_strcpy
+	#define strncpy posix_strncpy
+	#define stpcpy posix_stpcpy
+	#define stpncpy posix_stpncpy
+	#define strcat posix_strcat
+	#define strncat posix_strncat
+	#define memccpy posix_memccpy
+	#define strdup posix_strdup
+	#define strndup posix_strndup
+
+	#define memcmp posix_memcmp
+	#define strcmp posix_strcmp
+	#define strncmp posix_strncmp
+
+	#define memchr posix_memchr
+	#define strchr posix_strchr
+	#define strrchr posix_strrchr
+	#define strpbrk posix_strpbrk
+	#define strcspn posix_strcspn
+	#define strspn posix_strspn
+	#define strstr posix_strstr
+
+	#define strcoll posix_strcoll
+	#define strxfrm posix_strxfrm
+
+	#define strerror posix_strerror
+	#define strerror_r posix_strerror_r
+	#define strsignal(i) ((char*) "SIGNonSense: There are no signals in HelenOS.")
+
+	#define strlen posix_strlen
+	#define strnlen posix_strnlen
+#endif
+
+#endif  // POSIX_STRING_H_
+
+/** @}
+ */
Index: uspace/lib/posix/strings.c
===================================================================
--- uspace/lib/posix/strings.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/strings.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#define POSIX_INTERNAL
+
+#include "common.h"
+#include "strings.h"
+#include "string.h"
+
+int posix_ffs(int i)
+{
+	// TODO
+	not_implemented();
+}
+
+int posix_strcasecmp(const char *s1, const char *s2)
+{
+	// TODO
+	not_implemented();
+}
+
+int posix_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+	// TODO
+	not_implemented();
+}
+
+int posix_bcmp(const void *mem1, const void *mem2, size_t n)
+{
+	// TODO
+	not_implemented();
+}
+
+void posix_bcopy(const void *dest, void *src, size_t n)
+{
+	// TODO
+	not_implemented();
+}
+
+void posix_bzero(void *mem, size_t n)
+{
+	// TODO
+	not_implemented();
+}
+
+char *posix_index(const char *s, int c)
+{
+	return posix_strchr(s, c);
+}
+
+char *posix_rindex(const char *s, int c)
+{
+	return posix_strrchr(s, c);
+}
+
+/** @}
+ */
+
Index: uspace/lib/posix/strings.h
===================================================================
--- uspace/lib/posix/strings.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/strings.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#ifndef POSIX_STRINGS_H_
+#define POSIX_STRINGS_H_
+
+extern int posix_ffs(int);
+
+extern int posix_strcasecmp(const char *, const char *);
+extern int posix_strncasecmp(const char *, const char *, size_t);
+
+/* TODO: not implemented due to missing locale.h
+ *
+ * int strcasecmp_l(const char *, const char *, locale_t);
+ * int strncasecmp_l(const char *, const char *, size_t, locale_t);
+ */
+
+
+/* Legacy Functions */
+
+extern int posix_bcmp(const void *, const void *, size_t);
+extern void posix_bcopy(const void *, void *, size_t);
+extern void posix_bzero(void *, size_t);
+extern char *posix_index(const char *, int);
+extern char *posix_rindex(const char *, int);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define ffs posix_ffs
+	#define strcasecmp posix_strcasecmp
+	#define strncasecmp posix_strncasecmp
+	
+	#define bcmp posix_bcmp
+	#define bcopy posix_bcopy
+	#undef bzero
+	#define bzero posix_bzero
+	#define index posix_index
+	#define rindex posix_rindex
+#endif
+
+#endif  // POSIX_STRINGS_H_
+
+/** @}
+ */
Index: uspace/lib/posix/sys/stat.c
===================================================================
--- uspace/lib/posix/sys/stat.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/sys/stat.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#define LIBPOSIX_INTERNAL
+
+#include "stat.h"
+#include <mem.h>
+
+/* Convert HelenOS stat struct into POSIX stat struct (if possible)
+ */
+static void stat_to_posix (struct posix_stat *dest, struct stat *src)
+{
+	memset(dest, 0, sizeof(struct posix_stat));
+	
+	dest->st_dev = src->device;
+	
+	/* HelenOS doesn't support permissions, so we set them all */
+	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
+	if (src->is_file)
+		dest->st_mode |= S_IFREG;
+	if (src->is_directory)
+		dest->st_mode |= S_IFDIR;
+	
+	dest->st_nlink = src->lnkcnt;
+	dest->st_size = src->size;
+}
+
+int posix_fstat(int fd, struct posix_stat *st)
+{
+	struct stat hst;
+	if (fstat(fd, &hst) == -1) {
+		// TODO: propagate a POSIX compatible errno
+		return -1;
+	}
+	stat_to_posix(st, &hst);
+	return 0;
+}
+
+int posix_stat(const char *path, struct posix_stat *st)
+{
+	struct stat hst;
+	if (stat(path, &hst) == -1) {
+		// TODO: propagate a POSIX compatible errno
+		return -1;
+	}
+	stat_to_posix(st, &hst);
+	return 0;
+}
+
Index: uspace/lib/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/sys/stat.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/sys/stat.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef POSIX_SYS_STAT_H_
+#define POSIX_SYS_STAT_H_
+
+#include "../libc/sys/stat.h"
+#include "time.h"
+
+/* values are the same as on Linux */
+#define S_IFMT     0170000   /* all file types */
+#define S_IFSOCK   0140000   /* socket */
+#define S_IFLNK    0120000   /* symbolic link */
+#define S_IFREG    0100000   /* regular file */
+#define S_IFBLK    0060000   /* block device */
+#define S_IFDIR    0040000   /* directory */
+#define S_IFCHR    0020000   /* character device */
+#define S_IFIFO    0010000   /* FIFO */
+
+#define S_ISUID    0004000   /* SUID */
+#define S_ISGID    0002000   /* SGID */
+#define S_ISVTX    0001000   /* sticky */
+
+#define S_IRWXU    00700     /* owner permissions */
+#define S_IRUSR    00400
+#define S_IWUSR    00200
+#define S_IXUSR    00100
+
+#define S_IRWXG    00070     /* group permissions */
+#define S_IRGRP    00040
+#define S_IWGRP    00020
+#define S_IXGRP    00010
+
+#define S_IRWXO    00007     /* other permissions */
+#define S_IROTH    00004
+#define S_IWOTH    00002
+#define S_IXOTH    00001
+
+#define S_ISREG(m) ((m & S_IFREG) != 0)
+#define S_ISDIR(m) ((m & S_IFDIR) != 0)
+#define S_ISCHR(m) ((m & S_IFCHR) != 0)
+#define S_ISBLK(m) ((m & S_IFBLK) != 0)
+#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
+#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.) */
+
+typedef devmap_handle_t dev_t;
+typedef unsigned int ino_t;
+typedef unsigned int nlink_t;
+typedef unsigned int uid_t;
+typedef unsigned int gid_t;
+typedef aoff64_t off_t;
+typedef unsigned int blksize_t;
+typedef unsigned int blkcnt_t;
+
+struct posix_stat {
+	struct stat sys_stat;
+
+	dev_t     st_dev;     /* ID of device containing file */
+	ino_t     st_ino;     /* inode number */
+	mode_t    st_mode;    /* protection */
+	nlink_t   st_nlink;   /* number of hard links */
+	uid_t     st_uid;     /* user ID of owner */
+	gid_t     st_gid;     /* group ID of owner */
+	dev_t     st_rdev;    /* device ID (if special file) */
+	off_t     st_size;    /* total size, in bytes */
+	blksize_t st_blksize; /* blocksize for file system I/O */
+	blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
+	time_t    st_atime;   /* time of last access */
+	time_t    st_mtime;   /* time of last modification */
+	time_t    st_ctime;   /* time of last status change */
+};
+
+extern int posix_fstat(int, struct posix_stat *);
+extern int posix_stat(const char *, struct posix_stat *);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define fstat posix_fstat
+	#define stat posix_stat
+#endif
+
+#endif /* POSIX_SYS_STAT_H */
+
Index: uspace/lib/posix/sys/types.h
===================================================================
--- uspace/lib/posix/sys/types.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/sys/types.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#ifndef POSIX_SYS_TYPES_H_
+#define POSIX_SYS_TYPES_H_
+
+#include "../libc/sys/types.h"
+#include <task.h>
+
+typedef task_id_t pid_t;
+
+#endif /* POSIX_SYS_TYPES_H_ */
+
Index: uspace/lib/posix/time.c
===================================================================
--- uspace/lib/posix/time.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/time.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#define LIBPOSIX_INTERNAL
+
+#include "time.h"
+
+/**
+ *
+ * @param timep
+ * @return
+ */
+struct posix_tm *posix_localtime(const time_t *timep)
+{
+	// TODO
+	static struct posix_tm result = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+	return &result;
+}
+
+/**
+ *
+ * @param tm
+ * @return
+ */
+char *posix_asctime(const struct posix_tm *tm)
+{
+	// TODO
+	static char result[] = "Sun Jan 01 00:00:00 1900\n";
+	return result;
+}
+
+/**
+ * 
+ * @param timep
+ * @return
+ */
+char *posix_ctime(const time_t *timep)
+{
+	return posix_asctime(posix_localtime(timep));
+}
+
+/**
+ * 
+ * @param s
+ * @param maxsize
+ * @param format
+ * @param tm
+ * @return
+ */
+size_t posix_strftime(char *s, size_t maxsize, const char *format, const struct posix_tm *tm)
+{
+	// TODO
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/time.h
===================================================================
--- uspace/lib/posix/time.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/time.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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
+ * @{
+ */
+/** @file
+ */
+
+#ifndef POSIX_TIME_H_
+#define POSIX_TIME_H_
+
+#include "libc/time.h"
+
+#ifndef NULL
+	#define NULL  ((void *) 0)
+#endif
+
+struct posix_tm {
+	int tm_sec;         /* Seconds [0,60]. */
+	int tm_min;         /* Minutes [0,59]. */
+	int tm_hour;        /* Hour [0,23]. */
+	int tm_mday;        /* Day of month [1,31]. */
+	int tm_mon;         /* Month of year [0,11]. */
+	int tm_year;        /* Years since 1900. */
+	int tm_wday;        /* Day of week [0,6] (Sunday = 0). */
+	int tm_yday;        /* Day of year [0,365]. */
+	int tm_isdst;       /* Daylight Savings flag. */
+};
+
+/* Broken-down Time */
+extern struct posix_tm *posix_localtime(const time_t *timep);
+
+/* Formatting Calendar Time */
+extern char *posix_asctime(const struct posix_tm *tm);
+extern char *posix_ctime(const time_t *timep);
+extern size_t posix_strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct posix_tm *restrict tm);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define tm posix_tm
+
+	#define localtime posix_localtime
+
+	#define asctime posix_asctime
+	#define ctime posix_ctime
+	#define strftime posix_strftime
+#endif
+
+#endif  // POSIX_TIME_H_
+
+/** @}
+ */
Index: uspace/lib/posix/unistd.c
===================================================================
--- uspace/lib/posix/unistd.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/unistd.c	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+
+#include "unistd.h"
+
+int isatty(int fd) {
+	// TODO
+	return 0;
+}
+
Index: uspace/lib/posix/unistd.h
===================================================================
--- uspace/lib/posix/unistd.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
+++ uspace/lib/posix/unistd.h	(revision 2af29ed7c9c717445d7e7c17955fdb597d7ce3c8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * 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.
+ */
+ 
+#ifndef POSIX_UNISTD_H_
+#define POSIX_UNISTD_H_
+
+#include "libc/unistd.h"
+
+/* #include <getopt.h> */
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+extern int getopt(int, char * const [], const char *);
+
+extern int isatty(int fd);
+
+#define getpid task_get_id
+
+#define STDIN_FILENO (fileno(stdin))
+#define STDOUT_FILENO (fileno(stdout))
+#define STDERR_FILENO (fileno(stderr))
+
+#endif /* POSIX_UNISTD_H_ */
+
