* Execute fork() and exec() wrappers in exclusive mode * * fork() and exec() wrappers pass on the state/information about the current * process/program to the to-be-created process/program. * * There can be a potential race in the wrappers if this information gets * changed between the point where it was acquired and the point where the * process/program is created. An example of this situa
| 247 | * repeated calls to _real_epoll_wait with smaller timeout. |
| 248 | */ |
| 249 | void |
| 250 | ThreadSync::wrapperExecutionLockLockExcl() |
| 251 | { |
| 252 | int saved_errno = errno; |
| 253 | |
| 254 | // The process is still initializing. We don't need to acquire lock. |
| 255 | if (WorkerState::currentState() == WorkerState::UNKNOWN) { |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | Thread *thread = dmtcp_get_current_thread(); |
| 260 | |
| 261 | if (DmtcpRWLockWrLock(&_wrapperExecutionLock) != 0) { |
| 262 | fprintf(stderr, "ERROR %s:%d %s: Failed to acquire lock\n", |
| 263 | __FILE__, __LINE__, __PRETTY_FUNCTION__); |
| 264 | _exit(DMTCP_FAIL_RC); |
| 265 | } |
| 266 | thread->wrapperLockCount++; |
| 267 | errno = saved_errno; |
| 268 | } |
| 269 | |
| 270 | // NOTE: Don't do any fancy stuff in this wrapper which can cause the process |
| 271 | // to go into DEADLOCK |
nothing calls this directly
no test coverage detected