Changeset 657 for trunk/kernel/kern/process.c
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.c
r651 r657 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017,2018,2019 )6 * Alain Greiner (2016,2017,2018,2019,2020) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 1103 1103 xptr_t xp; 1104 1104 1105 // get referenceprocess cluster and local pointer1105 // get target process cluster and local pointer 1106 1106 process_t * process_ptr = GET_PTR( process_xp ); 1107 1107 cxy_t process_cxy = GET_CXY( process_xp ); 1108 1108 1109 // check client process is reference process1109 // check target process is reference process 1110 1110 assert( (process_xp == hal_remote_l64( XPTR( process_cxy , &process_ptr->ref_xp ) ) ), 1111 1111 "client process must be reference process\n" ); … … 1158 1158 1159 1159 } // end process_fd_register() 1160 1161 ///////////////////////////////////////////// 1162 void process_fd_remove( xptr_t process_xp, 1163 uint32_t fdid ) 1164 { 1165 pid_t pid; // target process PID 1166 lpid_t lpid; // target process LPID 1167 xptr_t iter_xp; // iterator for list of process copies 1168 xptr_t copy_xp; // extended pointer on process copy 1169 process_t * copy_ptr; // local pointer on process copy 1170 cxy_t copy_cxy; // process copy cluster identifier 1171 1172 // check process_xp argument 1173 assert( (process_xp != XPTR_NULL), "process_xp argument cannot be XPTR_NULL"); 1174 1175 // get target process cluster and local pointer 1176 process_t * process_ptr = GET_PTR( process_xp ); 1177 cxy_t process_cxy = GET_CXY( process_xp ); 1178 1179 // get target process pid and lpid 1180 pid = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid) ); 1181 lpid = LPID_FROM_PID( pid ); 1182 1183 // get process descriptor in owner cluster and in reference cluster 1184 xptr_t owner_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->owner_xp )); 1185 xptr_t ref_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->ref_xp )); 1186 1187 // check target process in in owner cluster 1188 assert( (process_xp == owner_xp), "target process must be in owner process\n" ); 1189 1190 #if DEBUG_PROCESS_FD_REMOVE 1191 uint32_t cycle = (uint32_t)hal_get_cycles(); 1192 thread_t * this = CURRENT_THREAD; 1193 if( DEBUG_PROCESS_FD_REMOVE < cycle ) 1194 printk("\n[%s] thread[%x,%x] enter for fdid %d in process %x / cycle %d\n", 1195 __FUNCTION__, this->process->pid, this->trdid, fdid, pid, cycle ); 1196 #endif 1197 1198 // build extended pointers on list_of_copies root and lock (in owner cluster) 1199 xptr_t copies_root_xp = XPTR( process_cxy , &LOCAL_CLUSTER->pmgr.copies_root[lpid] ); 1200 xptr_t copies_lock_xp = XPTR( process_cxy , &LOCAL_CLUSTER->pmgr.copies_lock[lpid] ); 1201 1202 // get reference process cluster and local pointer 1203 process_t * ref_ptr = GET_PTR( ref_xp ); 1204 cxy_t ref_cxy = GET_CXY( ref_xp ); 1205 1206 // build extended pointer on lock protecting reference fd_array 1207 xptr_t fd_lock_xp = XPTR( ref_cxy , &ref_ptr->fd_array.lock ); 1208 1209 // take lock protecting reference fd_array 1210 remote_queuelock_acquire( fd_lock_xp ); 1211 1212 // take the lock protecting the list of copies 1213 remote_queuelock_acquire( copies_lock_xp ); 1214 1215 // loop on list of process copies 1216 XLIST_FOREACH( copies_root_xp , iter_xp ) 1217 { 1218 // get pointers on process copy 1219 copy_xp = XLIST_ELEMENT( iter_xp , process_t , copies_list ); 1220 copy_ptr = GET_PTR( copy_xp ); 1221 copy_cxy = GET_CXY( copy_xp ); 1222 1223 // release the fd_array entry in process copy 1224 hal_remote_s64( XPTR( copy_cxy , ©_ptr->fd_array.array[fdid] ), XPTR_NULL ); 1225 } 1226 1227 // release the lock protecting reference fd_array 1228 remote_queuelock_release( fd_lock_xp ); 1229 1230 // release the lock protecting the list of copies 1231 remote_queuelock_release( copies_lock_xp ); 1232 1233 #if DEBUG_PROCESS_FD_REMOVE 1234 cycle = (uint32_t)hal_get_cycles(); 1235 if( DEBUG_PROCESS_FD_REMOVE < cycle ) 1236 printk("\n[%s] thread[%x,%x] exit for fdid %d in process %x / cycle %d\n", 1237 __FUNCTION__, this->process->pid, this->trdid, fdid, pid, cycle ); 1238 #endif 1239 1240 } // end process_fd_remove() 1160 1241 1161 1242 ////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.