MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / exitgroup

Method exitgroup

source/kernel/kprocess.cpp:1641–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1639}
1640
1641U32 KProcess::exitgroup(KThread* thread, U32 code) {
1642 KProcessPtr parent = KSystem::getProcess(this->parentId);
1643 if (parent && parent->sigActions[K_SIGCHLD].handlerAndSigAction!=K_SIG_DFL) {
1644 if (parent->sigActions[K_SIGCHLD].handlerAndSigAction!=K_SIG_IGN) {
1645 parent->signalCHLD(K_CLD_EXITED, this->id, this->userId, code);
1646 }
1647 }
1648
1649 killAllThreads(thread);
1650
1651 {
1652 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(KSystem::processesCond);
1653 this->terminated = true;
1654 }
1655
1656 thread->cleanup(); // must happen before we clear memory
1657 this->threads.clear();
1658 if (cloneVM) {
1659 // make sure the shared memory is unhooked from parent
1660 this->memory->execvReset(cloneVM);
1661 }
1662 this->cleanupProcess(); // release RAM, sockets, etc now. No reason to wait to do that until waitpid is called
1663 this->exitCode = code;
1664
1665 {
1666 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(this->exitOrExecCond);
1667 BOXEDWINE_CONDITION_SIGNAL_ALL(this->exitOrExecCond);
1668 }
1669 if (KSystem::getProcessCount()==1) {
1670 // no one left to wait on this process, with no processes running main will exit boxedwine
1671 KSystem::eraseProcess(this->id);
1672 }
1673
1674 {
1675 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(KSystem::processesCond);
1676 KSystem::wakeThreadsWaitingOnProcessStateChanged(); // after this the process could be deleted
1677 }
1678
1679 terminateCurrentThread(thread);
1680 return -K_CONTINUE;
1681}
1682
1683U32 KProcess::fchdir(FD fildes) {
1684 KFileDescriptorPtr fd = this->getFileDescriptor(fildes);

Callers 2

exitMethod · 0.95
syscall_exit_groupFunction · 0.80

Calls 6

cleanupProcessMethod · 0.95
signalCHLDMethod · 0.80
terminateCurrentThreadFunction · 0.70
cleanupMethod · 0.45
clearMethod · 0.45
execvResetMethod · 0.45

Tested by

no test coverage detected