Index: uspace/lib/posix/common.h
===================================================================
--- uspace/lib/posix/common.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/common.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -27,4 +27,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef LIBPOSIX_COMMON_H_
 #define LIBPOSIX_COMMON_H_
@@ -33,6 +39,10 @@
 #include <stdlib.h>
 
-#define not_implemented() (fprintf(stderr, "Function %s() in file %s at line %d is not implemented\n", __func__, __FILE__, __LINE__), abort())
+#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 ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/ctype.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,11 +28,26 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
+#define POSIX_INTERNAL
+
 #include "ctype.h"
 
-int isxdigit(int ch)
+/**
+ * 
+ * @param ch
+ * @return
+ */
+int posix_isxdigit(int ch)
 {
 	return isdigit(ch) ||
-	       (ch >= 'a' && ch <= 'f') ||
-	       (ch >= 'A' && ch <= 'F');
+	    (ch >= 'a' && ch <= 'f') ||
+	    (ch >= 'A' && ch <= 'F');
 }
 
+/** @}
+ */
Index: uspace/lib/posix/ctype.h
===================================================================
--- uspace/lib/posix/ctype.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/ctype.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,4 +28,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_CTYPE_H_
 #define POSIX_CTYPE_H_
@@ -32,6 +39,13 @@
 #include "libc/ctype.h"
 
-extern int isxdigit(int ch);
+/* Classification of Characters */
+extern int posix_isxdigit(int ch);
+
+#ifndef POSIX_INTERNAL
+	#define isxdigit posix_isxdigit
+#endif
 
 #endif /* POSIX_CTYPE_H_ */
 
+/** @}
+ */
Index: uspace/lib/posix/signal.h
===================================================================
--- uspace/lib/posix/signal.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/signal.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -27,8 +27,14 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_SIGNAL_H_
 #define POSIX_SIGNAL_H_
 
-#include <errno.h>
+#include "libc/errno.h"
 
 /* HelenOS doesn't have signals, so calls to functions of this header
@@ -41,12 +47,15 @@
  */
 
+#undef SIG_DFL
 #define SIG_DFL ((void (*)(int)) 0)
+#undef SIG_ERR
 #define SIG_ERR ((void (*)(int)) 0)
+#undef SIG_IGN
 #define SIG_IGN ((void (*)(int)) 0)
 
 #define signal(sig,func) (errno = ENOTSUP, SIG_ERR)
-#define raise(sig) ((int)-1)
+#define raise(sig) ((int) -1)
 
-typedef int sig_atomic_t;
+typedef int posix_sig_atomic_t;
 
 /* full POSIX set */
@@ -82,4 +91,10 @@
 };
 
+#ifndef POSIX_INTERNAL
+	#define sig_atomic_t posix_sig_atomic_t
+#endif
+
 #endif /* POSIX_SIGNAL_H_ */
 
+/** @}
+ */
Index: uspace/lib/posix/stdio.c
===================================================================
--- uspace/lib/posix/stdio.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/stdio.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -36,15 +37,26 @@
 
 #include <assert.h>
-#include "errno.h"
+#include <errno.h>
+
 #include "common.h"
 #include "stdio.h"
 #include "string.h"
+
 /* not the best of solutions, but freopen will eventually
-   need to be implemented in libc anyway */
+ * need to be implemented in libc anyway
+ */
 #include "../c/generic/private/stdio.h"
 
-FILE *posix_freopen(const char *restrict filename,
-                    const char *restrict mode,
-                    FILE *restrict stream)
+/**
+ * 
+ * @param filename
+ * @param mode
+ * @param stream
+ * @return
+ */
+FILE *posix_freopen(
+    const char *restrict filename,
+    const char *restrict mode,
+    FILE *restrict stream)
 {
 	assert(mode != NULL);
@@ -55,7 +67,9 @@
 		
 		/* print error to stderr as well, to avoid hard to find problems
-		   with buggy apps that expect this to work */
-		fprintf(stderr, "ERROR: Application wants to use freopen() to change mode of opened stream.\n"
-		                "       libposix does not support that yet, the application may function improperly.\n");
+		 * with buggy apps that expect this to work
+		 */
+		fprintf(stderr,
+		    "ERROR: Application wants to use freopen() to change mode of opened stream.\n"
+		    "       libposix does not support that yet, the application may function improperly.\n");
 		errno = ENOTSUP;
 		return NULL;
@@ -68,7 +82,7 @@
 	}
 	memcpy(copy, stream, sizeof(FILE));
-	fclose(copy);   /* copy is now freed */
+	fclose(copy); /* copy is now freed */
 	
-	copy = fopen(filename, mode);         /* open new stream */
+	copy = fopen(filename, mode); /* open new stream */
 	if (copy == NULL) {
 		/* fopen() sets errno */
@@ -87,4 +101,8 @@
 }
 
+/**
+ *
+ * @param s
+ */
 void posix_perror(const char *s)
 {
@@ -95,3 +113,2 @@
 /** @}
  */
-
Index: uspace/lib/posix/stdio.h
===================================================================
--- uspace/lib/posix/stdio.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/stdio.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,4 +28,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_STDIO_H_
 #define POSIX_STDIO_H_
@@ -32,16 +39,20 @@
 #include "libc/stdio.h"
 
+/* Character Input/Output */
 #define putc fputc
 #define getc fgetc
 
+/* Opening Streams */
+extern FILE *posix_freopen(
+   const char *restrict filename,
+   const char *restrict mode,
+   FILE *restrict stream);
 
-extern FILE *posix_freopen(const char *restrict filename,
-                           const char *restrict mode,
-                           FILE *restrict stream);
-
+/* Error Messages */
 extern void posix_perror(const char *s);
 
 #ifndef POSIX_INTERNAL
 	#define freopen posix_freopen
+
 	#define perror posix_perror
 #endif
@@ -49,2 +60,4 @@
 #endif /* POSIX_STDIO_H_ */
 
+/** @}
+ */
Index: uspace/lib/posix/stdlib.c
===================================================================
--- uspace/lib/posix/stdlib.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/stdlib.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -46,5 +46,6 @@
  * @param compare
  */
-void posix_qsort(void *array, size_t count, size_t size, int (*compare)(const void *, const void *))
+void posix_qsort(void *array, size_t count, size_t size,
+    int (*compare)(const void *, const void *))
 {
 	// TODO
Index: uspace/lib/posix/stdlib.h
===================================================================
--- uspace/lib/posix/stdlib.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/stdlib.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -43,14 +43,14 @@
 #endif
 
+/* Process Termination */
 #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 *));
+extern void posix_qsort(void *array, size_t count, size_t size,
+    int (*compare)(const void *, const void *));
 
 /* Environment Access */
@@ -60,10 +60,10 @@
 extern char *posix_realpath(const char *restrict name, char *restrict resolved);
 
-/* decimal to native floating point conversion */
+/* Floating Point Conversion */
 extern float posix_strtof(const char *restrict nptr, char **restrict endptr);
 extern double posix_strtod(const char *restrict nptr, char **restrict endptr);
 extern long double posix_strtold(const char *restrict nptr, char **restrict endptr);
 
-/* decimal to native integer conversion */
+/* Integer Conversion */
 extern int posix_atoi(const char *str);
 
Index: uspace/lib/posix/string.c
===================================================================
--- uspace/lib/posix/string.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/string.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -43,21 +43,31 @@
 #include <errno.h>
 
-/* Defined for convenience. Returns pointer to the terminating nul character.
+/**
+ * Defined for convenience. Returns pointer to the terminating nul character.
+ *
+ * @param s
+ * @return
  */
 static char *strzero(const char *s)
 {
-	while (*s != '\0')
-		s ++;
-
-	return (char*) s;
-}
-
-/* Returns true if s2 is a prefix of s1.
+	while (*s != '\0') {
+		s++;
+	}
+
+	return (char *) s;
+}
+
+/**
+ * Returns true if s2 is a prefix of s1.
+ *
+ * @param s1
+ * @param s2
+ * @return
  */
 static bool begins_with(const char *s1, const char *s2)
 {
 	while (*s1 == *s2 && *s2 != '\0') {
-		s1 ++;
-		s2 ++;
+		s1++;
+		s2++;
 	}
 	
@@ -66,11 +76,16 @@
 }
 
-/* The same as strpbrk, except it returns pointer to the nul terminator
+/**
+ * The same as strpbrk, except it returns pointer to the nul terminator
  * if no occurence is found.
+ *
+ * @param s1
+ * @param s2
+ * @return
  */
 static char *strpbrk_null(const char *s1, const char *s2)
 {
 	while (!posix_strchr(s2, *s1)) {
-		++ s1;
+		++s1;
 	}
 	
@@ -82,5 +97,5 @@
  * @param dest
  * @param src
- * @return dest
+ * @return
  */
 char *posix_strcpy(char *dest, const char *src)
@@ -95,5 +110,5 @@
  * @param src
  * @param n
- * @return dest
+ * @return
  */
 char *posix_strncpy(char *dest, const char *src, size_t n)
@@ -114,5 +129,5 @@
 	assert(src != NULL);
 
-	for (size_t i = 0; ; ++ i) {
+	for (size_t i = 0; ; ++i) {
 		dest[i] = src[i];
 		
@@ -139,5 +154,5 @@
 	assert(src != NULL);
 
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		dest[i] = src[i];
 	
@@ -147,5 +162,5 @@
 		if (src[i] == '\0') {
 			char *result = &dest[i];
-			for (++ i; i < n; ++ i) {
+			for (++i; i < n; ++i) {
 				dest[i] = '\0';
 			}
@@ -161,5 +176,5 @@
  * @param dest
  * @param src
- * @return dest
+ * @return
  */
 char *posix_strcat(char *dest, const char *src)
@@ -177,5 +192,5 @@
  * @param src
  * @param n
- * @return dest
+ * @return
  */
 char *posix_strncat(char *dest, const char *src, size_t n)
@@ -198,5 +213,5 @@
  * @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)
+void *posix_memccpy(void *dest, const void *src, int c, size_t n)
 {
 	assert(dest != NULL);
@@ -206,5 +221,5 @@
 	const unsigned char* bsrc = src;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		bdest[i] = bsrc[i];
 	
@@ -257,5 +272,5 @@
  * @param n
  * @return Difference of the first pair of inequal bytes,
- *          or 0 if areas have the same content
+ *     or 0 if areas have the same content
  */
 int posix_memcmp(const void *mem1, const void *mem2, size_t n)
@@ -267,5 +282,5 @@
 	const unsigned char *s2 = mem2;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s1[i] != s2[i]) {
 			return s2[i] - s1[i];
@@ -302,5 +317,5 @@
 	assert(s2 != NULL);
 
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s1[i] != s2[i]) {
 			return s2[i] - s1[i];
@@ -327,5 +342,5 @@
 	const unsigned char *s = mem;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s[i] == (unsigned char) c) {
 			return (void *) &s[i];
@@ -346,13 +361,15 @@
 	
 	/* special handling for the case that zero is searched for */
-	if (c == '\0')
+	if (c == '\0') {
 		return strzero(s);
+	}
 	
 	/* otherwise just loop through the string until found */
 	while (*s != (char) c) {
-		if (*s == '\0')
+		if (*s == '\0') {
 			return NULL;
-
-		s ++;
+		}
+
+		s++;
 	}
 	
@@ -374,8 +391,9 @@
 	/* the same as in strchr, except it loops in reverse direction */
 	while (*ptr != (char) c) {
-		if (ptr == s)
+		if (ptr == s) {
 			return NULL;
-
-		ptr ++;
+		}
+
+		ptr++;
 	}
 
@@ -425,7 +443,8 @@
 
 	const char *ptr;
-	for (ptr = s1; *ptr != '\0'; ++ ptr) {
-		if (!posix_strchr(s2, *ptr))
+	for (ptr = s1; *ptr != '\0'; ++ptr) {
+		if (!posix_strchr(s2, *ptr)) {
 			break;
+		}
 	}
 	return ptr - s1;
@@ -444,14 +463,16 @@
 
 	/* special case - needle is an empty string */
-	if (*s2 == '\0')
+	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))
+		if (begins_with(s1, s2)) {
 			return (char *) s1;
+		}
 		
-		s1 ++;
+		s1++;
 	}
 	
@@ -489,6 +510,7 @@
 	size_t len = posix_strlen(s2);
 
-	if (n > len)
+	if (n > len) {
 		posix_strcpy(s1, s2);
+	}
 
 	return len;
@@ -503,6 +525,7 @@
 {
 	/* uses function from libc, we just have to negate errno
-	   (POSIX uses positive errorcodes, HelenOS has negative) */
-	return (char *) str_error (-errnum);
+	 * (POSIX uses positive errorcodes, HelenOS has negative)
+	 */
+	return (char *) str_error(-errnum);
 }
 
@@ -510,6 +533,6 @@
  *
  * @param errnum Error code
- * @param buf    Buffer to store a human readable string to
- * @param bufsz  Size of buffer pointed to by buf
+ * @param buf Buffer to store a human readable string to
+ * @param bufsz Size of buffer pointed to by buf
  * @return
  */
@@ -552,5 +575,5 @@
 	assert(s != NULL);
 	
-	for (size_t sz = 0; sz < n; ++ sz) {
+	for (size_t sz = 0; sz < n; ++sz) {
 		
 		if (s[sz] == '\0') {
Index: uspace/lib/posix/string.h
===================================================================
--- uspace/lib/posix/string.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/string.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -130,5 +130,5 @@
 	#define strerror posix_strerror
 	#define strerror_r posix_strerror_r
-	#define strsignal(i) ((char*) "SIGNonSense: There are no signals in HelenOS.")
+	#define strsignal(i) ((char *) "SIGNonSense: There are no signals in HelenOS.")
 
 	#define strlen posix_strlen
Index: uspace/lib/posix/strings.c
===================================================================
--- uspace/lib/posix/strings.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/strings.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -39,4 +40,9 @@
 #include "string.h"
 
+/**
+ *
+ * @param i
+ * @return
+ */
 int posix_ffs(int i)
 {
@@ -45,4 +51,10 @@
 }
 
+/**
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
 int posix_strcasecmp(const char *s1, const char *s2)
 {
@@ -51,4 +63,11 @@
 }
 
+/**
+ *
+ * @param s1
+ * @param s2
+ * @param n
+ * @return
+ */
 int posix_strncasecmp(const char *s1, const char *s2, size_t n)
 {
@@ -57,4 +76,11 @@
 }
 
+/**
+ *
+ * @param mem1
+ * @param mem2
+ * @param n
+ * @return
+ */
 int posix_bcmp(const void *mem1, const void *mem2, size_t n)
 {
@@ -63,4 +89,10 @@
 }
 
+/**
+ *
+ * @param dest
+ * @param src
+ * @param n
+ */
 void posix_bcopy(const void *dest, void *src, size_t n)
 {
@@ -69,4 +101,9 @@
 }
 
+/**
+ *
+ * @param mem
+ * @param n
+ */
 void posix_bzero(void *mem, size_t n)
 {
@@ -75,4 +112,10 @@
 }
 
+/**
+ *
+ * @param s
+ * @param c
+ * @return
+ */
 char *posix_index(const char *s, int c)
 {
@@ -80,4 +123,10 @@
 }
 
+/**
+ * 
+ * @param s
+ * @param c
+ * @return
+ */
 char *posix_rindex(const char *s, int c)
 {
@@ -87,3 +136,2 @@
 /** @}
  */
-
Index: uspace/lib/posix/strings.h
===================================================================
--- uspace/lib/posix/strings.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/strings.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -36,8 +37,10 @@
 #define POSIX_STRINGS_H_
 
-extern int posix_ffs(int);
+/* Search Functions */
+extern int posix_ffs(int i);
 
-extern int posix_strcasecmp(const char *, const char *);
-extern int posix_strncasecmp(const char *, const char *, size_t);
+/* String/Array Comparison */
+extern int posix_strcasecmp(const char *s1, const char *s2);
+extern int posix_strncasecmp(const char *s1, const char *s2, size_t n);
 
 /* TODO: not implemented due to missing locale.h
@@ -47,18 +50,17 @@
  */
 
-
 /* 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);
+extern int posix_bcmp(const void *mem1, const void *mem2, size_t n);
+extern void posix_bcopy(const void *dest, void *src, size_t n);
+extern void posix_bzero(void *mem, size_t n);
+extern char *posix_index(const char *s, int c);
+extern char *posix_rindex(const char *s, int c);
 
 #ifndef LIBPOSIX_INTERNAL
 	#define ffs posix_ffs
+
 	#define strcasecmp posix_strcasecmp
 	#define strncasecmp posix_strncasecmp
-	
+
 	#define bcmp posix_bcmp
 	#define bcopy posix_bcopy
Index: uspace/lib/posix/sys/stat.c
===================================================================
--- uspace/lib/posix/sys/stat.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/sys/stat.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,4 +28,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #define LIBPOSIX_INTERNAL
 
@@ -32,7 +39,11 @@
 #include <mem.h>
 
-/* Convert HelenOS stat struct into POSIX stat struct (if possible)
+/**
+ * Convert HelenOS stat struct into POSIX stat struct (if possible)
+ *
+ * @param dest
+ * @param src
  */
-static void stat_to_posix (struct posix_stat *dest, struct stat *src)
+static void stat_to_posix(struct posix_stat *dest, struct stat *src)
 {
 	memset(dest, 0, sizeof(struct posix_stat));
@@ -42,8 +53,10 @@
 	/* HelenOS doesn't support permissions, so we set them all */
 	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
-	if (src->is_file)
+	if (src->is_file) {
 		dest->st_mode |= S_IFREG;
-	if (src->is_directory)
+	}
+	if (src->is_directory) {
 		dest->st_mode |= S_IFDIR;
+	}
 	
 	dest->st_nlink = src->lnkcnt;
@@ -51,4 +64,10 @@
 }
 
+/**
+ *
+ * @param fd
+ * @param st
+ * @return
+ */
 int posix_fstat(int fd, struct posix_stat *st)
 {
@@ -62,4 +81,10 @@
 }
 
+/**
+ *
+ * @param path
+ * @param st
+ * @return
+ */
 int posix_stat(const char *path, struct posix_stat *st)
 {
@@ -73,2 +98,4 @@
 }
 
+/** @}
+ */
Index: uspace/lib/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/sys/stat.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/sys/stat.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,4 +28,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_SYS_STAT_H_
 #define POSIX_SYS_STAT_H_
@@ -34,4 +41,13 @@
 
 /* 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 */
@@ -43,8 +59,15 @@
 #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
@@ -52,4 +75,8 @@
 #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
@@ -57,4 +84,8 @@
 #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
@@ -62,4 +93,11 @@
 #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)
@@ -67,38 +105,46 @@
 #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_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;
+typedef devmap_handle_t posix_dev_t;
+typedef unsigned int posix_ino_t;
+typedef unsigned int posix_nlink_t;
+typedef unsigned int posix_uid_t;
+typedef unsigned int posix_gid_t;
+typedef aoff64_t posix_off_t;
+typedef unsigned int posix_blksize_t;
+typedef unsigned int posix_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 */
+	posix_dev_t     st_dev;     /* ID of device containing file */
+	posix_ino_t     st_ino;     /* inode number */
+	mode_t          st_mode;    /* protection */
+	posix_nlink_t   st_nlink;   /* number of hard links */
+	posix_uid_t     st_uid;     /* user ID of owner */
+	posix_gid_t     st_gid;     /* group ID of owner */
+	posix_dev_t     st_rdev;    /* device ID (if special file) */
+	posix_off_t     st_size;    /* total size, in bytes */
+	posix_blksize_t st_blksize; /* blocksize for file system I/O */
+	posix_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 *);
+extern int posix_fstat(int fd, struct posix_stat *st);
+extern int posix_stat(const char *path, struct posix_stat *st);
 
 #ifndef LIBPOSIX_INTERNAL
+	#define dev_t posix_dev_t
+	#define nlink_t posix_nlink_t
+	#define uid_t posix_uid_t
+	#define gid_t posix_gid_t
+	#define off_t posix_off_t
+	#define blksize_t posix_blksize_t
+	#define blkcnt_t posix_blkcnt_t
+
 	#define fstat posix_fstat
 	#define stat posix_stat
@@ -107,2 +153,4 @@
 #endif /* POSIX_SYS_STAT_H */
 
+/** @}
+ */
Index: uspace/lib/posix/sys/types.h
===================================================================
--- uspace/lib/posix/sys/types.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/sys/types.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,4 +28,10 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_SYS_TYPES_H_
 #define POSIX_SYS_TYPES_H_
@@ -33,6 +40,12 @@
 #include <task.h>
 
-typedef task_id_t pid_t;
+typedef task_id_t posix_pid_t;
+
+#ifndef POSIX_INTERNAL
+	#define pid_t posix_pid_t
+#endif
 
 #endif /* POSIX_SYS_TYPES_H_ */
 
+/** @}
+ */
Index: uspace/lib/posix/time.c
===================================================================
--- uspace/lib/posix/time.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/time.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -36,4 +36,5 @@
 #define LIBPOSIX_INTERNAL
 
+#include "common.h"
 #include "time.h"
 
@@ -83,5 +84,5 @@
 {
 	// TODO
-	return 0;
+	not_implemented();
 }
 
Index: uspace/lib/posix/unistd.c
===================================================================
--- uspace/lib/posix/unistd.c	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/unistd.c	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -27,9 +28,26 @@
  */
 
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
+#define POSIX_INTERNAL
+
+#include "common.h"
 #include "unistd.h"
 
-int isatty(int fd) {
+/**
+ * 
+ * @param fd
+ * @return
+ */
+int posix_isatty(int fd)
+{
 	// TODO
-	return 0;
+	not_implemented();
 }
 
+/** @}
+ */
Index: uspace/lib/posix/unistd.h
===================================================================
--- uspace/lib/posix/unistd.h	(revision ab547063e6898afc80a98b4f9621364f7c9990d8)
+++ uspace/lib/posix/unistd.h	(revision 4f4b4e7fb8b7c20ca4d80eb4a28ba77472c1274e)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
  * All rights reserved.
  *
@@ -26,5 +27,11 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
 #ifndef POSIX_UNISTD_H_
 #define POSIX_UNISTD_H_
@@ -32,18 +39,32 @@
 #include "libc/unistd.h"
 
-/* #include <getopt.h> */
+/* Process Termination */
+#define _exit exit
 
+/* Option Arguments */
 extern char *optarg;
 extern int optind, opterr, optopt;
 extern int getopt(int, char * const [], const char *);
 
-extern int isatty(int fd);
+/* Identifying Terminals */
+extern int posix_isatty(int fd);
 
+/* Process Identification */
 #define getpid task_get_id
 
+/* 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))
+
+#ifndef POSIX_INTERNAL
+	#define isatty posix_isatty
+#endif
 
 #endif /* POSIX_UNISTD_H_ */
 
+/** @}
+ */
