Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 3b8a9907a4d66e672bf96c07661354131bae092f)
+++ uspace/lib/c/Makefile	(revision 0aae87a68b103134fdc85e357962274d6849b220)
@@ -140,4 +140,5 @@
 	generic/net/socket_client.c \
 	generic/net/socket_parse.c \
+	generic/stack.c \
 	generic/stacktrace.c \
 	generic/arg_parse.c \
Index: uspace/lib/c/generic/fibril.c
===================================================================
--- uspace/lib/c/generic/fibril.c	(revision 3b8a9907a4d66e672bf96c07661354131bae092f)
+++ uspace/lib/c/generic/fibril.c	(revision 0aae87a68b103134fdc85e357962274d6849b220)
@@ -37,4 +37,5 @@
 #include <fibril.h>
 #include <thread.h>
+#include <stack.h>
 #include <tls.h>
 #include <malloc.h>
@@ -271,6 +272,6 @@
 		return 0;
 	
-	fibril->stack = as_area_create((void *) -1,
-	    FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(),
+	size_t stack_size = stack_size_get();
+	fibril->stack = as_area_create((void *) -1, stack_size,
 	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
 	    AS_AREA_LATE_RESERVE);
@@ -285,5 +286,5 @@
 	context_save(&fibril->ctx);
 	context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack,
-	    FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);
+	    stack_size, fibril->tcb);
 
 	return (fid_t) fibril;
Index: uspace/lib/c/generic/stack.c
===================================================================
--- uspace/lib/c/generic/stack.c	(revision 0aae87a68b103134fdc85e357962274d6849b220)
+++ uspace/lib/c/generic/stack.c	(revision 0aae87a68b103134fdc85e357962274d6849b220)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012 Jakub Jermar
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+
+#include <stack.h>
+#include <sysinfo.h>
+
+size_t stack_size_get(void)
+{
+	static sysarg_t stack_size = 0;
+
+	if (!stack_size)
+		sysinfo_get_value("default.stack_size", &stack_size);
+
+	return (size_t) stack_size;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/thread.c
===================================================================
--- uspace/lib/c/generic/thread.c	(revision 3b8a9907a4d66e672bf96c07661354131bae092f)
+++ uspace/lib/c/generic/thread.c	(revision 0aae87a68b103134fdc85e357962274d6849b220)
@@ -39,4 +39,5 @@
 #include <abi/proc/uarg.h>
 #include <fibril.h>
+#include <stack.h>
 #include <str.h>
 #include <async.h>
@@ -101,5 +102,5 @@
 		return ENOMEM;
 	
-	size_t stack_size = getpagesize() * THREAD_INITIAL_STACK_PAGES;
+	size_t stack_size = stack_size_get();
 	void *stack = as_area_create(AS_AREA_ANY, stack_size,
 	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
Index: uspace/lib/c/include/stack.h
===================================================================
--- uspace/lib/c/include/stack.h	(revision 0aae87a68b103134fdc85e357962274d6849b220)
+++ uspace/lib/c/include/stack.h	(revision 0aae87a68b103134fdc85e357962274d6849b220)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012 Jakub Jermar
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_STACK_H_
+#define LIBC_STACK_H_
+
+#include <libarch/types.h>
+
+extern size_t stack_size_get(void);
+
+#endif
+
+/** @}
+ */
