Changeset 3169 for trunk/src/kmk/w32
- Timestamp:
- Mar 21, 2018, 12:27:47 PM (7 years ago)
- Location:
- trunk/src/kmk/w32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/w32/winchildren.c
r3165 r3169 109 109 #ifdef KMK 110 110 /** kmkbuiltin command. */ 111 WINCHILDTYPE_BUILT IN,111 WINCHILDTYPE_BUILT_IN, 112 112 /** kSubmit job. */ 113 113 WINCHILDTYPE_SUBMIT, … … 175 175 HANDLE hProcess; 176 176 } Process; 177 178 /** Data for WINCHILDTYPE_BUILT_IN. */ 179 struct 180 { 181 /** The built-in command. */ 182 PCKMKBUILTINENTRY pBuiltIn; 183 /** Number of arguments. */ 184 int cArgs; 185 /** Argument vector (single allocation, strings following array). */ 186 char **papszArgs; 187 /** Environment vector. Only a copy if fEnvIsCopy is set. */ 188 char **papszEnv; 189 } BuiltIn; 177 190 178 191 /** Data for WINCHILDTYPE_SUBMIT. */ … … 1643 1656 * @param pChild The kSubmit child. 1644 1657 */ 1645 static void mkWinChildcareWorkerThreadHandleBuiltin(PWINCHILDCAREWORKER pWorker, PWINCHILD pChild) 1646 { 1647 /** @todo later. */ 1648 __debugbreak(); 1658 static void mkWinChildcareWorkerThreadHandleBuiltIn(PWINCHILDCAREWORKER pWorker, PWINCHILD pChild) 1659 { 1660 PCKMKBUILTINENTRY pBuiltIn = pChild->u.BuiltIn.pBuiltIn; 1661 if (pBuiltIn->uFnSignature == FN_SIG_MAIN) 1662 pChild->iExitCode = pBuiltIn->u.pfnMain(pChild->u.BuiltIn.cArgs, pChild->u.BuiltIn.papszArgs, pChild->u.BuiltIn.papszEnv); 1663 else if (pBuiltIn->uFnSignature == FN_SIG_MAIN_SPAWNS) 1664 pChild->iExitCode = pBuiltIn->u.pfnMainSpawns(pChild->u.BuiltIn.cArgs, pChild->u.BuiltIn.papszArgs, 1665 pChild->u.BuiltIn.papszEnv, pChild->pMkChild, NULL); 1666 else 1667 { 1668 assert(0); 1669 pChild->iExitCode = 98; 1670 } 1649 1671 } 1650 1672 … … 1760 1782 break; 1761 1783 #ifdef KMK 1762 case WINCHILDTYPE_BUILT IN:1763 mkWinChildcareWorkerThreadHandleBuilt in(pWorker, pChild);1784 case WINCHILDTYPE_BUILT_IN: 1785 mkWinChildcareWorkerThreadHandleBuiltIn(pWorker, pChild); 1764 1786 break; 1765 1787 case WINCHILDTYPE_SUBMIT: … … 1969 1991 1970 1992 #ifdef KMK 1971 1972 case WINCHILDTYPE_BUILTIN: 1973 assert(0); 1993 case WINCHILDTYPE_BUILT_IN: 1994 if (pChild->u.BuiltIn.papszArgs) 1995 { 1996 free(pChild->u.BuiltIn.papszArgs); 1997 pChild->u.BuiltIn.papszArgs = NULL; 1998 } 1999 if (pChild->u.BuiltIn.papszEnv) 2000 { 2001 free(pChild->u.BuiltIn.papszEnv); 2002 pChild->u.BuiltIn.papszEnv = NULL; 2003 } 1974 2004 break; 1975 2005 … … 1989 2019 } 1990 2020 break; 1991 1992 2021 #endif /* KMK */ 1993 2022 … … 2230 2259 2231 2260 /** 2261 * Interface used by kmkbuiltin.c for executing builtin commands on threads. 2262 * 2263 * @returns 0 on success, windows status code on failure. 2264 * @param pBuiltIn The kmk built-in command entry. 2265 * @param cArgs The number of arguments in papszArgs. 2266 * @param papszArgs The argument vector. 2267 * @param papszEnv The environment vector, optional. 2268 * @param pMkChild The make child structure. 2269 * @param pPid Where to return the pid. 2270 */ 2271 int MkWinChildCreateBuiltIn(PCKMKBUILTINENTRY pBuiltIn, int cArgs, char **papszArgs, char **papszEnv, 2272 struct child *pMkChild, pid_t *pPid) 2273 { 2274 size_t cbIgnored; 2275 PWINCHILD pChild = mkWinChildNew(WINCHILDTYPE_BUILT_IN); 2276 pChild->pMkChild = pMkChild; 2277 pChild->u.BuiltIn.pBuiltIn = pBuiltIn; 2278 pChild->u.BuiltIn.cArgs = cArgs; 2279 pChild->u.BuiltIn.papszArgs = mkWinChildCopyStringArray(papszArgs, &cbIgnored); 2280 pChild->u.BuiltIn.papszEnv = papszEnv ? mkWinChildCopyStringArray(papszEnv, &cbIgnored) : NULL; 2281 return mkWinChildPushToCareWorker(pChild, pPid); 2282 } 2283 2284 /** 2232 2285 * Interface used by kSubmit.c for registering stuff to wait on. 2233 2286 * … … 2299 2352 break; 2300 2353 2301 case WINCHILDTYPE_BUILT IN:2354 case WINCHILDTYPE_BUILT_IN: 2302 2355 break; 2303 2356 … … 2364 2417 break; 2365 2418 #ifdef KMK 2366 case WINCHILDTYPE_BUILT IN:2419 case WINCHILDTYPE_BUILT_IN: 2367 2420 break; 2368 2421 case WINCHILDTYPE_SUBMIT: -
trunk/src/kmk/w32/winchildren.h
r3159 r3169 27 27 #define INCLUDED_WINCHILDREN_H 28 28 29 void MkWinChildInit(unsigned int cJobSlot); 30 void MkWinChildReExecMake(char **papszArgs, char **papszEnv); 29 30 void MkWinChildInit(unsigned int cJobSlot); 31 void MkWinChildReExecMake(char **papszArgs, char **papszEnv); 31 32 intptr_t MkWinChildGetCompleteEventHandle(void); 32 33 int MkWinChildCreate(char **papszArgs, char **papszEnv, const char *pszShell, struct child *pMkChild, pid_t *pPid); 33 34 int MkWinChildCreateWithStdOutPipe(char **papszArgs, char **papszEnv, int fdErr, pid_t *pPid, int *pfdReadPipe); 35 #ifdef KMK 36 struct KMKBUILTINENTRY; 37 int MkWinChildCreateBuiltIn(struct KMKBUILTINENTRY const *pBuiltIn, int cArgs, char **papszArgs, 38 char **papszEnv, struct child *pMkChild, pid_t *pPid); 34 39 int MkWinChildCreateSubmit(intptr_t hEvent, void *pvSubmitWorker, pid_t *pPid); 35 40 int MkWinChildCreateRedirect(intptr_t hProcess, pid_t *pPid); 41 #endif 36 42 int MkWinChildKill(pid_t pid, int iSignal, struct child *pMkChild); 37 43 int MkWinChildWait(int fBlock, pid_t *pPid, int *piExitCode, int *piSignal, int *pfCoreDumped, struct child **ppMkChild);
Note:
See TracChangeset
for help on using the changeset viewer.