Changeset 3200 in kBuild
- Timestamp:
- Mar 28, 2018 8:32:11 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/kWorker.c
r3199 r3200 9534 9534 KU32 const g_cSandboxGetProcReplacements = K_ELEMENTS(g_aSandboxGetProcReplacements); 9535 9535 9536 /**9537 * Thread that is spawned by the first terminal kwSandboxCtrlHandler invocation.9538 *9539 * This will wait 5 second in a hope that the main thread will shut down the9540 * process nicly, otherwise it will terminate it forcefully.9541 */9542 static DWORD WINAPI kwSandboxCtrlThreadProc(PVOID pvUser)9543 {9544 int i;9545 for (i = 0; i < 10; i++)9546 {9547 Sleep(500);9548 CancelIoEx(g_hPipe, NULL);9549 }9550 TerminateProcess(GetCurrentProcess(), (int)(intptr_t)pvUser);9551 return -1;9552 }9553 9554 9536 9555 9537 /** … … 9599 9581 /* 9600 9582 * Terminate the process after 5 seconds. 9601 *9602 * We don't want to wait here as the console server will otherwise not9603 * signal the other processes in the console, which is bad for kmk as it9604 * will continue to forge ahead. So, the first time we get here we start9605 * a thread for doing the delayed termination.9606 *9607 9583 * If we get here a second time we just terminate the process ourselves. 9608 9584 * … … 9613 9589 g_rcCtrlC = rc; 9614 9590 WriteFile(GetStdHandle(STD_ERROR_HANDLE), pszMsg, (DWORD)strlen(pszMsg), &cbIgn, NULL); 9615 CancelIoEx(g_hPipe, NULL); /* wake up idle main thread */9616 9591 if (rcPrev == 0) 9617 9592 { 9618 CreateThread(NULL, 0, kwSandboxCtrlThreadProc, (void*)(intptr_t)rc, 0 /*fFlags*/, NULL); 9619 return TRUE; 9593 int i; 9594 for (i = 0; i < 10; i++) 9595 { 9596 CancelIoEx(g_hPipe, NULL); /* wake up idle main thread */ 9597 Sleep(500); 9598 } 9620 9599 } 9621 9600 TerminateProcess(GetCurrentProcess(), rc); -
trunk/src/kmk/kmkbuiltin/kSubmit.c
r3199 r3200 71 71 72 72 #define TUPLE(a_sz) a_sz, sizeof(a_sz) - 1 73 73 74 74 75 /********************************************************************************************************************************* … … 1151 1152 # else 1152 1153 if (MkWinChildCreateSubmit((intptr_t)pWorker->OverlappedRead.hEvent, pWorker, 1153 pWorker->pStdOut, pWorker->pStdErr, p PidSpawned) == 0)1154 pWorker->pStdOut, pWorker->pStdErr, pChild, pPidSpawned) == 0) 1154 1155 { /* likely */ } 1155 1156 else … … 1691 1692 the kWorker process currently does not coordinate its output with 1692 1693 the output.c mechanics. */ 1694 #ifdef CONFIG_NEW_WIN_CHILDREN 1695 if (pCtx->pOut && !pWorker->pStdOut) 1696 #else 1693 1697 if (pCtx->pOut) 1698 #endif 1694 1699 output_dump(pCtx->pOut); 1695 1696 1700 rcExit = kSubmitSendJobMessage(pCtx, pWorker, pvMsg, cbMsg, 0 /*fNoRespawning*/, cVerbosity); 1697 1701 if (rcExit == 0) -
trunk/src/kmk/output.c
r3195 r3200 131 131 const char *nl = (const char *)memchr (src, '\n', len); 132 132 size_t line_len = nl ? nl - (const char *)src + 1 : len; 133 char *tmp = (char *)xmalloc ( 2 + line_len+ 1);134 tmp[0] = ' >';135 tmp[1] = ' ';136 memcpy (&tmp[2], src, line_len);133 char *tmp = (char *)xmalloc (1 + line_len + 1 + 1); 134 tmp[0] = '{'; 135 memcpy (&tmp[1], src, line_len); 136 tmp[1 + line_len] = '}'; 137 137 # ifdef KBUILD_OS_WINDOWS 138 maybe_con_fwrite (tmp, 2 + line_len, 1, dst);138 maybe_con_fwrite (tmp, 1 + line_len + 1, 1, dst); 139 139 # else 140 fwrite (tmp, 2 + line_len, 1, dst);140 fwrite (tmp, 1 + line_len + 1, 1, dst); 141 141 # endif 142 142 free (tmp); -
trunk/src/kmk/w32/winchildren.c
r3199 r3200 3118 3118 * @param hEvent The event object handle to wait on. 3119 3119 * @param pvSubmitWorker The argument to pass back to kSubmit to clean up. 3120 * @param pPid Where to return the pid.3121 3120 * @param pStdOut Standard output pipe for the worker. Optional. 3122 3121 * @param pStdErr Standard error pipe for the worker. Optional. 3123 */ 3124 int MkWinChildCreateSubmit(intptr_t hEvent, void *pvSubmitWorker, PWINCCWPIPE pStdOut, PWINCCWPIPE pStdErr, pid_t *pPid) 3122 * @param pMkChild The make child structure. 3123 * @param pPid Where to return the pid. 3124 */ 3125 int MkWinChildCreateSubmit(intptr_t hEvent, void *pvSubmitWorker, PWINCCWPIPE pStdOut, PWINCCWPIPE pStdErr, 3126 struct child *pMkChild, pid_t *pPid) 3125 3127 { 3126 3128 PWINCHILD pChild = mkWinChildNew(WINCHILDTYPE_SUBMIT); 3129 pChild->pMkChild = pMkChild; 3127 3130 pChild->u.Submit.hEvent = (HANDLE)hEvent; 3128 3131 pChild->u.Submit.pvSubmitWorker = pvSubmitWorker; -
trunk/src/kmk/w32/winchildren.h
r3199 r3200 75 75 struct child *pMkChild, pid_t *pPid); 76 76 77 int MkWinChildCreateSubmit(intptr_t hEvent, void *pvSubmitWorker, PWINCCWPIPE pStdOut, PWINCCWPIPE pStdErr, pid_t *pPid); 77 int MkWinChildCreateSubmit(intptr_t hEvent, void *pvSubmitWorker, PWINCCWPIPE pStdOut, PWINCCWPIPE pStdErr, 78 struct child *pMkChild, pid_t *pPid); 78 79 PWINCCWPIPE MkWinChildcareCreateWorkerPipe(unsigned iWhich, unsigned int idxWorker); 79 80 void MkWinChildcareWorkerDrainPipes(struct WINCHILD *pChild, PWINCCWPIPE pStdOut, PWINCCWPIPE pStdErr);
Note:
See TracChangeset
for help on using the changeset viewer.