Index: trunk/kernel/kern/process.h
===================================================================
--- trunk/kernel/kern/process.h	(revision 450)
+++ trunk/kernel/kern/process.h	(revision 457)
@@ -29,5 +29,5 @@
 #include <kernel_config.h>
 #include <errno.h>
-#include <hal_types.h>
+#include <hal_kernel_types.h>
 #include <list.h>
 #include <xlist.h>
@@ -146,6 +146,4 @@
 
     uint32_t          term_state;       /*! termination status (flags & exit status)        */
-
-    bool_t            txt_owner;        /*! current TXT owner                               */
 }
 process_t;
@@ -213,16 +211,15 @@
 /*********************************************************************************************
  * This function initializes a local, reference, user process descriptor from another process
- * descriptor, defined by the <model_xp> argument. The <process> and <pid> arguments must
- * be previously allocated by he caller. This function can be called by three functions:
- * 1) process_init_create() : process is the reference INIT process / pid = 1 /
- *    the parent and model process descriptors are both the kernel process_zero.
- * 2) process_make_fork() : the model process descriptor is the (generally remote)
- *    parent process.
- * 3) process_make exec() : the model process is the local old_process, the new_process
- *    parent is the same as the old_process parent. 
+ * descriptor, defined by the <parent_xp> argument. The <process> and <pid> arguments must
+ * be previously allocated by the caller. This function can be called by two functions:
+ * 1) process_init_create() : process is the INIT process; parent is process-zero.
+ * 2) process_make_fork() : the parent process descriptor is generally remote.
  * The following fields are initialised :
  * - It set the pid / ppid / ref_xp / parent_xp / state fields.
  * - It initializes the VMM (register the kentry, args, envs vsegs in VSL)
  * - It initializes the FDT, defining the three pseudo files STDIN / STDOUT / STDERR.
+ *   . if INIT process     => link to kernel TXT[0].
+ *   . if KSH[i] process   => allocate a free TXT[i] and give TXT ownership.
+ *   . if USER process     => same TXT[i] as parent process and give TXT ownership.
  * - It set the root_xp, bin_xp, cwd_xp fields.
  * - It reset the children list as empty, but does NOT register it in parent children list.
@@ -236,10 +233,8 @@
  * @ pid          : [in] process identifier.
  * @ parent_xp    : [in] extended pointer on parent process descriptor.
- * @ model_xp     : [in] extended pointer on model process descriptor.
  ********************************************************************************************/
 void process_reference_init( process_t * process,
                              pid_t       pid,
-                             xptr_t      parent_xp,
-                             xptr_t      model_xp );
+                             xptr_t      parent_xp );
 
 /*********************************************************************************************
@@ -515,6 +510,5 @@
  * It is called only by the process_reference_init() function when creating a KSH process.
  * It makes a kernel panic if no free TXT terminal is found.
- * The allocated TXT terminal is only released if the KSH process is deleted,
- * which is a rare and abnormal event.
+ * The allocated TXT terminal is only released when the KSH process is deleted.
  *********************************************************************************************
  * @ return TXT terminal index if succes / kernel panic if no terminal found.
@@ -547,14 +541,14 @@
 
 /*********************************************************************************************
- * This function gives to a process identified by the <owner_xp> argument, and attached
- * to terminal TXT[i] the exclusive ownership of the TXT_RX[i] terminal.
- * The process descriptor must be in the process owner cluster.
+ * This function gives the TXT ownership to a process identified by the <process_xp> argument.
+ * It can be called by a thread running in any cluster, but the <process_xp> must be the
+ * owner cluster process descriptor. 
  *********************************************************************************************
  * @ owner_xp  : extended pointer on process descriptor in owner cluster.
  ********************************************************************************************/
-void process_txt_set_ownership( xptr_t owner_xp );
-
-/*********************************************************************************************
- * When the process dentified by the <owner_xp> argument has the exclusive ownership of
+void process_txt_set_ownership( xptr_t process_xp );
+
+/*********************************************************************************************
+ * When the process identified by the <owner_xp> argument has the exclusive ownership of
  * the TXT_RX terminal, this function transfer this ownership to another attached process.
  * The process descriptor must be the process owner.
@@ -565,14 +559,23 @@
  * - If there is no other attached process, the TXT has no more defined owner. 
  *********************************************************************************************
- * @ owner_xp  : extended pointer on process descriptor in owner cluster.
- ********************************************************************************************/
-void process_txt_transfer_ownership( xptr_t owner_xp );
-
-/*********************************************************************************************
- * This function returns the TXT owner process (foreground process)
- * for a given TXT terminal identified by its <channel> index.
- *********************************************************************************************
- * @ channel  : TXT terminal channel.
- * @ return extentded pointer on TXT owner process in owner cluster.
+ * @ process_xp  : extended pointer on process descriptor in owner cluster.
+ ********************************************************************************************/
+void process_txt_transfer_ownership( xptr_t process_xp );
+
+/*********************************************************************************************
+ * This function returns true if the  process identified by the <process_xp> argument
+ * is the TXT owner. It can be called by a thread running in any cluster, but the
+ * process_xp must be the owner cluster process descriptor. 
+ *********************************************************************************************
+ * @ return a non-zero value if target process is TXT owner.
+ ********************************************************************************************/
+uint32_t process_txt_is_owner( xptr_t process_xp );
+
+/*********************************************************************************************
+ * This function returns an extended ponter on the current TXT owner process, 
+ * for the TXT terminal identified by the <channel> index. 
+ *********************************************************************************************
+ * @ channel : TXT channel.
+ * @ return extended pointer on TXT owner process.
  ********************************************************************************************/
 xptr_t process_txt_get_owner( uint32_t channel );
