Changeset 436 for trunk/kernel/syscalls/sys_wait.c
- Timestamp:
- Mar 7, 2018, 9:02:03 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_wait.c
r435 r436 68 68 __FUNCTION__ , this->trdid , process->pid ); 69 69 #endif 70 this->errno = E FAULT;70 this->errno = EINVAL; 71 71 return -1; 72 72 } 73 73 74 // get process owner cluster 75 cxy_t owner_cxy = CXY_FROM_PID( pid ); 74 // get process owner cluster and calling thread trdid 75 cxy_t owner_cxy = CXY_FROM_PID( pid ); 76 trdid_t trdid = this->trdid; 76 77 77 // This function must be executed in owner cluster78 assert( (owner_cxy == local_cxy) , __FUNCTION__ ,79 "calling thread must execute in owner cluster" );78 // wait must be executed by the main thread 79 if( (owner_cxy != local_cxy) || (LTID_FROM_TRDID(trdid) != 0) ) 80 { 80 81 81 // This function must be executed by the main thread 82 assert( (process->th_tbl[0] == this) , __FUNCTION__ , 83 "this function must be executed by the main thread" ); 84 82 #if CONFIG_DEBUG_SYSCALL_ERROR 83 printk("\n[ERROR] in %s : calling thread %x is not thread 0 in owner cluster %x\n", 84 __FUNCTION__ , trdid , owner_cxy ); 85 #endif 86 this->errno = EINVAL; 87 return -1; 88 } 89 85 90 // get extended pointer on children list root and lock 86 91 xptr_t children_root_xp = XPTR( owner_cxy , &process->children_root ); … … 96 101 remote_spinlock_lock( children_lock_xp ); 97 102 98 // scan the list of ownerchild process103 // scan the list of child process 99 104 XLIST_FOREACH( children_root_xp , iter_xp ) 100 105 { … … 115 120 { 116 121 // get pointer on main thread and PID from child owner process 117 child_pid = (pid_t) hal_remote_lw ( XPTR(child_cxy,&child_ptr->pid)); 118 child_thread = (thread_t *)hal_remote_lpt( XPTR(child_cxy,&child_ptr->th_tbl[0])); 122 child_pid = (pid_t) hal_remote_lw (XPTR( child_cxy , &child_ptr->pid )); 123 child_thread = (thread_t *)hal_remote_lpt(XPTR( child_cxy , 124 &child_ptr->th_tbl[0] )); 119 125 120 126 // set the PROCESS_FLAG_WAIT in owner child descriptor … … 135 141 __FUNCTION__, this, process->pid, child_pid, (uint32_t)tm_end ); 136 142 #endif 137 // return relevant info to callingparent process143 // return child termination state to parent process 138 144 hal_copy_to_uspace( status , &child_state , sizeof(int) ); 139 145 return child_pid; 140 146 } 141 } 147 } // end loop on children 142 148 143 149 // release lock protecting children list
Note: See TracChangeset
for help on using the changeset viewer.