Changeset 2293 for trunk/src/kash/shfile.c
- Timestamp:
- Feb 28, 2009, 8:25:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shfile.c
r2290 r2293 451 451 } 452 452 453 #if K_OS == K_OS_WINDOWS && defined(SHFILE_IN_USE) //&& defined(SH_FORKED_MODE) 454 /** 455 * Helper for shfork. 456 * 457 * @param pfdtab The file descriptor table. 458 * @param set Whether to make all handles inheritable (1) or 459 * to restore them to the rigth state (0). 460 * @param hndls Where to store the three standard handles. 461 */ 462 void shfile_fork_win(shfdtab *pfdtab, int set, intptr_t *hndls) 463 { 464 shmtxtmp tmp; 465 unsigned i; 466 467 shmtx_enter(&pfdtab->mtx, &tmp); 468 469 i = pfdtab->size; 470 while (i-- > 0) 471 { 472 if (pfdtab->tab[i].fd == i) 473 { 474 HANDLE hFile = (HANDLE)pfdtab->tab[i].native; 475 DWORD fFlag = set || !pfdtab->tab[i].cloexec ? HANDLE_FLAG_INHERIT : 0; 476 if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, fFlag)) 477 { 478 DWORD err = GetLastError(); 479 assert(0); 480 } 481 } 482 } 483 484 if (hndls) 485 { 486 for (i = 0; i < 3; i++) 487 { 488 if ( pfdtab->size > i 489 && pfdtab->tab[i].fd == 0) 490 hndls[i] = pfdtab->tab[i].native; 491 else 492 hndls[i] = (intptr_t)INVALID_HANDLE_VALUE; 493 } 494 } 495 496 shmtx_leave(&pfdtab->mtx, &tmp); 497 } 498 #endif 499 500 453 501 /** 454 502 * open().
Note:
See TracChangeset
for help on using the changeset viewer.