Index: uspace/lib/posix/stdlib.c
===================================================================
--- uspace/lib/posix/stdlib.c	(revision 823a9290ea2b71a1be3c5be4350f38707cd376f7)
+++ uspace/lib/posix/stdlib.c	(revision 2b83add11c5bcd828a9b4eca961890f4cbac0c38)
@@ -37,5 +37,9 @@
 
 #include "stdlib.h"
+#include "libc/sort.h"
+#include "libc/str.h"
+#include "libc/vfs/vfs.h"
 #include "internal/common.h"
+#include <errno.h>  // FIXME: use POSIX errno
 
 /**
@@ -54,4 +58,50 @@
 /**
  * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+int posix_abs(int i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+long posix_labs(long i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+long long posix_llabs(long long i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * Private helper function that serves as a compare function for qsort().
+ *
+ * @param elem1 First element to compare.
+ * @param elem2 Second element to compare.
+ * @param compare Comparison function without userdata parameter.
+ *
+ * @return Relative ordering of the elements.
+ */
+static int sort_compare_wrapper(void *elem1, void *elem2, void *userdata)
+{
+	int (*compare)(const void *, const void *) = userdata;
+	return compare(elem1, elem2);
+}
+
+/**
+ * Array sorting utilizing the quicksort algorithm.
+ *
  * @param array
  * @param count
@@ -59,33 +109,22 @@
  * @param compare
  */
-int posix_abs(int i)
-{
-	// TODO
-	not_implemented();
-}
-
-/**
- *
- * @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
-	not_implemented();
-}
-
-/**
+	/* Implemented in libc with one extra argument. */
+	qsort(array, count, size, sort_compare_wrapper, compare);
+}
+
+/**
+ * Retrieve a value of the given environment variable.
+ * Since HelenOS doesn't support env variables at the moment,
+ * this function always returns NULL.
  *
  * @param name
- * @return
+ * @return Always NULL.
  */
 char *posix_getenv(const char *name)
 {
-	// TODO
-	not_implemented();
+	return NULL;
 }
 
@@ -110,6 +149,40 @@
 char *posix_realpath(const char *name, char *resolved)
 {
-	// TODO
-	not_implemented();
+	#ifndef PATH_MAX
+		assert(resolved == NULL);
+	#endif
+	
+	if (name == NULL) {
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	// TODO: symlink resolution
+	
+	/* Function absolutize is implemented in libc and declared in vfs.h.
+	 * No more processing is required as HelenOS doesn't have symlinks
+	 * so far (as far as I can tell), although this function will need
+	 * to be updated when that support is implemented.
+	 */
+	char* absolute = absolutize(name, NULL);
+	
+	if (absolute == NULL) {
+		/* POSIX requires some specific errnos to be set
+		 * for some cases, but there is no way to find out from
+		 * absolutize().
+		 */
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	if (resolved == NULL) {
+		return absolute;
+	} else {
+		#ifdef PATH_MAX
+			str_cpy(resolved, PATH_MAX, absolute);
+		#endif
+		free(absolute);
+		return resolved;
+	}
 }
 
@@ -119,10 +192,9 @@
  *
  * @param nptr
- * @param endptr
- * @return
- */
-float posix_strtof(const char *restrict nptr, char **restrict endptr)
-{
-	return (float) posix_strtold(nptr, endptr);
+ * @return
+ */
+double posix_atof(const char *nptr)
+{
+	return posix_strtod(nptr, NULL);
 }
 
@@ -135,18 +207,20 @@
  * @return
  */
+float posix_strtof(const char *restrict nptr, char **restrict endptr)
+{
+	return (float) posix_strtold(nptr, endptr);
+}
+
+/**
+ * Converts a string representation of a floating-point number to
+ * its native representation. See posix_strtold().
+ *
+ * @param nptr
+ * @param endptr
+ * @return
+ */
 double posix_strtod(const char *restrict nptr, char **restrict endptr)
 {
 	return (double) posix_strtold(nptr, endptr);
-}
-
-/**
- * 
- * @param str
- * @return
- */
-int posix_atoi(const char *str)
-{
-	// TODO
-	not_implemented();
 }
 
