Changeset 5058 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Sep 26, 2007 4:35:25 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 24871
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/os2/os2misc.c
r3368 r5058 61 61 62 62 63 /* see assembleEnvBlock() below */ 64 #define USE_DOSALLOCMEM 65 66 63 67 /* 64 68 ************************************************************************** … … 204 208 envBlockSize++; 205 209 210 /* It seems that the Environment parameter of DosStartSession() and/or 211 * DosExecPgm() wants a memory block that is completely within the 64K 212 * memory object; otherwise we will get the environment truncated on the 213 * 64K boundary in the child process. PR_MALLOC() cannot guarantee this, 214 * so use DosAllocMem directly. */ 215 #ifdef USE_DOSALLOCMEM 216 DosAllocMem((PPVOID) envBlock, envBlockSize, PAG_COMMIT | PAG_READ | PAG_WRITE); 217 p = *envBlock; 218 #else 206 219 p = *envBlock = PR_MALLOC(envBlockSize); 220 #endif 207 221 if (p == NULL) { 208 222 return -1; … … 235 249 236 250 /* 237 * On OS/2, you can only detach a new process -- you cannot make it detached238 * after it has been started. This is why _PR_CreateOS2ProcessEx() is239 * necessary. This function is called directly from PR_CreateProcessDetached().240 * /251 * On OS/2, a process can be detached only when it is started -- you cannot 252 * make it detached afterwards. This is why _PR_CreateOS2ProcessEx() is 253 * necessary. This function is called directly from 254 * PR_CreateProcessDetached(). */ 241 255 PRProcess * _PR_CreateOS2ProcessEx( 242 256 const char *path, … … 281 295 * it into the envp array, so envp cannot be NULL. 282 296 */ 283 if ( (envp == NULL)&& attr && attr->fdInheritBuffer) {297 if (envp == NULL && attr && attr->fdInheritBuffer) { 284 298 envp = environ; 285 299 } … … 342 356 } 343 357 358 /* We don't want to use DosExecPgm for detached processes because 359 * they won't have stdin/stderr/stdout by default which will hang up 360 * the child process if it tries to write/read from there. Instead, 361 * we will detach console processes by starting them using the PM session 362 * (yes, it requires PM, but the whole XPCOM does so too). 363 */ 364 #if 0 344 365 if (detached) { 345 366 /* we don't care about parent/child process type matching, … … 384 405 } 385 406 386 proc->md.pid = res.codeTerminate; 387 } 388 else { 407 /* use 0 to indicate the detached process in the internal 408 * process structure (I believe no process may have pid of 0) */ 409 proc->md.pid = 0 /* res.codeTerminate */; 410 } 411 else 412 #endif 413 { 389 414 STARTDATA startData = {0}; 390 415 … … 393 418 } 394 419 else if (ulAppType & FAPPTYP_WINDOWCOMPAT) { 395 startData.SessionType = SSF_TYPE_WINDOWABLEVIO; 420 startData.SessionType = detached ? SSF_TYPE_PM 421 : SSF_TYPE_WINDOWABLEVIO; 422 } 423 else if (ulAppType & FAPPTYP_NOTWINDOWCOMPAT) { 424 startData.SessionType = detached ? SSF_TYPE_PM 425 : SSF_TYPE_DEFAULT; 396 426 } 397 427 else { … … 418 448 startData.PgmName = pszEXEName; 419 449 450 startData.Related = detached ? SSF_RELATED_INDEPENDENT : SSF_RELATED_CHILD; 451 420 452 startData.Length = sizeof(startData); 421 startData.Related = SSF_RELATED_INDEPENDENT;422 453 startData.ObjectBuffer = pszObjectBuffer; 423 454 startData.ObjectBuffLen = CCHMAXPATH; … … 431 462 } 432 463 433 proc->md.pid = pid; 464 /* if Related is SSF_RELATED_INDEPENDENT, we don't get pid of the started 465 * process and use 0 to indicate the detached process in the internal 466 * process structure (I believe no process may have pid of 0). 467 */ 468 proc->md.pid = detached ? 0 : pid; 434 469 } 435 470 … … 444 479 } 445 480 if (envBlock) { 481 #ifdef USE_DOSALLOCMEM 482 DosFreeMem(envBlock); 483 #else 446 484 PR_DELETE(envBlock); 485 #endif 447 486 } 448 487 return proc; … … 459 498 } 460 499 if (envBlock) { 500 #ifdef USE_DOSALLOCMEM 501 DosFreeMem(envBlock); 502 #else 461 503 PR_DELETE(envBlock); 504 #endif 462 505 } 463 506 if (proc) { … … 481 524 * You can't 'detach' it later on. 482 525 */ 483 PR_DELETE(process); 484 return PR_SUCCESS; 526 if (process->md.pid == 0) { 527 /* this is a detached process, just free memory */ 528 PR_DELETE(process); 529 return PR_SUCCESS; 530 } 531 /* For a normal child process, we can't complete the request. Note that 532 * terminating the parent process w/o calling PR_WaitProcess() on the 533 * child will terminate the child as well (since it is not detached). 534 */ 535 PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); 536 return PR_FAILURE; 485 537 } 486 538 … … 510 562 PRStatus _PR_KillOS2Process(PRProcess *process) 511 563 { 512 ULONG ulRetVal;564 ULONG ulRetVal; 513 565 if ((ulRetVal = DosKillProcess(DKP_PROCESS, process->md.pid)) == NO_ERROR) { 514 566 return PR_SUCCESS; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r3368 r5058 740 740 const PRProcessAttr *attr) 741 741 { 742 #ifdef XP_OS2743 PRProcess *process;744 process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE);745 if (NULL == process) {746 return PR_FAILURE;747 }748 return PR_SUCCESS;749 #else750 742 PRProcess *process; 751 743 PRStatus rv; 752 744 745 #ifdef XP_OS2 746 process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE); 747 #else 753 748 process = PR_CreateProcess(path, argv, envp, attr); 749 #endif 754 750 if (NULL == process) { 755 751 return PR_FAILURE; … … 762 758 } 763 759 return PR_SUCCESS; 764 #endif765 760 } 766 761
Note:
See TracChangeset
for help on using the changeset viewer.