Index: trunk/kernel/syscalls/sys_thread_create.c
===================================================================
--- trunk/kernel/syscalls/sys_thread_create.c	(revision 101)
+++ trunk/kernel/syscalls/sys_thread_create.c	(revision 289)
@@ -1,5 +1,5 @@
 /*
  * sys_thread_create.c - creates a new user thread
- * 
+ *
  * Author     Alain Greiner (2016,2017)
  *
@@ -50,11 +50,11 @@
 	pthread_attr_t   k_attr;           // copy of pthread attributes in kernel space
 	thread_t       * parent;           // pointer on thread executing the pthread_create
-    xptr_t           parent_xp;        // extended pointer on created thread
-    thread_t       * child_ptr;        // pointer on created child thread
-    xptr_t           child_xp;         // extended pointer on created thread
-    trdid_t          trdid;            // created thread identifier
-    process_t      * process;          // pointer on local process descriptor
-    paddr_t          paddr;            // unused, required by vmm_v2p_translate()
-    error_t          error;
+	xptr_t           parent_xp;        // extended pointer on created thread
+	thread_t       * child_ptr;        // pointer on created child thread
+	xptr_t           child_xp;         // extended pointer on created thread
+	trdid_t          trdid;            // created thread identifier
+	process_t      * process;          // pointer on local process descriptor
+	paddr_t          paddr;            // unused, required by vmm_v2p_translate()
+	error_t          error;
 
 	uint32_t         tm_start;
@@ -63,11 +63,11 @@
 	tm_start = hal_get_cycles();
 
-    // get parent thead pointer, extended pointer, and process pointer
+	// get parent thead pointer, extended pointer, and process pointer
 	parent     = CURRENT_THREAD;
-    parent_xp  = XPTR( local_cxy , parent );    
+	parent_xp  = XPTR( local_cxy , parent );
 	process    = parent->process;
 
-    // check user_attr in user space 
-    error = vmm_v2p_translate( false , user_attr , &paddr );
+	// check user_attr in user space
+	error = vmm_v2p_translate( false , user_attr , &paddr );
 
 	if( error )
@@ -75,9 +75,9 @@
 		printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
 		parent->errno = EINVAL;
-        return -1;
+		return -1;
 	}
 
-    // check start_func in user space 
-    error = vmm_v2p_translate( false , start_func , &paddr );
+	// check start_func in user space
+	error = vmm_v2p_translate( false , start_func , &paddr );
 
 	if( error )
@@ -85,9 +85,9 @@
 		printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
 		parent->errno = EINVAL;
-        return -1;
+		return -1;
 	}
 
-    // check start_arg in user space 
-    if( start_arg != NULL ) error = vmm_v2p_translate( false , start_arg , &paddr );
+	// check start_arg in user space
+	if( start_arg != NULL ) error = vmm_v2p_translate( false , start_arg , &paddr );
 
 	if( error )
@@ -95,77 +95,74 @@
 		printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
 		parent->errno = EINVAL;
-        return -1;
+		return -1;
 	}
 
-    // copy user_attr structure from user space to kernel space
+	// copy user_attr structure from user space to kernel space
 	hal_copy_from_uspace( &k_attr , user_attr , sizeof(pthread_attr_t) );
 
-    // check/set "cxy" attribute
-	if( k_attr.attributes & PT_ATTR_CLUSTER_DEFINED ) 
-    {
-        if( cluster_is_undefined( k_attr.cxy ) )
-        {
-		    printk("\n[ERROR] in %s : illegal target cluster attribute = %x\n",
-                   __FUNCTION__ , k_attr.cxy );
-		    parent->errno = EINVAL;
-            return -1;
-        } 
-    }
-    else
-    {
-        k_attr.cxy = dqdt_get_cluster_for_process();
-    }
+	// check/set "cxy" attribute
+	if( k_attr.attributes & PT_ATTR_CLUSTER_DEFINED )
+	{
+		if( cluster_is_undefined( k_attr.cxy ) )
+		{
+			printk("\n[ERROR] in %s : illegal target cluster attribute = %x\n",
+			       __FUNCTION__ , k_attr.cxy );
+			parent->errno = EINVAL;
+			return -1;
+		}
+	}
+	else
+	{
+		k_attr.cxy = dqdt_get_cluster_for_process();
+	}
 
-    // create the thread, using a RPC if required
-    // this returns "error", "child", and "child_xp"
- 
-    if( k_attr.cxy == local_cxy )                         // target cluster is local 
-    {
+	// create the thread, using a RPC if required
+	// this returns "error", "child", and "child_xp"
 
-        // create thread in local cluster
-        error = thread_user_create( process->pid,
-                                    start_func,
-                                    start_arg,
-                                    &k_attr,
-                                    &child_ptr );
+	if( k_attr.cxy == local_cxy )                         // target cluster is local
+	{
+		// create thread in local cluster
+		error = thread_user_create( process->pid,
+		                            start_func,
+		                            start_arg,
+		                            &k_attr,
+		                            &child_ptr );
 
-        child_xp = XPTR( local_cxy , child_ptr );
-    }
-    else                                                 // target cluster is remote
-    {
-        rpc_thread_user_create_client( k_attr.cxy,
-                                       process->pid,
-                                       start_func,
-                                       start_arg,
-                                       &k_attr, 
-                                       &child_xp, 
-                                       &error );
+		child_xp = XPTR( local_cxy , child_ptr );
+	}
+	else                                                 // target cluster is remote
+	{
+		rpc_thread_user_create_client( k_attr.cxy,
+		                               process->pid,
+		                               start_func,
+		                               start_arg,
+		                               &k_attr,
+		                               &child_xp,
+		                               &error );
 
-        child_ptr = (thread_t *)GET_PTR( child_xp );
-    }
+		child_ptr = (thread_t *)GET_PTR( child_xp );
+	}
 
-    // check successful thread creation
-    if( error ) 
-    {
+	// check successful thread creation
+	if( error )
+	{
 		printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
-        return ENOMEM;
-    }
+		return ENOMEM;
+	}
 
-    // returns trdid to user space 
-    trdid = hal_remote_lw( XPTR( k_attr.cxy , &child_ptr->trdid ) );   
+	// returns trdid to user space
+	trdid = hal_remote_lw( XPTR( k_attr.cxy , &child_ptr->trdid ) );
 	hal_copy_to_uspace( new_thread , &trdid , sizeof(pthread_t) );
-    
-    // register new-thread in parent-thread children list if required
-    if( (k_attr.attributes & PT_ATTR_DETACH) == 0 ) 
-        thread_child_parent_link( parent_xp , child_xp );
+
+	// register new-thread in parent-thread children list if required
+	if( (k_attr.attributes & PT_ATTR_DETACH) == 0 )
+	    thread_child_parent_link( parent_xp , child_xp );
 
 	tm_end = hal_get_cycles();
 
 	thread_dmsg("\n[INFO] %s created thread %x for process %x in cluster %x\n"
-                "  start_cycle = %d / end_cycle = %d\n",
-                   trdid , process->pid , k_attr.cxy , tm_start , tm_end );
+	            "  start_cycle = %d / end_cycle = %d\n",
+	               trdid , process->pid , k_attr.cxy , tm_start , tm_end );
 	return 0;
+}
 
-}  // end sys_thread_create()
-
-
