Changeset 1631
- Timestamp:
- Nov 14, 2004, 8:03:24 PM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/InnoTekLIBC/sharedpm.h
-
Property cvs2svn:cvs-rev
changed from
1.17
to1.18
r1630 r1631 675 675 676 676 /** 677 * Validates a process group id. 678 * 679 * @returns 0 if valid. 680 * @returns -ESRCH if not valid. 681 * @param pgrp Process group id to validate. 0 if the same as 682 * the same as the current process. 683 * @param fOnlyChildren Restrict the search to immediate children. 684 */ 685 int __libc_spmValidPGrp(pid_t pgrp, int fOnlyChildren); 686 687 688 /** 677 689 * Identificators which can be obtained using __libc_spmGetId(). 678 690 */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/beginthr.c
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r1630 r1631 101 101 int rc = __libc_back_threadCreate(pfnStart, cbStack, pvArg, 0); 102 102 if (rc >= 0) 103 LIBCLOG_RETURN_INT( -1);103 LIBCLOG_RETURN_INT(rc); 104 104 errno = -rc; 105 105 LIBCLOG_RETURN_INT(-1); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/waitpid.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1630 r1631 84 84 /* do the call */ 85 85 siginfo_t SigInfo = {0}; 86 int rc = waitid(P_ALL, 0, &SigInfo, WEXITED);86 int rc = waitid(P_ALL, 0, &SigInfo, fOptions | WEXITED); 87 87 if (!rc) 88 88 { … … 108 108 SigInfo.si_pid, SigInfo.si_pid, iStatus); 109 109 } 110 errno = -rc; 111 LIBCLOG_RETURN_INT(-1); 110 LIBCLOG_RETURN_INT(rc); 112 111 } 113 112 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__select.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1630 r1631 27 27 #include "libc-alias.h" 28 28 #define INCL_FSMACROS 29 #define INCL_DOSPROCESS 29 #define INCL_DOSSEMAPHORES 30 #define INCL_ERRORS 30 31 #include <os2emx.h> 31 32 #include <stdlib.h> … … 37 38 #include <emx/syscalls.h> 38 39 #include "syscalls.h" 40 #include "backend.h" 39 41 40 42 … … 48 50 int rc; 49 51 if (!tv) 50 rc = Dos Sleep(~0);52 rc = DosWaitEventSem(__libc_back_ghevWait, SEM_INDEFINITE_WAIT); 51 53 else 52 54 { … … 54 56 if (!cMillies && tv->tv_usec) 55 57 cMillies = 1; 56 rc = Dos Sleep(cMillies);58 rc = DosWaitEventSem(__libc_back_ghevWait, cMillies); 57 59 } 58 60 FS_RESTORE(); … … 61 63 * Return. 62 64 */ 63 if (!rc )65 if (!rc || rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT) 64 66 return 0; 65 67 errno = __libc_native2errno(rc); … … 174 176 rc = pfnSelect(nfds, readfds, writefds, exceptfds, tv, &rc2); 175 177 } 176 else if (tv)177 {178 FS_VAR();179 /* wait for the given amount of time. */180 rc2 = rc = 0;181 FS_SAVE_LOAD();182 DosSleep(tv->tv_sec * 1000 + tv->tv_usec / 1000);183 FS_RESTORE();184 }185 178 else 186 179 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__spawnve.c
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r1630 r1631 275 275 276 276 /* 277 * Notify the process waiter system.278 */279 __libc_back_processWaitNotifyExec();280 281 /*282 277 * Create the process. 283 278 */ … … 290 285 __atomic_cmpxchg32((volatile uint32_t *)(void *)&pEmbryo->pid, (uint32_t)resc.codeTerminate, 0); 291 286 LIBCLOG_MSG("Spawned pid=%04lx (%ld)\n", resc.codeTerminate, resc.codeTerminate); 287 __libc_back_processWaitNotifyExec(resc.codeTerminate); 292 288 293 289 /* cleanup embryo and other stuff. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_process.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1630 r1631 37 37 38 38 void __libc_back_processWaitNotifyTerm(void); 39 void __libc_back_processWaitNotifyExec( void);39 void __libc_back_processWaitNotifyExec(pid_t pid); 40 40 void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo); 41 41 void __libc_back_processWaitNotifyNoWait(int fNoWaitStatus); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_processWait.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1630 r1631 84 84 85 85 86 /** Pointer to child process info node. */ 87 typedef struct WAITCHILD *PWAITCHILD; 88 /** 89 * Child Process info node. 90 */ 91 typedef struct WAITCHILD 92 { 93 /** Pointer to the next one. */ 94 volatile PWAITCHILD pNext; 95 /** Process Id. */ 96 pid_t pid; 97 } WAITCHILD; 98 86 99 87 100 /******************************************************************************* … … 102 115 /** Index into the preallocated nodes. */ 103 116 static volatile unsigned giWaitPreAlloced; 117 /** List of known children. */ 118 static volatile PWAITCHILD gpChildrenHead; 119 /** Number of known child processes. */ 120 static volatile unsigned gcChildren; 121 /** Total number of born child processes. */ 122 static volatile unsigned gcBirths; 123 /** Total number of died child processes. */ 124 static volatile unsigned gcDeaths; 104 125 105 126 /** If this flag is set we don't care for wait status info. … … 110 131 /** The event semaphore the callers are sleeping on. */ 111 132 static volatile HEV ghevWait; 133 /** The event semaphore the wait thread are sleeping on. */ 134 static volatile HEV ghevBirth; 112 135 113 136 /** Thread ID of the wait thread. */ 114 137 static volatile TID gtidThread; 115 138 /** Termination indicator. Used to help the wait thread terminate fast. */ 116 static volatile intgfTerminate;139 static volatile unsigned gfTerminate; 117 140 118 141 … … 146 169 if (rc) 147 170 abort(); 171 rc = DosCreateEventSemEx(NULL, (PHEV)&ghevBirth, 0, FALSE); 172 if (rc) 173 abort(); 174 148 175 149 176 /* done */ … … 164 191 { 165 192 /* kill the thread */ 166 gfTerminate = TRUE; 193 __atomic_xchg(&gfTerminate, 1); 194 DosKillThread(gtidThread); 167 195 gtidThread = 0; 168 DosKillThread(gtidThread); 169 170 /* destroy the event semaphore. */ 171 HEV hev = ghevWait; 172 ghevWait = NULLHANDLE; 173 if (hev) 174 DosPostEventSem(hev); 196 } 197 198 /* destroy the birth event semaphore. */ 199 HEV hev = ghevBirth; 200 ghevBirth = NULLHANDLE; 201 if (hev) 202 { 203 DosPostEventSem(hev); 204 DosCloseEventSem(hev); 205 } 206 207 /* destroy the wait event semaphore. */ 208 hev = ghevWait; 209 ghevWait = NULLHANDLE; 210 if (hev) 211 { 212 DosPostEventSem(hev); 213 DosCloseEventSem(hev); 175 214 } 176 215 } … … 218 257 pWait->pNext = NULL; 219 258 pWait->pPrev = gpWaitTail; 220 if (!pWait->pPrev) 259 if (pWait->pPrev) 260 pWait->pPrev->pNext = pWait; 261 else 221 262 gpWaitHead = pWait; 222 263 gpWaitTail = pWait; … … 233 274 PTIB pTib; 234 275 DosGetInfoBlocks(&pTib, &pPib); 276 DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, 1, 0); 235 277 236 278 /* … … 240 282 for (;!gfTerminate;) 241 283 { 242 for (;!gfTerminate;) 243 { 284 /* 285 * Check for exit condition. 286 */ 287 fInternalTerm = gfTerminate; 288 if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/*ExitList */)) 289 { 290 LIBCLOG_MSG("Terminating thread, exit conditions detected. pib_flstatus=%#lx\n", pPib->pib_flstatus); 291 fInternalTerm = 1; 292 } 293 294 /* 295 * Wait for children. 296 */ 297 WAITINFO Wait; 298 int rc = waitChild(&Wait, fInternalTerm, 0 /* any child */); 299 if (!rc) 300 { 301 /* enter semaphore protection. */ 302 rc = waitSemRequest(1); 303 244 304 /* 245 * Check for exit condition.305 * Need we bother inserting it? 246 306 */ 247 fInternalTerm = gfTerminate; 248 if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/*ExitList */)) 307 if (!gfNoWaitStatus) 308 waitAllocInsert(&Wait); 309 310 /* 311 * Increment death number and decrement number of (known) children. 312 */ 313 __atomic_increment(&gcDeaths); 314 315 /* 316 * Remove the child from the list. 317 */ 318 PWAITCHILD pPrev = NULL; 319 PWAITCHILD pChild = gpChildrenHead; 320 while (pChild) 249 321 { 250 LIBCLOG_MSG("Terminating thread, exit conditions detected. pib_flstatus=%#lx\n", pPib->pib_flstatus); 251 fInternalTerm = TRUE; 322 if (pChild->pid == Wait.pid) 323 { 324 if (pPrev) 325 pPrev->pNext = pChild->pNext; 326 else 327 gpChildrenHead = pChild->pNext; 328 __atomic_decrement_min(&gcChildren, 0); 329 break; 330 } 331 332 /* next */ 333 pPrev = pChild; 334 pChild = pChild->pNext; 252 335 } 253 336 254 337 /* 255 * Wa it for children.338 * Wake up any waiters. 256 339 */ 257 WAITINFO Wait; 258 int rc = waitChild(&Wait, fInternalTerm, 0 /* any child */); 340 if (DosPostEventSem(ghevWait) == ERROR_INVALID_HANDLE) 341 fInternalTerm = 1; 342 343 /* 344 * Leave semaphore protection and wait again unless someone's hinting it's time to quit... 345 */ 259 346 if (!rc) 260 { 261 /* 262 * Need we bother inserting it? 263 */ 264 rc = waitSemRequest(1); 265 if (!rc && !gfNoWaitStatus) 266 rc = waitAllocInsert(&Wait); 267 268 /* 269 * Wake up any waiters. 270 */ 271 int rcOS2 = DosPostEventSem(ghevWait); 272 if (!rc) 273 waitSemRelease(); 274 if (rc || (rcOS2 && rcOS2 != ERROR_TOO_MANY_POSTS && rcOS2 != ERROR_ALREADY_POSTED)) 275 fInternalTerm = 1; 276 rc = 0; 277 } 278 if (rc || fInternalTerm) 347 waitSemRelease(); 348 if (fInternalTerm) 279 349 break; 280 } 281 282 /* 283 * Check if we're encouraged to quit. 284 */ 285 if (fInternalTerm || gfTerminate) 286 break; 350 continue; 351 } 287 352 288 353 /* … … 293 358 * using the nowait option on the API call. 294 359 */ 360 if (fInternalTerm || gfTerminate) 361 break; 295 362 if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/*ExitList */)) 296 363 { 297 364 LIBCLOG_MSG("Terminating thread, exit conditions detected. pib_flstatus=%#lx\n", pPib->pib_flstatus); 298 fInternalTerm = TRUE;365 fInternalTerm = 1; 299 366 continue; 300 367 } 301 368 302 DosWaitEventSem(ghevWait, 30*1000); 369 if (rc == ERROR_WAIT_NO_CHILDREN) 370 { 371 DosWaitEventSem(ghevBirth, 5*1000); 372 ULONG cIgnore; 373 if (DosResetEventSem(ghevBirth, &cIgnore) == ERROR_INVALID_HANDLE) 374 fInternalTerm = 1; 375 } 376 else 377 LIBC_ASSERTM_FAILED("waitChild -> rc=%d expected ERROR_WAIT_NO_CHILDREN!\n", rc); 303 378 } 304 379 … … 485 560 * it's time to start collect child status codes. 486 561 */ 487 void __libc_back_processWaitNotifyExec(void) 488 { 489 if (gtidThread) 490 return; 491 562 void __libc_back_processWaitNotifyExec(pid_t pid) 563 { 564 PWAITCHILD pChild = _hmalloc(sizeof(*pChild)); 492 565 waitSemRequest(0); 566 567 /* 568 * Tell wait thread that there is a child waiting. 569 */ 570 if (pChild) 571 { 572 pChild->pid = pid; 573 pChild->pNext = gpChildrenHead; 574 gpChildrenHead = pChild; 575 } 576 __atomic_increment(&gcChildren); 577 __atomic_increment(&gcBirths); 578 int rc = DosPostEventSem(ghevBirth); 579 LIBC_ASSERTM(!rc, "DosPostEventSem(%#lx (birth)) -> %d\n", ghevBirth, rc); 580 rc = rc; 581 582 /* 583 * No wait thread? Create one. 584 */ 493 585 if (!gtidThread) 494 586 { … … 500 592 { 501 593 gtidThread = tid; 502 LIBCLOG_MSG2("Create waitThread! tid=%#x (%d)\n", tid, tid);594 LIBCLOG_MSG2("Created waitThread! tid=%#x (%d)\n", tid, tid); 503 595 } 504 596 else … … 509 601 } 510 602 } 603 511 604 waitSemRelease(); 512 605 } … … 530 623 __atomic_xchg(&gfNoWaitStatus, fNoWaitStatus); 531 624 } 625 532 626 533 627 /** … … 571 665 /* insert it */ 572 666 waitInsertFIFO(pWait); 667 DosPostEventSem(ghevWait); 573 668 } 574 669 else … … 619 714 620 715 /* 621 * Make sure there is a worker around.622 */623 if (!gtidThread)624 __libc_back_processWaitNotifyExec();625 626 /*627 716 * Validate options. 628 717 */ … … 676 765 LIBCLOG_RETURN_MSG(rc, "%d mutex\n", rc); 677 766 unsigned cIterations = 0; 767 int fInterrupted = 0; 678 768 for (;; cIterations++) 679 769 { … … 682 772 */ 683 773 WAITINFO Wait; 774 pid_t pid = (pid_t)Id; 775 if (!pid && enmIdType == P_PGID) 776 pid = (pid_t)__libc_spmGetId(__LIBC_SPMID_PGRP); 684 777 PWAITINFO pInfo = gpWaitHead; 685 778 while (pInfo) … … 712 805 if (fFlag && (fFlag & fOptions)) 713 806 { 714 if (enmIdType == P_ALL) 715 break; 716 if ( (enmIdType == P_PID && pInfo->pid == (pid_t)Id) 717 || (enmIdType == P_PGID && pInfo->pgrp == (pid_t)Id)) 807 if ( enmIdType == P_ALL 808 || (enmIdType == P_PID && pInfo->pid == pid) 809 || (enmIdType == P_PGID && pInfo->pgrp == pid)) 718 810 break; 719 811 } … … 755 847 waitInfoToSigInfo(&Wait, pSigInfo); 756 848 /* return */ 849 rc = 0; 757 850 break; 758 851 } … … 760 853 /* 761 854 * Verify the wait id (again). 762 */ 855 * 856 * Because of the design we cannot use DosWaitChild to check if 857 * the process actually have any children. Which means we'll 858 * have to use some child counting and thread states to check this. 859 */ 860 if (enmIdType == P_ALL) 861 { 862 /* 863 * It's enough to know that there are children around. 864 */ 865 if (!gcChildren && !gpChildrenHead) 866 { 867 /** @todo Later we'll add support for waiting on processes spawned by direct calls to DosExecPgm. 868 * Should call DosWaitChild to be 99% sure. */ 869 waitSemRelease(); 870 rc = -ECHILD; 871 break; 872 } 873 } 874 else if (enmIdType == P_PID) 875 { 876 /* 877 * In this case we'll have to make sure this PID exists 878 * AND that it's a child of ours. 879 */ 880 PWAITCHILD pChild = gpChildrenHead; 881 for (;pChild; pChild = pChild->pNext) 882 if (pChild->pid == (pid_t)Id) 883 break; 884 if (!pChild) 885 { 886 /** @todo Later we'll add support for waiting on processes spawned by direct calls to DosExecPgm. 887 * Should call DosVerifyPidTid and DosGetPPid(). */ 888 waitSemRelease(); 889 rc = -ECHILD; /* this ain't correct! */ 890 break; 891 } 892 } 893 else 894 { 895 rc = __libc_spmValidPGrp((pid_t)Id, 1 /* only children */); 896 if (rc) 897 { 898 waitSemRelease(); 899 rc = -ECHILD; 900 break; 901 } 902 } 763 903 waitSemRelease(); 764 if ( enmIdType == P_ALL 765 || enmIdType == P_PID) 766 { 767 /* 768 * All, or one specific, child process. 769 */ 770 rc = waitChild(&Wait, 1 /* no wait */, enmIdType == P_PID ? (pid_t)Id : 0); 771 if (!rc) 772 { 773 /* 774 * Need we bother inserting it? 775 * Anyway we'll have to wake the other waiters so they can recheck 776 * their stuff, like we're gonna do now. 777 */ 778 rc = waitSemRequest(1); 779 if (!rc && !gfNoWaitStatus) 780 rc = waitAllocInsert(&Wait); 781 DosPostEventSem(ghevWait); 782 if (rc) 783 break; 784 continue; 785 } 786 } 787 else 788 { 789 rc = __libc_Back_signalSendPGrp((pid_t)Id, 0); 790 if (rc) 791 LIBCLOG_RETURN_INT(rc); 792 } 793 794 /* 795 * Interpret OS/2 error codes. 796 */ 797 if (rc == ERROR_NO_CHILDREN) 798 LIBCLOG_RETURN_INT(-ECHILD); 799 if (rc == ERROR_INVALID_PROCID) 800 LIBCLOG_RETURN_INT(-ESRCH); /* waitid() -> EINVAL, wait[pid|3|4]() -> ECHILD */ 801 if (rc == ERROR_NO_CHILD_PROCESS) 802 LIBCLOG_RETURN_INT(-EPERM); /* waitid() -> EINVAL, wait[pid|3|4]() -> ECHILD */ 803 if (rc != ERROR_CHILD_NOT_COMPLETE) 804 LIBCLOG_RETURN_MSG(-EINVAL, "%d (-EINVAL) OS/2 rc=%d\n", -EINVAL, rc); 805 if ((fOptions & WNOHANG)) 806 LIBCLOG_RETURN_INT(-ECHILD); 904 905 /* 906 * Delayed interrupted condition. 907 */ 908 if (fInterrupted) 909 { 910 rc = -EINTR; 911 break; 912 } 807 913 808 914 /* … … 812 918 * if it is we'll not gonna hang along here anylonger. Only 2nd and 813 919 * subsequent iterations => 30 second timeout before deadlock is fixed. 814 */920 */ 815 921 if ( cIterations >= 1 816 922 && (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/*ExitList */)) … … 819 925 rc = DosWaitEventSem(ghevWait, 30*1000); 820 926 if (rc == ERROR_INTERRUPT) 821 LIBCLOG_RETURN_INT(-EINTR);822 if (!rc && rc != ERROR_TIMEOUT && rc != ERROR_SEM_TIMEOUT)927 fInterrupted = 1; 928 else if (rc && rc != ERROR_TIMEOUT && rc != ERROR_SEM_TIMEOUT) 823 929 LIBCLOG_RETURN_MSG(-EDEADLK, "%d (-DEADLK) waitsem -> rc=%d\n", -EDEADLK, rc); 824 930 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalStack.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1630 r1631 76 76 { 77 77 LIBC_ASSERTM_FAILED("ss_size=%d is too small. minimum size is %d\n", pStack->ss_size, MINSIGSTKSZ); 78 LIBCLOG_RETURN_INT(-E INVAL);78 LIBCLOG_RETURN_INT(-ENOMEM); 79 79 } 80 80 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1630 r1631 32 32 __BEGIN_DECLS 33 33 34 /** Wait Event Semaphore. 35 * This is an event semaphore which will never be posted (unless we wanna resolve 36 * some nasty deadlock in the future) but is used to wait for a signal to arrive. 37 * When a signal arrives the wait will be interrupted to allow for execution of 38 * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT. 39 */ 40 extern unsigned long __libc_back_ghevWait; 41 34 42 /** 35 43 * Converts native error code to errno error code. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/libcfork.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1630 r1631 51 51 #include "syscalls.h" 52 52 #include "DosEx.h" 53 #include "b_process.h" 53 54 54 55 … … 403 404 forkParCompletionChild(pForkHandle, rc); 404 405 } 406 407 /* 408 * Try reap the child in case of failure. 409 */ 410 if (rc < 0) 411 { 412 FS_VAR(); 413 FS_SAVE_LOAD(); 414 RESULTCODES resc; 415 PID pibReaped; 416 DosWaitChild(DCWA_PROCESS,DCWW_NOWAIT, &resc, &pibReaped, pid); 417 FS_RESTORE(); 418 } 405 419 } 406 420 } … … 417 431 * Return. 418 432 */ 433 if (rc >= 0) 434 __libc_back_processWaitNotifyExec(pid); 435 419 436 _fmutex_release(&__libc_gmtxExec); 420 437 if (rc >= 0) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/sharedpm.c
-
Property cvs2svn:cvs-rev
changed from
1.20
to1.21
r1630 r1631 73 73 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SPM 74 74 #include <InnoTekLIBC/logstrict.h> 75 #include "b_process.h" 75 76 #include "syscalls.h" 76 77 … … 268 269 */ 269 270 spmReleaseMutex(&RegRec); 270 *pNotify = NotifyTmp; 271 } 272 271 *pNotifyOut = NotifyTmp; 272 } 273 274 LIBCLOG_RETURN_INT(rc); 275 } 276 277 /** 278 * Validates a process group id. 279 * 280 * @returns 0 if valid. 281 * @returns -ESRCH if not valid. 282 * @param pgrp Process group id to validate. 0 if the same as 283 * the same as the current process. 284 * @param fOnlyChildren Restrict the search to immediate children. 285 */ 286 int __libc_spmValidPGrp(pid_t pgrp, int fOnlyChildren) 287 { 288 LIBCLOG_ENTER("pgrp=%#x (%d) fOnlyChildren=%d\n", pgrp, pgrp, fOnlyChildren); 289 290 /* 291 * Set return code and reason. 292 */ 293 __LIBC_SPMXCPTREGREC RegRec; 294 int rc = spmRequestMutex(&RegRec); 295 if (!rc) 296 { 297 /* 298 * Iterate all living processes looking for matching pgrps. 299 * Quit when we've found a match. 300 */ 301 rc = -ESRCH; 302 pid_t pid = fOnlyChildren ? gpSPMSelf->pid : 0; 303 if (!pgrp) 304 pgrp = gpSPMSelf->pgrp; 305 __LIBC_PSPMPROCESS pProcess = gpSPMHdr->apHeads[__LIBC_PROCSTATE_ALIVE]; 306 for (; pProcess; pProcess = pProcess->pNext) 307 if ( pProcess->pgrp == pgrp 308 && (!pid || pProcess->pidParent == pid)) 309 { 310 rc = 0; 311 break; 312 } 313 314 spmReleaseMutex(&RegRec); 315 } 273 316 LIBCLOG_RETURN_INT(rc); 274 317 } … … 2009 2052 { 2010 2053 /* 2054 * Notify the wait facilities. 2055 */ 2056 __libc_back_processWaitNotifyTerm(); 2057 2058 /* 2011 2059 * Check if the memory is accessible, if it ain't we'll crash or do other 2012 2060 * nasty things is the code below. … … 2265 2313 */ 2266 2314 for (pProcess = gpSPMHdr->apHeads[enmState]; pProcess ; pProcess = pProcess->pNext) 2267 if (pProcess->pid == pid && pProcess->enmState == enmState)2315 if (pProcess->pid == pid) 2268 2316 LIBCLOG_RETURN_P(pProcess); 2269 2317 … … 2428 2476 pProcess->uVersion = SPM_VERSION; 2429 2477 pProcess->cReferences = 1; 2430 pProcess->enmState = __LIBC_PROCSTATE_ EMBRYO;2478 pProcess->enmState = __LIBC_PROCSTATE_ALIVE; 2431 2479 pProcess->pid = pid; 2432 2480 pProcess->pidParent = pidParent; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/signals.c
-
Property cvs2svn:cvs-rev
changed from
1.11
to1.12
r1630 r1631 85 85 #include <InnoTekLIBC/logstrict.h> 86 86 #include "syscalls.h" 87 #include "backend.h" 87 88 #include "b_signal.h" 88 89 #include "b_process.h" … … 220 221 static HMTX ghmtxSignals; 221 222 222 /** SignalWait Event Semaphore.223 /** Wait Event Semaphore. 223 224 * This is an event semaphore which will never be posted (unless we wanna resolve 224 225 * some nasty deadlock in the future) but is used to wait for a signal to arrive. … … 226 227 * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT. 227 228 */ 228 static HEVghevWait;229 HEV __libc_back_ghevWait; 229 230 230 231 static const char gaszSignalNames[__SIGSET_MAXSIGNALS][12] = … … 587 588 * Create the wait semaphore. 588 589 */ 589 rc = DosCreateEventSemEx(NULL, & ghevWait, 0, 0);590 rc = DosCreateEventSemEx(NULL, &__libc_back_ghevWait, 0, 0); 590 591 if (!rc) 591 592 { … … 1316 1317 { 1317 1318 /* 1318 * Let's see if we can ignore it or successfully schedule it to a thread. 1319 * Let's see if we can ignore it or successfully schedule it to a thread, 1320 * or if it's SIGCHLD which might be required to get wait*() working right. 1319 1321 */ 1320 1322 __LIBC_PTHREAD pThrdSig = NULL; … … 1322 1324 || ( gaSignalActions[iSignalNo].__sigaction_u.__sa_handler == SIG_DFL 1323 1325 && (gafSignalProperties[iSignalNo] & SPA_MASK) == SPA_IGNORE) 1326 || iSignalNo == SIGCHLD 1324 1327 || (pThrdSig = signalScheduleThread(iSignalNo, pThrd))) 1325 1328 { … … 1967 1970 LIBCLOG_MSG("Calling DosExit(,127)\n"); 1968 1971 for (;;) 1972 { 1973 DosKillProcess(DKP_PROCESS, 0); 1969 1974 DosExit(EXIT_THREAD, 127); 1975 } 1970 1976 } 1971 1977 … … 2059 2065 LIBCLOG_MSG("Calling DosExit(,127)\n"); 2060 2066 for (;;) 2067 { 2068 DosKillProcess(DKP_PROCESS, 0); 2061 2069 DosExit(EXIT_THREAD, 127); 2070 } 2062 2071 } 2063 2072 … … 2126 2135 */ 2127 2136 __libc_back_signalSemRelease(); 2128 DosWaitEventSem( ghevWait, SEM_INDEFINITE_WAIT);2137 DosWaitEventSem(__libc_back_ghevWait, SEM_INDEFINITE_WAIT); 2129 2138 return __libc_back_signalSemRequest(); 2130 2139 } … … 2179 2188 SigInfo = *pSigInfo; 2180 2189 SigInfo.si_signo = iSignalNo; 2181 if ( pSigInfo)2190 if (!pSigInfo) 2182 2191 SigInfo.si_code = SI_USER; 2183 2192 if (SigInfo.si_pid) … … 2982 2991 for (;;) 2983 2992 { 2984 int rc = DosWaitEventSem( ghevWait, cMillies);2993 int rc = DosWaitEventSem(__libc_back_ghevWait, cMillies); 2985 2994 2986 2995 /* -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.