Index: kernel/generic/src/proc/program.c
===================================================================
--- kernel/generic/src/proc/program.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
+++ kernel/generic/src/proc/program.c	(revision 0c793e2e9c4358a2bb2521d35eb36b273cf0283b)
@@ -75,5 +75,5 @@
 	if (!prg->task)
 		return ELIMIT;
-	
+
 	/*
 	 * Create the stack address space area.
@@ -94,8 +94,8 @@
 		return ENOMEM;
 	}
-	
+
 	uspace_arg_t *kernel_uarg = (uspace_arg_t *)
 	    malloc(sizeof(uspace_arg_t), 0);
-	
+
 	kernel_uarg->uspace_entry = (void *) entry_addr;
 	kernel_uarg->uspace_stack = (void *) virt;
@@ -104,5 +104,5 @@
 	kernel_uarg->uspace_thread_arg = NULL;
 	kernel_uarg->uspace_uarg = NULL;
-	
+
 	/*
 	 * Create the main thread.
@@ -117,5 +117,5 @@
 		return ELIMIT;
 	}
-	
+
 	return EOK;
 }
@@ -142,5 +142,5 @@
 	if (!as)
 		return ENOMEM;
-	
+
 	prg->loader_status = elf_load((elf_header_t *) image_addr, as, 0);
 	if (prg->loader_status != EE_OK) {
@@ -148,18 +148,18 @@
 		prg->task = NULL;
 		prg->main_thread = NULL;
-		
+
 		if (prg->loader_status != EE_LOADER)
 			return ENOTSUP;
-		
+
 		/* Register image as the program loader */
 		if (program_loader != NULL)
 			return ELIMIT;
-		
+
 		program_loader = image_addr;
 		log(LF_OTHER, LVL_NOTE, "Program loader at %p", (void *) image_addr);
-		
+
 		return EOK;
 	}
-	
+
 	return program_create(as, ((elf_header_t *) image_addr)->e_entry,
 	    name, prg);
@@ -179,5 +179,5 @@
 	if (!as)
 		return ENOMEM;
-	
+
 	void *loader = program_loader;
 	if (!loader) {
@@ -187,5 +187,5 @@
 		return ENOENT;
 	}
-	
+
 	prg->loader_status = elf_load((elf_header_t *) program_loader, as,
 	    ELD_F_LOADER);
@@ -196,5 +196,5 @@
 		return ENOENT;
 	}
-	
+
 	return program_create(as, ((elf_header_t *) program_loader)->e_entry,
 	    name, prg);
@@ -230,12 +230,12 @@
 	if (name_len > TASK_NAME_BUFLEN - 1)
 		name_len = TASK_NAME_BUFLEN - 1;
-	
+
 	char namebuf[TASK_NAME_BUFLEN];
 	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != EOK)
 		return (sys_errno_t) rc;
-	
+
 	namebuf[name_len] = 0;
-	
+
 	/* Spawn the new task. */
 	program_t prg;
@@ -243,9 +243,9 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	// FIXME: control the permissions
 	perm_set(prg.task, perm_get(TASK));
 	program_ready(&prg);
-	
+
 	return EOK;
 }
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
+++ kernel/generic/src/proc/scheduler.c	(revision 0c793e2e9c4358a2bb2521d35eb36b273cf0283b)
@@ -90,5 +90,5 @@
 	before_thread_runs_arch();
 	rcu_before_thread_runs();
-	
+
 #ifdef CONFIG_FPU_LAZY
 	if (THREAD == CPU->fpu_owner)
@@ -105,5 +105,5 @@
 	}
 #endif
-	
+
 #ifdef CONFIG_UDEBUG
 	if (THREAD->btrace) {
@@ -113,5 +113,5 @@
 			stack_trace_istate(istate);
 		}
-		
+
 		THREAD->btrace = false;
 	}
@@ -141,10 +141,10 @@
 	fpu_enable();
 	irq_spinlock_lock(&CPU->lock, false);
-	
+
 	/* Save old context */
 	if (CPU->fpu_owner != NULL) {
 		irq_spinlock_lock(&CPU->fpu_owner->lock, false);
 		fpu_context_save(CPU->fpu_owner->saved_fpu_context);
-		
+
 		/* Don't prevent migration */
 		CPU->fpu_owner->fpu_context_engaged = false;
@@ -152,5 +152,5 @@
 		CPU->fpu_owner = NULL;
 	}
-	
+
 	irq_spinlock_lock(&THREAD->lock, false);
 	if (THREAD->fpu_context_exists) {
@@ -164,5 +164,5 @@
 			THREAD->saved_fpu_context =
 			    (fpu_context_t *) slab_alloc(fpu_context_cache, 0);
-			
+
 			/* We may have switched CPUs during slab_alloc */
 			goto restart;
@@ -171,9 +171,9 @@
 		THREAD->fpu_context_exists = true;
 	}
-	
+
 	CPU->fpu_owner = THREAD;
 	THREAD->fpu_context_engaged = true;
 	irq_spinlock_unlock(&THREAD->lock, false);
-	
+
 	irq_spinlock_unlock(&CPU->lock, false);
 }
@@ -201,7 +201,7 @@
 {
 	assert(CPU != NULL);
-	
+
 loop:
-	
+
 	if (atomic_get(&CPU->nrdy) == 0) {
 		/*
@@ -214,5 +214,5 @@
 		irq_spinlock_unlock(&CPU->lock, false);
 		interrupts_enable();
-		
+
 		/*
 		 * An interrupt might occur right now and wake up a thread.
@@ -226,5 +226,5 @@
 
 	assert(!CPU->idle);
-	
+
 	unsigned int i;
 	for (i = 0; i < RQ_COUNT; i++) {
@@ -237,9 +237,9 @@
 			continue;
 		}
-		
+
 		atomic_dec(&CPU->nrdy);
 		atomic_dec(&nrdy);
 		CPU->rq[i].n--;
-		
+
 		/*
 		 * Take the first thread from the queue.
@@ -248,11 +248,11 @@
 		    list_first(&CPU->rq[i].rq), thread_t, rq_link);
 		list_remove(&thread->rq_link);
-		
+
 		irq_spinlock_pass(&(CPU->rq[i].lock), &thread->lock);
-		
+
 		thread->cpu = CPU;
 		thread->ticks = us2ticks((i + 1) * 10000);
 		thread->priority = i;  /* Correct rq index */
-		
+
 		/*
 		 * Clear the stolen flag so that it can be migrated
@@ -261,8 +261,8 @@
 		thread->stolen = false;
 		irq_spinlock_unlock(&thread->lock, false);
-		
+
 		return thread;
 	}
-	
+
 	goto loop;
 }
@@ -282,13 +282,13 @@
 {
 	list_t list;
-	
+
 	list_initialize(&list);
 	irq_spinlock_lock(&CPU->lock, false);
-	
+
 	if (CPU->needs_relink > NEEDS_RELINK_MAX) {
 		int i;
 		for (i = start; i < RQ_COUNT - 1; i++) {
 			/* Remember and empty rq[i + 1] */
-			
+
 			irq_spinlock_lock(&CPU->rq[i + 1].lock, false);
 			list_concat(&list, &CPU->rq[i + 1].rq);
@@ -296,7 +296,7 @@
 			CPU->rq[i + 1].n = 0;
 			irq_spinlock_unlock(&CPU->rq[i + 1].lock, false);
-			
+
 			/* Append rq[i + 1] to rq[i] */
-			
+
 			irq_spinlock_lock(&CPU->rq[i].lock, false);
 			list_concat(&CPU->rq[i].rq, &list);
@@ -304,8 +304,8 @@
 			irq_spinlock_unlock(&CPU->rq[i].lock, false);
 		}
-		
+
 		CPU->needs_relink = 0;
 	}
-	
+
 	irq_spinlock_unlock(&CPU->lock, false);
 }
@@ -321,18 +321,18 @@
 {
 	volatile ipl_t ipl;
-	
+
 	assert(CPU != NULL);
-	
+
 	ipl = interrupts_disable();
-	
+
 	if (atomic_get(&haltstate))
 		halt();
-	
+
 	if (THREAD) {
 		irq_spinlock_lock(&THREAD->lock, false);
-		
+
 		/* Update thread kernel accounting */
 		THREAD->kcycles += get_cycle() - THREAD->last_cycle;
-		
+
 #if (defined CONFIG_FPU) && (!defined CONFIG_FPU_LAZY)
 		fpu_context_save(THREAD->saved_fpu_context);
@@ -342,14 +342,14 @@
 			 * This is the place where threads leave scheduler();
 			 */
-			
+
 			/* Save current CPU cycle */
 			THREAD->last_cycle = get_cycle();
-			
+
 			irq_spinlock_unlock(&THREAD->lock, false);
 			interrupts_restore(THREAD->saved_context.ipl);
-			
+
 			return;
 		}
-		
+
 		/*
 		 * Interrupt priority level of preempted thread is recorded
@@ -360,5 +360,5 @@
 		THREAD->saved_context.ipl = ipl;
 	}
-	
+
 	/*
 	 * Through the 'THE' structure, we keep track of THREAD, TASK, CPU, AS
@@ -368,5 +368,5 @@
 	 */
 	the_copy(THE, (the_t *) CPU->stack);
-	
+
 	/*
 	 * We may not keep the old stack.
@@ -386,5 +386,5 @@
 	    (uintptr_t) CPU->stack, STACK_SIZE);
 	context_restore(&CPU->saved_context);
-	
+
 	/* Not reached */
 }
@@ -402,9 +402,9 @@
 	task_t *old_task = TASK;
 	as_t *old_as = AS;
-	
+
 	assert((!THREAD) || (irq_spinlock_locked(&THREAD->lock)));
 	assert(CPU != NULL);
 	assert(interrupts_disabled());
-	
+
 	/*
 	 * Hold the current task and the address space to prevent their
@@ -414,12 +414,12 @@
 	if (old_task)
 		task_hold(old_task);
-	
+
 	if (old_as)
 		as_hold(old_as);
-	
+
 	if (THREAD) {
 		/* Must be run after the switch to scheduler stack */
 		after_thread_ran();
-		
+
 		switch (THREAD->state) {
 		case Running:
@@ -427,5 +427,5 @@
 			thread_ready(THREAD);
 			break;
-		
+
 		case Exiting:
 			rcu_thread_exiting();
@@ -452,10 +452,10 @@
 				    WAKEUP_FIRST);
 				irq_spinlock_unlock(&THREAD->join_wq.lock, false);
-				
+
 				THREAD->state = Lingering;
 				irq_spinlock_unlock(&THREAD->lock, false);
 			}
 			break;
-			
+
 		case Sleeping:
 			/*
@@ -463,5 +463,5 @@
 			 */
 			THREAD->priority = -1;
-			
+
 			/*
 			 * We need to release wq->lock which we locked in
@@ -470,8 +470,8 @@
 			 */
 			irq_spinlock_unlock(&THREAD->sleep_queue->lock, false);
-			
+
 			irq_spinlock_unlock(&THREAD->lock, false);
 			break;
-		
+
 		default:
 			/*
@@ -482,16 +482,16 @@
 			break;
 		}
-		
+
 		THREAD = NULL;
 	}
-	
+
 	THREAD = find_best_thread();
-	
+
 	irq_spinlock_lock(&THREAD->lock, false);
 	int priority = THREAD->priority;
 	irq_spinlock_unlock(&THREAD->lock, false);
-	
+
 	relink_rq(priority);
-	
+
 	/*
 	 * If both the old and the new task are the same,
@@ -500,5 +500,5 @@
 	if (TASK != THREAD->task) {
 		as_t *new_as = THREAD->task->as;
-		
+
 		/*
 		 * Note that it is possible for two tasks
@@ -512,18 +512,18 @@
 			as_switch(old_as, new_as);
 		}
-		
+
 		TASK = THREAD->task;
 		before_task_runs();
 	}
-	
+
 	if (old_task)
 		task_release(old_task);
-	
+
 	if (old_as)
 		as_release(old_as);
-	
+
 	irq_spinlock_lock(&THREAD->lock, false);
 	THREAD->state = Running;
-	
+
 #ifdef SCHEDULER_VERBOSE
 	log(LF_OTHER, LVL_DEBUG,
@@ -532,5 +532,5 @@
 	    THREAD->ticks, atomic_get(&CPU->nrdy));
 #endif
-	
+
 	/*
 	 * Some architectures provide late kernel PA2KA(identity)
@@ -542,5 +542,5 @@
 	 */
 	before_thread_runs();
-	
+
 	/*
 	 * Copy the knowledge of CPU, TASK, THREAD and preemption counter to
@@ -548,7 +548,7 @@
 	 */
 	the_copy(THE, (the_t *) THREAD->kstack);
-	
+
 	context_restore(&THREAD->saved_context);
-	
+
 	/* Not reached */
 }
@@ -567,10 +567,10 @@
 	atomic_count_t average;
 	atomic_count_t rdy;
-	
+
 	/*
 	 * Detach kcpulb as nobody will call thread_join_timeout() on it.
 	 */
 	thread_detach(THREAD);
-	
+
 loop:
 	/*
@@ -578,5 +578,5 @@
 	 */
 	thread_sleep(1);
-	
+
 not_satisfied:
 	/*
@@ -588,10 +588,10 @@
 	average = atomic_get(&nrdy) / config.cpu_active + 1;
 	rdy = atomic_get(&CPU->nrdy);
-	
+
 	if (average <= rdy)
 		goto satisfied;
-	
+
 	atomic_count_t count = average - rdy;
-	
+
 	/*
 	 * Searching least priority queues on all CPU's first and most priority
@@ -601,9 +601,9 @@
 	size_t acpu_bias = 0;
 	int rq;
-	
+
 	for (rq = RQ_COUNT - 1; rq >= 0; rq--) {
 		for (acpu = 0; acpu < config.cpu_active; acpu++) {
 			cpu_t *cpu = &cpus[(acpu + acpu_bias) % config.cpu_active];
-			
+
 			/*
 			 * Not interested in ourselves.
@@ -614,8 +614,8 @@
 			if (CPU == cpu)
 				continue;
-			
+
 			if (atomic_get(&cpu->nrdy) <= average)
 				continue;
-			
+
 			irq_spinlock_lock(&(cpu->rq[rq].lock), true);
 			if (cpu->rq[rq].n == 0) {
@@ -623,14 +623,14 @@
 				continue;
 			}
-			
+
 			thread_t *thread = NULL;
-			
+
 			/* Search rq from the back */
 			link_t *link = cpu->rq[rq].rq.head.prev;
-			
+
 			while (link != &(cpu->rq[rq].rq.head)) {
 				thread = (thread_t *) list_get_instance(link,
 				    thread_t, rq_link);
-				
+
 				/*
 				 * Do not steal CPU-wired threads, threads
@@ -640,5 +640,5 @@
 				 */
 				irq_spinlock_lock(&thread->lock, false);
-				
+
 				if ((!thread->wired) && (!thread->stolen) &&
 				    (!thread->nomigrate) &&
@@ -649,28 +649,28 @@
 					irq_spinlock_unlock(&thread->lock,
 					    false);
-					
+
 					atomic_dec(&cpu->nrdy);
 					atomic_dec(&nrdy);
-					
+
 					cpu->rq[rq].n--;
 					list_remove(&thread->rq_link);
-					
+
 					break;
 				}
-				
+
 				irq_spinlock_unlock(&thread->lock, false);
-				
+
 				link = link->prev;
 				thread = NULL;
 			}
-			
+
 			if (thread) {
 				/*
 				 * Ready thread on local CPU
 				 */
-				
+
 				irq_spinlock_pass(&(cpu->rq[rq].lock),
 				    &thread->lock);
-				
+
 #ifdef KCPULB_VERBOSE
 				log(LF_OTHER, LVL_DEBUG,
@@ -680,14 +680,14 @@
 				    atomic_get(&nrdy) / config.cpu_active);
 #endif
-				
+
 				thread->stolen = true;
 				thread->state = Entering;
-				
+
 				irq_spinlock_unlock(&thread->lock, true);
 				thread_ready(thread);
-				
+
 				if (--count == 0)
 					goto satisfied;
-				
+
 				/*
 				 * We are not satisfied yet, focus on another
@@ -696,12 +696,12 @@
 				 */
 				acpu_bias++;
-				
+
 				continue;
 			} else
 				irq_spinlock_unlock(&(cpu->rq[rq].lock), true);
-			
-		}
-	}
-	
+
+		}
+	}
+
 	if (atomic_get(&CPU->nrdy)) {
 		/*
@@ -718,7 +718,7 @@
 		goto loop;
 	}
-	
+
 	goto not_satisfied;
-	
+
 satisfied:
 	goto loop;
@@ -735,11 +735,11 @@
 		if (!cpus[cpu].active)
 			continue;
-		
+
 		irq_spinlock_lock(&cpus[cpu].lock, true);
-		
+
 		printf("cpu%u: address=%p, nrdy=%" PRIua ", needs_relink=%zu\n",
 		    cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
 		    cpus[cpu].needs_relink);
-		
+
 		unsigned int i;
 		for (i = 0; i < RQ_COUNT; i++) {
@@ -749,5 +749,5 @@
 				continue;
 			}
-			
+
 			printf("\trq[%u]: ", i);
 			list_foreach(cpus[cpu].rq[i].rq, rq_link, thread_t,
@@ -757,8 +757,8 @@
 			}
 			printf("\n");
-			
+
 			irq_spinlock_unlock(&(cpus[cpu].rq[i].lock), false);
 		}
-		
+
 		irq_spinlock_unlock(&cpus[cpu].lock, true);
 	}
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
+++ kernel/generic/src/proc/task.c	(revision 0c793e2e9c4358a2bb2521d35eb36b273cf0283b)
@@ -107,15 +107,15 @@
 	task_t *task = avltree_get_instance(node, task_t, tasks_tree_node);
 	size_t *cnt = (size_t *) arg;
-	
+
 	if (task != TASK) {
 		(*cnt)++;
-		
+
 #ifdef CONFIG_DEBUG
 		printf("[%"PRIu64"] ", task->taskid);
 #endif
-		
+
 		task_kill_internal(task);
 	}
-	
+
 	/* Continue the walk */
 	return true;
@@ -138,5 +138,5 @@
 		task_release(task_0);
 	}
-	
+
 	/* Repeat until there are any tasks except TASK */
 	do {
@@ -144,12 +144,12 @@
 		printf("Killing tasks... ");
 #endif
-		
+
 		irq_spinlock_lock(&tasks_lock, true);
 		tasks_left = 0;
 		avltree_walk(&tasks_tree, task_done_walker, &tasks_left);
 		irq_spinlock_unlock(&tasks_lock, true);
-		
+
 		thread_sleep(1);
-		
+
 #ifdef CONFIG_DEBUG
 		printf("\n");
@@ -165,17 +165,17 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	atomic_set(&task->refcount, 0);
 	atomic_set(&task->lifecount, 0);
-	
+
 	irq_spinlock_initialize(&task->lock, "task_t_lock");
-	
+
 	list_initialize(&task->threads);
-	
+
 	ipc_answerbox_init(&task->answerbox, task);
-	
+
 	spinlock_initialize(&task->active_calls_lock, "active_calls_lock");
 	list_initialize(&task->active_calls);
-		
+
 #ifdef CONFIG_UDEBUG
 	/* Init kbox stuff */
@@ -184,5 +184,5 @@
 	mutex_initialize(&task->kb.cleanup_lock, MUTEX_PASSIVE);
 #endif
-	
+
 	return EOK;
 }
@@ -191,5 +191,5 @@
 {
 	task_t *task = (task_t *) obj;
-	
+
 	caps_task_free(task);
 	return 0;
@@ -210,10 +210,10 @@
 		return NULL;
 	}
-	
+
 	task_create_arch(task);
-	
+
 	task->as = as;
 	str_cpy(task->name, TASK_NAME_BUFLEN, name);
-	
+
 	task->container = CONTAINER;
 	task->perms = 0;
@@ -231,5 +231,5 @@
 
 	event_task_init(task);
-	
+
 	task->answerbox.active = true;
 
@@ -237,10 +237,10 @@
 	/* Init debugging stuff */
 	udebug_task_init(&task->udebug);
-	
+
 	/* Init kbox stuff */
 	task->kb.box.active = true;
 	task->kb.finished = false;
 #endif
-	
+
 	if ((ipc_phone_0) &&
 	    (container_check(ipc_phone_0->task->container, task->container))) {
@@ -253,26 +253,26 @@
 			return NULL;
 		}
-		
+
 		kobject_t *phone_obj = kobject_get(task, phone_handle,
 		    KOBJECT_TYPE_PHONE);
 		(void) ipc_phone_connect(phone_obj->phone, ipc_phone_0);
 	}
-	
+
 	futex_task_init(task);
-	
+
 	/*
 	 * Get a reference to the address space.
 	 */
 	as_hold(task->as);
-	
+
 	irq_spinlock_lock(&tasks_lock, true);
-	
+
 	task->taskid = ++task_counter;
 	avltree_node_initialize(&task->tasks_tree_node);
 	task->tasks_tree_node.key = task->taskid;
 	avltree_insert(&tasks_tree, &task->tasks_tree_node);
-	
+
 	irq_spinlock_unlock(&tasks_lock, true);
-	
+
 	return task;
 }
@@ -291,20 +291,20 @@
 	avltree_delete(&tasks_tree, &task->tasks_tree_node);
 	irq_spinlock_unlock(&tasks_lock, true);
-	
+
 	/*
 	 * Perform architecture specific task destruction.
 	 */
 	task_destroy_arch(task);
-	
+
 	/*
 	 * Free up dynamically allocated state.
 	 */
 	futex_task_deinit(task);
-	
+
 	/*
 	 * Drop our reference to the address space.
 	 */
 	as_release(task->as);
-	
+
 	slab_free(task_cache, task);
 }
@@ -388,15 +388,15 @@
 {
 	char namebuf[TASK_NAME_BUFLEN];
-	
+
 	/* Cap length of name and copy it from userspace. */
 	if (name_len > TASK_NAME_BUFLEN - 1)
 		name_len = TASK_NAME_BUFLEN - 1;
-	
+
 	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != EOK)
 		return (sys_errno_t) rc;
-	
+
 	namebuf[name_len] = '\0';
-	
+
 	/*
 	 * As the task name is referenced also from the
@@ -404,16 +404,16 @@
 	 * of the update.
 	 */
-	
+
 	irq_spinlock_lock(&tasks_lock, true);
 	irq_spinlock_lock(&TASK->lock, false);
 	irq_spinlock_lock(&threads_lock, false);
-	
+
 	/* Set task name */
 	str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf);
-	
+
 	irq_spinlock_unlock(&threads_lock, false);
 	irq_spinlock_unlock(&TASK->lock, false);
 	irq_spinlock_unlock(&tasks_lock, true);
-	
+
 	return EOK;
 }
@@ -432,5 +432,5 @@
 	if (rc != EOK)
 		return (sys_errno_t) rc;
-	
+
 	return (sys_errno_t) task_kill(taskid);
 }
@@ -453,8 +453,8 @@
 	avltree_node_t *node =
 	    avltree_search(&tasks_tree, (avltree_key_t) id);
-	
+
 	if (node)
 		return avltree_get_instance(node, task_t, tasks_tree_node);
-	
+
 	return NULL;
 }
@@ -478,9 +478,9 @@
 	uint64_t uret = task->ucycles;
 	uint64_t kret = task->kcycles;
-	
+
 	/* Current values of threads */
 	list_foreach(task->threads, th_link, thread_t, thread) {
 		irq_spinlock_lock(&thread->lock, false);
-		
+
 		/* Process only counted threads */
 		if (!thread->uncounted) {
@@ -489,12 +489,12 @@
 				thread_update_accounting(false);
 			}
-			
+
 			uret += thread->ucycles;
 			kret += thread->kcycles;
 		}
-		
+
 		irq_spinlock_unlock(&thread->lock, false);
 	}
-	
+
 	*ucycles = uret;
 	*kcycles = kret;
@@ -505,24 +505,24 @@
 	irq_spinlock_lock(&task->lock, false);
 	irq_spinlock_lock(&threads_lock, false);
-	
+
 	/*
 	 * Interrupt all threads.
 	 */
-	
+
 	list_foreach(task->threads, th_link, thread_t, thread) {
 		bool sleeping = false;
-		
+
 		irq_spinlock_lock(&thread->lock, false);
-		
+
 		thread->interrupted = true;
 		if (thread->state == Sleeping)
 			sleeping = true;
-		
+
 		irq_spinlock_unlock(&thread->lock, false);
-		
+
 		if (sleeping)
 			waitq_interrupt_sleep(thread);
 	}
-	
+
 	irq_spinlock_unlock(&threads_lock, false);
 	irq_spinlock_unlock(&task->lock, false);
@@ -543,7 +543,7 @@
 	if (id == 1)
 		return EPERM;
-	
+
 	irq_spinlock_lock(&tasks_lock, true);
-	
+
 	task_t *task = task_find_by_id(id);
 	if (!task) {
@@ -551,8 +551,8 @@
 		return ENOENT;
 	}
-	
+
 	task_kill_internal(task);
 	irq_spinlock_unlock(&tasks_lock, true);
-	
+
 	return EOK;
 }
@@ -583,9 +583,9 @@
 		}
 	}
-	
+
 	irq_spinlock_lock(&tasks_lock, true);
 	task_kill_internal(TASK);
 	irq_spinlock_unlock(&tasks_lock, true);
-	
+
 	thread_exit();
 }
@@ -599,5 +599,5 @@
 {
 	task_kill_self(notify);
-	
+
 	/* Unreachable */
 	return EOK;
@@ -609,5 +609,5 @@
 	task_t *task = avltree_get_instance(node, task_t, tasks_tree_node);
 	irq_spinlock_lock(&task->lock, false);
-	
+
 	uint64_t ucycles;
 	uint64_t kcycles;
@@ -616,5 +616,5 @@
 	order_suffix(ucycles, &ucycles, &usuffix);
 	order_suffix(kcycles, &kcycles, &ksuffix);
-	
+
 #ifdef __32_BITS__
 	if (*additional)
@@ -627,5 +627,5 @@
 		    ucycles, usuffix, kcycles, ksuffix);
 #endif
-	
+
 #ifdef __64_BITS__
 	if (*additional)
@@ -637,5 +637,5 @@
 		    task->taskid, task->name, task->container, task, task->as);
 #endif
-	
+
 	irq_spinlock_unlock(&task->lock, false);
 	return true;
@@ -651,5 +651,5 @@
 	/* Messing with task structures, avoid deadlock */
 	irq_spinlock_lock(&tasks_lock, true);
-	
+
 #ifdef __32_BITS__
 	if (additional)
@@ -659,5 +659,5 @@
 		    " [ucycles ] [kcycles ]\n");
 #endif
-	
+
 #ifdef __64_BITS__
 	if (additional)
@@ -668,7 +668,7 @@
 		    " [as              ]\n");
 #endif
-	
+
 	avltree_walk(&tasks_tree, task_print_walker, &additional);
-	
+
 	irq_spinlock_unlock(&tasks_lock, true);
 }
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
+++ kernel/generic/src/proc/thread.c	(revision 0c793e2e9c4358a2bb2521d35eb36b273cf0283b)
@@ -122,11 +122,11 @@
 	void *arg = THREAD->thread_arg;
 	THREAD->last_cycle = get_cycle();
-	
+
 	/* This is where each thread wakes up after its creation */
 	irq_spinlock_unlock(&THREAD->lock, false);
 	interrupts_enable();
-	
+
 	f(arg);
-	
+
 	/* Accumulate accounting to the task */
 	irq_spinlock_lock(&THREAD->lock, true);
@@ -137,5 +137,5 @@
 		uint64_t kcycles = THREAD->kcycles;
 		THREAD->kcycles = 0;
-		
+
 		irq_spinlock_pass(&THREAD->lock, &TASK->lock);
 		TASK->ucycles += ucycles;
@@ -144,7 +144,7 @@
 	} else
 		irq_spinlock_unlock(&THREAD->lock, true);
-	
+
 	thread_exit();
-	
+
 	/* Not reached */
 }
@@ -156,13 +156,13 @@
 {
 	thread_t *thread = (thread_t *) obj;
-	
+
 	irq_spinlock_initialize(&thread->lock, "thread_t_lock");
 	link_initialize(&thread->rq_link);
 	link_initialize(&thread->wq_link);
 	link_initialize(&thread->th_link);
-	
+
 	/* call the architecture-specific part of the constructor */
 	thr_constructor_arch(thread);
-	
+
 #ifdef CONFIG_FPU
 #ifdef CONFIG_FPU_LAZY
@@ -174,5 +174,5 @@
 #endif /* CONFIG_FPU_LAZY */
 #endif /* CONFIG_FPU */
-	
+
 	/*
 	 * Allocate the kernel stack from the low-memory to prevent an infinite
@@ -193,5 +193,5 @@
 	kmflags |= FRAME_LOWMEM;
 	kmflags &= ~FRAME_HIGHMEM;
-	
+
 	uintptr_t stack_phys =
 	    frame_alloc(STACK_FRAMES, kmflags, STACK_SIZE - 1);
@@ -203,11 +203,11 @@
 		return ENOMEM;
 	}
-	
+
 	thread->kstack = (uint8_t *) PA2KA(stack_phys);
-	
+
 #ifdef CONFIG_UDEBUG
 	mutex_initialize(&thread->udebug.lock, MUTEX_PASSIVE);
 #endif
-	
+
 	return EOK;
 }
@@ -217,15 +217,15 @@
 {
 	thread_t *thread = (thread_t *) obj;
-	
+
 	/* call the architecture-specific part of the destructor */
 	thr_destructor_arch(thread);
-	
+
 	frame_free(KA2PA(thread->kstack), STACK_FRAMES);
-	
+
 #ifdef CONFIG_FPU
 	if (thread->saved_fpu_context)
 		slab_free(fpu_context_cache, thread->saved_fpu_context);
 #endif
-	
+
 	return STACK_FRAMES;  /* number of frames freed */
 }
@@ -239,14 +239,14 @@
 {
 	THREAD = NULL;
-	
+
 	atomic_set(&nrdy, 0);
 	thread_cache = slab_cache_create("thread_t", sizeof(thread_t), 0,
 	    thr_constructor, thr_destructor, 0);
-	
+
 #ifdef CONFIG_FPU
 	fpu_context_cache = slab_cache_create("fpu_context_t",
 	    sizeof(fpu_context_t), FPU_CONTEXT_ALIGN, NULL, NULL, 0);
 #endif
-	
+
 	avltree_create(&threads_tree);
 }
@@ -282,9 +282,9 @@
 {
 	irq_spinlock_lock(&thread->lock, true);
-	
+
 	assert(thread->state != Ready);
 
 	before_thread_is_ready(thread);
-	
+
 	int i = (thread->priority < RQ_COUNT - 1) ?
 	    ++thread->priority : thread->priority;
@@ -305,18 +305,18 @@
 		cpu = CPU;
 	}
-	
+
 	thread->state = Ready;
-	
+
 	irq_spinlock_pass(&thread->lock, &(cpu->rq[i].lock));
-	
+
 	/*
 	 * Append thread to respective ready queue
 	 * on respective processor.
 	 */
-	
+
 	list_append(&thread->rq_link, &cpu->rq[i].rq);
 	cpu->rq[i].n++;
 	irq_spinlock_unlock(&(cpu->rq[i].lock), true);
-	
+
 	atomic_inc(&nrdy);
 	atomic_inc(&cpu->nrdy);
@@ -344,24 +344,24 @@
 	if (!thread)
 		return NULL;
-	
+
 	/* Not needed, but good for debugging */
 	memsetb(thread->kstack, STACK_SIZE, 0);
-	
+
 	irq_spinlock_lock(&tidlock, true);
 	thread->tid = ++last_tid;
 	irq_spinlock_unlock(&tidlock, true);
-	
+
 	context_save(&thread->saved_context);
 	context_set(&thread->saved_context, FADDR(cushion),
 	    (uintptr_t) thread->kstack, STACK_SIZE);
-	
+
 	the_initialize((the_t *) thread->kstack);
-	
+
 	ipl_t ipl = interrupts_disable();
 	thread->saved_context.ipl = interrupts_read();
 	interrupts_restore(ipl);
-	
+
 	str_cpy(thread->name, THREAD_NAME_BUFLEN, name);
-	
+
 	thread->thread_code = func;
 	thread->thread_arg = arg;
@@ -377,30 +377,30 @@
 	thread->uspace =
 	    ((flags & THREAD_FLAG_USPACE) == THREAD_FLAG_USPACE);
-	
+
 	thread->nomigrate = 0;
 	thread->state = Entering;
-	
+
 	timeout_initialize(&thread->sleep_timeout);
 	thread->sleep_interruptible = false;
 	thread->sleep_queue = NULL;
 	thread->timeout_pending = false;
-	
+
 	thread->in_copy_from_uspace = false;
 	thread->in_copy_to_uspace = false;
-	
+
 	thread->interrupted = false;
 	thread->detached = false;
 	waitq_initialize(&thread->join_wq);
-	
+
 	thread->task = task;
-	
+
 	thread->workq = NULL;
-	
+
 	thread->fpu_context_exists = false;
 	thread->fpu_context_engaged = false;
-	
+
 	avltree_node_initialize(&thread->threads_tree_node);
 	thread->threads_tree_node.key = (uintptr_t) thread;
-	
+
 #ifdef CONFIG_UDEBUG
 	/* Initialize debugging stuff */
@@ -408,13 +408,13 @@
 	udebug_thread_initialize(&thread->udebug);
 #endif
-	
+
 	/* Might depend on previous initialization */
 	thread_create_arch(thread);
-	
+
 	rcu_thread_init(thread);
-	
+
 	if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH)
 		thread_attach(thread, task);
-	
+
 	return thread;
 }
@@ -435,16 +435,16 @@
 	assert(thread->task);
 	assert(thread->cpu);
-	
+
 	irq_spinlock_lock(&thread->cpu->lock, false);
 	if (thread->cpu->fpu_owner == thread)
 		thread->cpu->fpu_owner = NULL;
 	irq_spinlock_unlock(&thread->cpu->lock, false);
-	
+
 	irq_spinlock_pass(&thread->lock, &threads_lock);
-	
+
 	avltree_delete(&threads_tree, &thread->threads_tree_node);
-	
+
 	irq_spinlock_pass(&threads_lock, &thread->task->lock);
-	
+
 	/*
 	 * Detach from the containing task.
@@ -452,5 +452,5 @@
 	list_remove(&thread->th_link);
 	irq_spinlock_unlock(&thread->task->lock, irq_res);
-	
+
 	/*
 	 * Drop the reference to the containing task.
@@ -475,16 +475,16 @@
 	 */
 	irq_spinlock_lock(&task->lock, true);
-	
+
 	/* Hold a reference to the task. */
 	task_hold(task);
-	
+
 	/* Must not count kbox thread into lifecount */
 	if (thread->uspace)
 		atomic_inc(&task->lifecount);
-	
+
 	list_append(&thread->th_link, &task->threads);
-	
+
 	irq_spinlock_pass(&task->lock, &threads_lock);
-	
+
 	/*
 	 * Register this thread in the system-wide list.
@@ -506,5 +506,5 @@
 		/* Generate udebug THREAD_E event */
 		udebug_thread_e_event();
-		
+
 		/*
 		 * This thread will not execute any code or system calls from
@@ -527,5 +527,5 @@
 		}
 	}
-	
+
 restart:
 	irq_spinlock_lock(&THREAD->lock, true);
@@ -535,10 +535,10 @@
 		goto restart;
 	}
-	
+
 	THREAD->state = Exiting;
 	irq_spinlock_unlock(&THREAD->lock, true);
-	
+
 	scheduler();
-	
+
 	/* Not reached */
 	while (true);
@@ -562,12 +562,12 @@
 {
 	assert(thread != NULL);
-	
+
 	irq_spinlock_lock(&thread->lock, true);
-	
+
 	thread->interrupted = true;
 	bool sleeping = (thread->state == Sleeping);
-	
+
 	irq_spinlock_unlock(&thread->lock, true);
-	
+
 	if (sleeping)
 		waitq_interrupt_sleep(thread);
@@ -583,11 +583,11 @@
 {
 	assert(thread != NULL);
-	
+
 	bool interrupted;
-	
+
 	irq_spinlock_lock(&thread->lock, true);
 	interrupted = thread->interrupted;
 	irq_spinlock_unlock(&thread->lock, true);
-	
+
 	return interrupted;
 }
@@ -597,5 +597,5 @@
 {
 	assert(THREAD);
-	
+
 	THREAD->nomigrate++;
 }
@@ -606,5 +606,5 @@
 	assert(THREAD);
 	assert(THREAD->nomigrate > 0);
-	
+
 	if (THREAD->nomigrate > 0)
 		THREAD->nomigrate--;
@@ -624,5 +624,5 @@
 	while (sec > 0) {
 		uint32_t period = (sec > 1000) ? 1000 : sec;
-		
+
 		thread_usleep(period * 1000000);
 		sec -= period;
@@ -643,14 +643,14 @@
 	if (thread == THREAD)
 		return EINVAL;
-	
+
 	/*
 	 * Since thread join can only be called once on an undetached thread,
 	 * the thread pointer is guaranteed to be still valid.
 	 */
-	
+
 	irq_spinlock_lock(&thread->lock, true);
 	assert(!thread->detached);
 	irq_spinlock_unlock(&thread->lock, true);
-	
+
 	return waitq_sleep_timeout(&thread->join_wq, usec, flags, NULL);
 }
@@ -672,5 +672,5 @@
 	irq_spinlock_lock(&thread->lock, true);
 	assert(!thread->detached);
-	
+
 	if (thread->state == Lingering) {
 		/*
@@ -683,5 +683,5 @@
 		thread->detached = true;
 	}
-	
+
 	irq_spinlock_unlock(&thread->lock, true);
 }
@@ -697,7 +697,7 @@
 {
 	waitq_t wq;
-	
+
 	waitq_initialize(&wq);
-	
+
 	(void) waitq_sleep_timeout(&wq, usec, SYNCH_FLAGS_NON_BLOCKING, NULL);
 }
@@ -707,10 +707,10 @@
 	bool *additional = (bool *) arg;
 	thread_t *thread = avltree_get_instance(node, thread_t, threads_tree_node);
-	
+
 	uint64_t ucycles, kcycles;
 	char usuffix, ksuffix;
 	order_suffix(thread->ucycles, &ucycles, &usuffix);
 	order_suffix(thread->kcycles, &kcycles, &ksuffix);
-	
+
 	char *name;
 	if (str_cmp(thread->name, "uinit") == 0)
@@ -718,5 +718,5 @@
 	else
 		name = thread->name;
-	
+
 #ifdef __32_BITS__
 	if (*additional)
@@ -729,5 +729,5 @@
 		    thread->task, thread->task->container);
 #endif
-	
+
 #ifdef __64_BITS__
 	if (*additional)
@@ -741,5 +741,5 @@
 		    thread->task, thread->task->container);
 #endif
-	
+
 	if (*additional) {
 		if (thread->cpu)
@@ -747,18 +747,18 @@
 		else
 			printf("none ");
-		
+
 		if (thread->state == Sleeping) {
 #ifdef __32_BITS__
 			printf(" %10p", thread->sleep_queue);
 #endif
-			
+
 #ifdef __64_BITS__
 			printf(" %18p", thread->sleep_queue);
 #endif
 		}
-		
+
 		printf("\n");
 	}
-	
+
 	return true;
 }
@@ -773,5 +773,5 @@
 	/* Messing with thread structures, avoid deadlock */
 	irq_spinlock_lock(&threads_lock, true);
-	
+
 #ifdef __32_BITS__
 	if (additional)
@@ -782,5 +782,5 @@
 		    " [ctn]\n");
 #endif
-	
+
 #ifdef __64_BITS__
 	if (additional) {
@@ -791,7 +791,7 @@
 		    " [task            ] [ctn]\n");
 #endif
-	
+
 	avltree_walk(&threads_tree, thread_walker, &additional);
-	
+
 	irq_spinlock_unlock(&threads_lock, true);
 }
@@ -814,5 +814,5 @@
 	avltree_node_t *node =
 	    avltree_search(&threads_tree, (avltree_key_t) ((uintptr_t) thread));
-	
+
 	return node != NULL;
 }
@@ -832,10 +832,10 @@
 	assert(interrupts_disabled());
 	assert(irq_spinlock_locked(&THREAD->lock));
-	
+
 	if (user)
 		THREAD->ucycles += time - THREAD->last_cycle;
 	else
 		THREAD->kcycles += time - THREAD->last_cycle;
-	
+
 	THREAD->last_cycle = time;
 }
@@ -846,10 +846,10 @@
 	    (thread_t *) avltree_get_instance(node, thread_t, threads_tree_node);
 	thread_iterator_t *iterator = (thread_iterator_t *) arg;
-	
+
 	if (thread->tid == iterator->thread_id) {
 		iterator->thread = thread;
 		return false;
 	}
-	
+
 	return true;
 }
@@ -869,12 +869,12 @@
 	assert(interrupts_disabled());
 	assert(irq_spinlock_locked(&threads_lock));
-	
+
 	thread_iterator_t iterator;
-	
+
 	iterator.thread_id = thread_id;
 	iterator.thread = NULL;
-	
+
 	avltree_walk(&threads_tree, thread_search_walker, (void *) &iterator);
-	
+
 	return iterator.thread;
 }
@@ -885,5 +885,5 @@
 {
 	irq_spinlock_lock(&threads_lock, true);
-	
+
 	thread_t *thread = thread_find_by_id(thread_id);
 	if (thread == NULL) {
@@ -892,7 +892,7 @@
 		return;
 	}
-	
+
 	irq_spinlock_lock(&thread->lock, false);
-	
+
 	/*
 	 * Schedule a stack trace to be printed
@@ -906,5 +906,5 @@
 	 * is probably justifiable.
 	 */
-	
+
 	bool sleeping = false;
 	istate_t *istate = thread->udebug.uspace_state;
@@ -916,10 +916,10 @@
 	} else
 		printf("Thread interrupt state not available.\n");
-	
+
 	irq_spinlock_unlock(&thread->lock, false);
-	
+
 	if (sleeping)
 		waitq_interrupt_sleep(thread);
-	
+
 	irq_spinlock_unlock(&threads_lock, true);
 }
@@ -935,12 +935,12 @@
 	if (name_len > THREAD_NAME_BUFLEN - 1)
 		name_len = THREAD_NAME_BUFLEN - 1;
-	
+
 	char namebuf[THREAD_NAME_BUFLEN];
 	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
 	if (rc != EOK)
 		return (sys_errno_t) rc;
-	
+
 	namebuf[name_len] = 0;
-	
+
 	/*
 	 * In case of failure, kernel_uarg will be deallocated in this function.
@@ -949,5 +949,5 @@
 	uspace_arg_t *kernel_uarg =
 	    (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
-	
+
 	rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
 	if (rc != EOK) {
@@ -955,5 +955,5 @@
 		return (sys_errno_t) rc;
 	}
-	
+
 	thread_t *thread = thread_create(uinit, kernel_uarg, TASK,
 	    THREAD_FLAG_USPACE | THREAD_FLAG_NOATTACH, namebuf);
@@ -968,5 +968,5 @@
 				 * creation now.
 				 */
-				
+
 				/*
 				 * The new thread structure is initialized, but
@@ -976,9 +976,9 @@
 				slab_free(thread_cache, thread);
 				free(kernel_uarg);
-				
+
 				return (sys_errno_t) rc;
 			 }
 		}
-		
+
 #ifdef CONFIG_UDEBUG
 		/*
@@ -994,9 +994,9 @@
 #endif
 		thread_ready(thread);
-		
+
 		return 0;
 	} else
 		free(kernel_uarg);
-	
+
 	return (sys_errno_t) ENOMEM;
 }
