Changeset 7975433 in mainline
- Timestamp:
- 2012-08-16T21:25:56Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f6858d0
- Parents:
- 2405bb5
- Location:
- kernel/generic/src/ipc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipc.c
r2405bb5 r7975433 190 190 /* This is a forgotten call and call->sender is not valid. */ 191 191 spinlock_unlock(&call->forget_lock); 192 /* TODO: free the call and its resources */192 ipc_call_free(call); 193 193 return; 194 194 } else { -
kernel/generic/src/ipc/sysipc.c
r2405bb5 r7975433 174 174 } 175 175 176 static int a_preprocess_m_connection_clone(call_t *answer, ipc_data_t *olddata)176 static void cleanup_m_connection_clone(call_t *answer, ipc_data_t *olddata) 177 177 { 178 178 int phoneid = (int) IPC_GET_ARG1(*olddata); 179 179 phone_t *phone = &TASK->phones[phoneid]; 180 180 181 /* 182 * In this case, the connection was established at the request time and 183 * therefore we need to slam the phone. We don't merely hangup as that 184 * would result in sending IPC_M_HUNGUP to the third party on the other 185 * side of the cloned phone. 186 */ 187 mutex_lock(&phone->lock); 188 if (phone->state == IPC_PHONE_CONNECTED) { 189 irq_spinlock_lock(&phone->callee->lock, true); 190 list_remove(&phone->link); 191 phone->state = IPC_PHONE_SLAMMED; 192 irq_spinlock_unlock(&phone->callee->lock, true); 193 } 194 mutex_unlock(&phone->lock); 195 } 196 197 static int a_preprocess_m_connection_clone(call_t *answer, ipc_data_t *olddata) 198 { 181 199 if (IPC_GET_RETVAL(answer->data) != EOK) { 182 200 /* 183 * The recipient of the cloned phone rejected the offer. In 184 * this case, the connection was established at the request 185 * time and therefore we need to slam the phone. We don't 186 * merely hangup as that would result in sending IPC_M_HUNGUP 187 * to the third party on the other side of the cloned phone. 201 * The recipient of the cloned phone rejected the offer. 188 202 */ 189 mutex_lock(&phone->lock); 190 if (phone->state == IPC_PHONE_CONNECTED) { 191 irq_spinlock_lock(&phone->callee->lock, true); 192 list_remove(&phone->link); 193 phone->state = IPC_PHONE_SLAMMED; 194 irq_spinlock_unlock(&phone->callee->lock, true); 195 } 196 mutex_unlock(&phone->lock); 203 cleanup_m_connection_clone(answer, olddata); 197 204 } 198 205 … … 206 213 if (IPC_GET_RETVAL(answer->data) != EOK) { 207 214 /* 208 * The other party on the cloned phone drejected our request215 * The other party on the cloned phone rejected our request 209 216 * for connection on the protocol level. We need to break the 210 217 * connection without sending IPC_M_HUNGUP back. … … 223 230 } 224 231 232 static void cleanup_m_connect_to_me(call_t *answer, ipc_data_t *olddata) 233 { 234 int phoneid = (int) IPC_GET_ARG5(*olddata); 235 236 phone_dealloc(phoneid); 237 } 238 225 239 static int a_preprocess_m_connect_to_me(call_t *answer, ipc_data_t *olddata) 226 240 { … … 229 243 if (IPC_GET_RETVAL(answer->data) != EOK) { 230 244 /* The connection was not accepted */ 231 phone_dealloc(phoneid);245 cleanup_m_connect_to_me(answer, olddata); 232 246 } else { 233 247 /* The connection was accepted */ … … 240 254 } 241 255 256 static void cleanup_m_connect_me_to(call_t *answer, ipc_data_t *olddata) 257 { 258 phone_dealloc(answer->priv); 259 } 260 242 261 static int a_preprocess_m_connect_me_to(call_t *answer, ipc_data_t *olddata) 243 262 { 244 263 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata); 245 264 246 /* If the user saccepted call, connect */265 /* If the user accepted call, connect */ 247 266 if (IPC_GET_RETVAL(answer->data) == EOK) 248 267 ipc_phone_connect(phone, &TASK->answerbox); … … 406 425 } 407 426 427 /** Cleanup additional resources associated with the answer. */ 428 static void cleanup_forgotten(call_t *answer, ipc_data_t *olddata) 429 { 430 if (!olddata) 431 return; 432 433 switch (IPC_GET_IMETHOD(*olddata)) { 434 case IPC_M_CONNECTION_CLONE: 435 cleanup_m_connection_clone(answer, olddata); 436 break; 437 case IPC_M_CONNECT_TO_ME: 438 cleanup_m_connect_to_me(answer, olddata); 439 break; 440 case IPC_M_CONNECT_ME_TO: 441 cleanup_m_connect_me_to(answer, olddata); 442 break; 443 default: 444 break; 445 } 446 } 447 408 448 /** Interpret process answer as control information. 409 449 * … … 426 466 */ 427 467 spinlock_unlock(&answer->forget_lock); 428 /* TODO: free the call and its resources */468 cleanup_forgotten(answer, olddata); 429 469 return rc; 430 470 } else {
Note:
See TracChangeset
for help on using the changeset viewer.