Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/c/Makefile	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -193,4 +193,5 @@
 	test/qsort.c \
 	test/sprintf.c \
+	test/stdlib.c \
 	test/str.c
 
Index: uspace/lib/c/generic/stdlib.c
===================================================================
--- uspace/lib/c/generic/stdlib.c	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/c/generic/stdlib.c	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -47,4 +47,52 @@
 }
 
+/** Compute quotient and remainder of int division.
+ *
+ * @param numer Numerator
+ * @param denom Denominator
+ * @return Structure containing quotient and remainder
+ */
+div_t div(int numer, int denom)
+{
+	div_t d;
+
+	d.quot = numer / denom;
+	d.rem = numer % denom;
+
+	return d;
+}
+
+/** Compute quotient and remainder of long division.
+ *
+ * @param numer Numerator
+ * @param denom Denominator
+ * @return Structure containing quotient and remainder
+ */
+ldiv_t ldiv(long numer, long denom)
+{
+	ldiv_t d;
+
+	d.quot = numer / denom;
+	d.rem = numer % denom;
+
+	return d;
+}
+
+/** Compute quotient and remainder of long long division.
+ *
+ * @param numer Numerator
+ * @param denom Denominator
+ * @return Structure containing quotient and remainder
+ */
+lldiv_t lldiv(long long numer, long long denom)
+{
+	lldiv_t d;
+
+	d.quot = numer / denom;
+	d.rem = numer % denom;
+
+	return d;
+}
+
 /** @}
  */
Index: uspace/lib/c/include/stdlib.h
===================================================================
--- uspace/lib/c/include/stdlib.h	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/c/include/stdlib.h	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -36,11 +36,40 @@
 #define LIBC_STDLIB_H_
 
+#include <_bits/size_t.h>
+#include <_bits/wchar_t.h>
 #include <malloc.h>
 #include <qsort.h>
 
-#define RAND_MAX  714025
+/** Type returned by the div function */
+typedef struct {
+	/** Quotient */
+	int quot;
+	/** Remainder */
+	int rem;
+} div_t;
+
+/** Type returned by the ldiv function */
+typedef struct {
+	/** Quotient */
+	long quot;
+	/** Remainder */
+	long rem;
+} ldiv_t;
+
+/** Type returned by the lldiv function */
+typedef struct {
+	/** Quotient */
+	long long quot;
+	/** Remainder */
+	long long rem;
+} lldiv_t;
+
 
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
+
+#define RAND_MAX  714025
+
+#define MB_CUR_MAX 4
 
 extern int rand(void);
@@ -59,4 +88,8 @@
 extern unsigned long long strtoull(const char *__restrict__, char **__restrict__, int);
 
+extern div_t div(int, int);
+extern ldiv_t ldiv(long, long);
+extern lldiv_t lldiv(long long, long long);
+
 #endif
 
Index: uspace/lib/c/test/main.c
===================================================================
--- uspace/lib/c/test/main.c	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/c/test/main.c	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -38,4 +38,5 @@
 PCUT_IMPORT(scanf);
 PCUT_IMPORT(sprintf);
+PCUT_IMPORT(stdlib);
 PCUT_IMPORT(str);
 PCUT_IMPORT(table);
Index: uspace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/posix/include/posix/stdlib.h	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -52,22 +52,4 @@
 extern long long llabs(long long i);
 
-/* Integer Division */
-
-typedef struct {
-	int quot, rem;
-} div_t;
-
-typedef struct {
-	long quot, rem;
-} ldiv_t;
-
-typedef struct {
-	long long quot, rem;
-} lldiv_t;
-
-extern div_t div(int numer, int denom);
-extern ldiv_t ldiv(long numer, long denom);
-extern lldiv_t lldiv(long long numer, long long denom);
-
 /* Array Functions */
 extern void *bsearch(const void *key, const void *base,
Index: uspace/lib/posix/src/stdlib.c
===================================================================
--- uspace/lib/posix/src/stdlib.c	(revision 55092672530a7c5f20b1e050bbe7c09cd6527df6)
+++ uspace/lib/posix/src/stdlib.c	(revision 8338a81e441a841d8987874fd886687c76a0c0b0)
@@ -95,40 +95,4 @@
 {
 	return i < 0 ? -i : i;
-}
-
-/**
- * Compute the quotient and remainder of an integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-div_t div(int numer, int denom)
-{
-	return (div_t) { .quot = numer / denom, .rem = numer % denom };
-}
-
-/**
- * Compute the quotient and remainder of a long integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-ldiv_t ldiv(long numer, long denom)
-{
-	return (ldiv_t) { .quot = numer / denom, .rem = numer % denom };
-}
-
-/**
- * Compute the quotient and remainder of a long long integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-lldiv_t lldiv(long long numer, long long denom)
-{
-	return (lldiv_t) { .quot = numer / denom, .rem = numer % denom };
 }
 
