Index: trunk/kernel/syscalls/sys_kill.c
===================================================================
--- trunk/kernel/syscalls/sys_kill.c	(revision 433)
+++ trunk/kernel/syscalls/sys_kill.c	(revision 435)
@@ -48,4 +48,5 @@
 
     thread_t  * this    = CURRENT_THREAD;
+    process_t * process = this->process;
 
 #if CONFIG_DEBUG_SYS_KILL
@@ -58,5 +59,16 @@
 #endif
 
-    // get cluster and pointers on owner process
+    // process cannot kill itself
+    if( pid == process->pid )
+    {
+
+#if CONFIG_DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : process %d cannot kill itself\n", __FUNCTION__ , pid );
+#endif
+        this->errno = EINVAL;
+        return -1;
+    }
+
+    // get cluster and pointers on owner target process descriptor
     owner_xp  = cluster_get_owner_process_from_pid( pid );
     owner_cxy = GET_CXY( owner_xp );
@@ -67,6 +79,7 @@
     {
 
-syscall_dmsg("\n[ERROR] in %s : process %x not found\n", __FUNCTION__ , pid );
-
+#if CONFIG_DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : process %x not found\n", __FUNCTION__ , pid );
+#endif
         this->errno = EINVAL;
         return -1;
@@ -79,10 +92,11 @@
     ppid       = hal_remote_lw( XPTR( parent_cxy , &parent_ptr->pid ) );
 
-    // processes INIT and processes KSH cannot be stoped or killed
-    if( ppid < 2 )
+    // processes INIT 
+    if( pid == 1 )
     {
 
-syscall_dmsg("\n[ERROR] in %s : process %x cannot be killed\n", __FUNCTION__ , pid );
-
+#if CONFIG_DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : process_init cannot be killed\n", __FUNCTION__ );
+#endif
 		this->errno = EINVAL;
         return -1;
@@ -92,6 +106,5 @@
     hal_enable_irq( &save_sr );
 
-    // analyse signal type
-    // supported values are : 0, SIGSTOP, SIGCONT, SIGKILL
+    // analyse signal type / supported values are : 0, SIGSTOP, SIGCONT, SIGKILL
     switch( sig_id )
     {
@@ -108,9 +121,9 @@
 
             // block all threads in all clusters
-            process_sigaction( owner_ptr , BLOCK_ALL_THREADS );
+            process_sigaction( pid , BLOCK_ALL_THREADS );
 
-            // atomically update reference process termination state
+            // atomically update owner process termination state
             hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) ,
-                                  PROCESS_FLAG_BLOCK );
+                                  PROCESS_TERM_STOP );
  
             retval = 0;
@@ -120,9 +133,9 @@
         {
             // unblock all threads in all clusters
-            process_sigaction( owner_ptr , UNBLOCK_ALL_THREADS );
+            process_sigaction( pid , UNBLOCK_ALL_THREADS );
 
             // atomically update reference process termination state
             hal_remote_atomic_and( XPTR( owner_cxy , &owner_ptr->term_state ) ,
-                                   ~PROCESS_FLAG_BLOCK );
+                                   ~PROCESS_TERM_STOP );
             retval = 0;
             break;
@@ -131,9 +144,16 @@
         case SIGKILL:
         {
-            // the process_make_kill() function must be executed
-            // by an RPC thread in process owner cluster
-            // It deletes all target process threads in all clusters, 
-            // and updates the process termination state 
-            rpc_process_make_kill_client( owner_cxy , owner_ptr , false , 0 );
+            // remove TXT ownership from owner process descriptor
+            process_txt_reset_ownership( owner_xp );
+
+            // block all process threads in all clusters
+            process_sigaction( pid , BLOCK_ALL_THREADS );
+
+            // mark all process threads in all clusters for delete 
+            process_sigaction( pid , DELETE_ALL_THREADS );
+
+            // atomically update owner process descriptor flags
+            hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) ,
+                                  PROCESS_TERM_KILL );
 
             retval = 0;
@@ -143,7 +163,7 @@
         {
 
-syscall_dmsg("\n[ERROR] in %s : illegal signal type %d for process %x\n",
-__FUNCTION__ , sig_id , pid );
-
+#if CONFIG_DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : illegal signal %d / process %x\n", __FUNCTION__, sig_id, pid );
+#endif
     	    this->errno = EINVAL;
             retval = -1;
