Index: uspace/lib/c/include/adt/list.h
===================================================================
--- uspace/lib/c/include/adt/list.h	(revision 61eb2ce2769cc7e957b2ee93ca59919d895a7999)
+++ uspace/lib/c/include/adt/list.h	(revision dd218ea076a20828a183015319cffbd31d1769de)
@@ -332,4 +332,7 @@
 _NO_TRACE static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
 {
+	if (part1 == NULL || part2 == NULL)
+		return;
+
 	part1->prev->next = part2;
 	part2->prev->next = part1;
@@ -371,4 +374,23 @@
 }
 
+/** Swap the contents of two lists.
+ *
+ * @param list1
+ * @param list2
+ */
+static inline void list_swap(list_t *list1, list_t *list2)
+{
+	link_t *first1 = list_first(list1);
+	link_t *first2 = list_first(list2);
+
+	/* Detach both lists from their heads. */
+	headless_list_split(&list1->head, first1);
+	headless_list_split(&list2->head, first2);
+
+	/* Attach both lists to their new heads. */
+	headless_list_concat(&list1->head, first2);
+	headless_list_concat(&list2->head, first1);
+}
+
 /** Concatenate two lists
  *
