Index: uspace/lib/c/generic/dhcp.c
===================================================================
--- uspace/lib/c/generic/dhcp.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/dhcp.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -84,4 +84,14 @@
 }
 
+int dhcp_discover(sysarg_t link_id)
+{
+	async_exch_t *exch = async_exchange_begin(dhcp_sess);
+
+	int rc = async_req_1_0(exch, DHCP_DISCOVER, link_id);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
 /** @}
  */
Index: uspace/lib/c/generic/fibril.c
===================================================================
--- uspace/lib/c/generic/fibril.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/fibril.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -57,5 +57,5 @@
 /**
  * This futex serializes access to ready_list,
- * serialized_list and manager_list.
+ * serialized_list, manager_list and fibril_list.
  */
 static futex_t fibril_futex = FUTEX_INITIALIZER;
@@ -126,12 +126,19 @@
 	
 	fibril->waits_for = NULL;
+
+	futex_lock(&fibril_futex);
 	list_append(&fibril->all_link, &fibril_list);
+	futex_unlock(&fibril_futex);
 	
 	return fibril;
 }
 
-void fibril_teardown(fibril_t *fibril)
-{
+void fibril_teardown(fibril_t *fibril, bool locked)
+{	
+	if (!locked)
+		futex_lock(&fibril_futex);
 	list_remove(&fibril->all_link);
+	if (!locked)
+		futex_unlock(&fibril_futex);
 	tls_free(fibril->tcb);
 	free(fibril);
@@ -208,5 +215,5 @@
 					as_area_destroy(stack);
 				}
-				fibril_teardown(srcf->clean_after_me);
+				fibril_teardown(srcf->clean_after_me, true);
 				srcf->clean_after_me = NULL;
 			}
@@ -294,5 +301,5 @@
 	    AS_AREA_LATE_RESERVE);
 	if (fibril->stack == (void *) -1) {
-		fibril_teardown(fibril);
+		fibril_teardown(fibril, false);
 		return 0;
 	}
@@ -321,5 +328,5 @@
 	
 	as_area_destroy(fibril->stack);
-	fibril_teardown(fibril);
+	fibril_teardown(fibril, false);
 }
 
Index: uspace/lib/c/generic/getopt.c
===================================================================
--- uspace/lib/c/generic/getopt.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/getopt.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -95,11 +95,8 @@
  * Compute the greatest common divisor of a and b.
  */
-static int
-gcd(a, b)
-	int a;
-	int b;
+static int gcd(int a, int b)
 {
 	int c;
-
+	
 	c = a % b;
 	while (c != 0) {
@@ -108,5 +105,5 @@
 		c = a % b;
 	}
-	   
+	
 	return b;
 }
@@ -117,10 +114,6 @@
  * in each block).
  */
-static void
-permute_args(panonopt_start, panonopt_end, opt_end, nargv)
-	int panonopt_start;
-	int panonopt_end;
-	int opt_end;
-	char **nargv;
+static void permute_args(int panonopt_start, int panonopt_end, int opt_end,
+    char **nargv)
 {
 	int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
@@ -157,9 +150,5 @@
  *  Returns -2 if -- is found (can be long option or end of options marker).
  */
-static int
-getopt_internal(nargc, nargv, options)
-	int nargc;
-	char **nargv;
-	const char *options;
+static int getopt_internal(int nargc, char **nargv, const char *options)
 {
 	const char *oli;				/* option letter list index */
@@ -299,9 +288,5 @@
  *	Parse argc/argv argument vector.
  */
-int
-getopt(nargc, nargv, options)
-	int nargc;
-	char * const *nargv;
-	const char *options;
+int getopt(int nargc, char * const *nargv, const char *options)
 {
 	int retval;
@@ -332,11 +317,6 @@
  *	Parse argc/argv argument vector.
  */
-int
-getopt_long(nargc, nargv, options, long_options, idx)
-	int nargc;
-	char * const *nargv;
-	const char *options;
-	const struct option *long_options;
-	int *idx;
+int getopt_long(int nargc, char * const *nargv, const char *options,
+    const struct option *long_options, int *idx)
 {
 	int retval;
Index: uspace/lib/c/generic/irq.c
===================================================================
--- uspace/lib/c/generic/irq.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/irq.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -35,4 +35,19 @@
 #include <ipc/irq.h>
 #include <libc.h>
+#include <stdlib.h>
+#include <macros.h>
+
+static irq_cmd_t default_cmds[] = {
+	{
+		.cmd = CMD_ACCEPT
+	}
+};
+
+static const irq_code_t default_ucode = {
+	0,
+	NULL,
+	ARRAY_SIZE(default_cmds),
+	default_cmds
+};
 
 /** Subscribe to IRQ notification.
@@ -49,4 +64,7 @@
     const irq_code_t *ucode)
 {
+	if (ucode == NULL)
+		ucode = &default_ucode;
+	
 	return __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, devno, method,
 	    (sysarg_t) ucode);
Index: uspace/lib/c/generic/libc.c
===================================================================
--- uspace/lib/c/generic/libc.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/libc.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -122,5 +122,5 @@
 		__stdio_done();
 		task_retval(status);
-		fibril_teardown(__tcb_get()->fibril_data);
+		fibril_teardown(__tcb_get()->fibril_data, false);
 	}
 	
Index: uspace/lib/c/generic/thread.c
===================================================================
--- uspace/lib/c/generic/thread.c	(revision c3f7d37086023df6580ccd4691db2d699c80ccf6)
+++ uspace/lib/c/generic/thread.c	(revision 048cd69e69ce8a5ca8bbf5d8a5b5451745dca93a)
@@ -88,5 +88,5 @@
 #endif
 	
-	fibril_teardown(fibril);
+	fibril_teardown(fibril, false);
 	
 	thread_exit(0);
