Changeset 435 for trunk/kernel/syscalls/sys_exit.c
- Timestamp:
- Feb 20, 2018, 5:32:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_exit.c
r433 r435 29 29 #include <printk.h> 30 30 #include <process.h> 31 #include <s ignal.h>31 #include <shared_syscalls.h> 32 32 #include <cluster.h> 33 33 #include <rpc.h> … … 51 51 #endif 52 52 53 // get cluster and pointers on process in owner cluster 54 xptr_t owner_xp = cluster_get_owner_process_from_pid( pid ); 55 cxy_t owner_cxy = GET_CXY( owner_xp ); 56 process_t * owner_ptr = GET_PTR( owner_xp ); 53 // get owner cluster 54 cxy_t owner_cxy = CXY_FROM_PID( pid ); 57 55 58 assert( (owner_xp != XPTR_NULL) , __FUNCTION__ , "owner_xp cannot be NULL\n" ); 56 // exit must be called by the main thread 57 if( (owner_cxy != local_cxy) || (LTID_FROM_TRDID( this->trdid ) != 0) ) 58 { 59 60 #if CONFIG_DEBUG_SYSCALLS_ERROR 61 printk("\n[ERROR] %s must be called by thread 0 in process owner cluster\n" 62 " trdid = %x / pid = %x / local_cxy = %x\n", 63 __FUNCTION__, this->trdid, pid, local_cxy ); 64 #endif 65 this->errno = EINVAL; 66 return -1; 67 } 59 68 60 69 // enable IRQs 61 70 hal_enable_irq( &save_sr ); 62 71 63 // the process_make_kill() function must be executed 64 // by an RPC thread in reference cluster 65 rpc_process_make_kill_client( owner_cxy, owner_ptr, true , status ); 72 // register exit_status in owner process descriptor 73 process->term_state = status; 74 75 // remove TXT ownership from owner process descriptor 76 process_txt_reset_ownership( XPTR( local_cxy , process ) ); 77 78 // block all process threads in all clusters 79 process_sigaction( pid , BLOCK_ALL_THREADS ); 80 81 // mark all process threads in all clusters for delete 82 process_sigaction( pid , DELETE_ALL_THREADS ); 66 83 67 84 // restore IRQs 68 85 hal_restore_irq( save_sr ); 69 86 87 // atomically update owner process descriptor term_state 88 hal_remote_atomic_or( XPTR( local_cxy , &process->term_state ) , 89 PROCESS_TERM_EXIT ); 70 90 hal_fence(); 71 91
Note: See TracChangeset
for help on using the changeset viewer.