Changeset 1618
- Timestamp:
- Nov 7, 2004, 3:19:42 PM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 2 added
- 39 edited
-
include/InnoTekLIBC/backend.h (modified) (4 diffs, 1 prop)
-
include/InnoTekLIBC/libc.h (modified) (2 diffs, 1 prop)
-
include/InnoTekLIBC/thread.h (modified) (6 diffs, 1 prop)
-
src/lib/libc.def (modified) (1 diff, 1 prop)
-
src/lib/process/_signal_os2.c (modified) (4 diffs, 1 prop)
-
src/lib/process/_signal_sysv.c (modified) (3 diffs, 1 prop)
-
src/lib/process/bsd_signal.c (modified) (3 diffs, 1 prop)
-
src/lib/process/killpg.c (modified) (1 diff, 1 prop)
-
src/lib/process/pause.c (modified) (1 diff, 1 prop)
-
src/lib/process/raise.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigblock.c (modified) (1 diff, 1 prop)
-
src/lib/process/sighold.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigignore.c (modified) (1 diff, 1 prop)
-
src/lib/process/siginterrupt.c (modified) (2 diffs, 1 prop)
-
src/lib/process/siginterrupt_data.c (modified) (1 diff, 1 prop)
-
src/lib/process/signal.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigpause.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigpause_bsd.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigpending.c (modified) (2 diffs, 1 prop)
-
src/lib/process/sigprocmask.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigrelse.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigsetmask.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigsuspend.c (modified) (2 diffs, 1 prop)
-
src/lib/process/sigtimedwait.c (modified) (3 diffs, 1 prop)
-
src/lib/process/sigvec.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigwait.c (modified) (1 diff, 1 prop)
-
src/lib/process/sigwaitinfo.c (modified) (1 diff, 1 prop)
-
src/lib/process/thread_internals.c (modified) (2 diffs, 1 prop)
-
src/lib/sys/__init.c (modified) (1 diff, 1 prop)
-
src/lib/sys/__initdll.c (modified) (1 diff, 1 prop)
-
src/lib/sys/b_signalInterrupt.c (added)
-
src/lib/sys/b_signalMask.c (modified) (1 diff, 1 prop)
-
src/lib/sys/b_signalPending.c (added)
-
src/lib/sys/b_signalStack.c (modified) (2 diffs, 1 prop)
-
src/lib/sys/b_signalSuspend.c (modified) (2 diffs, 1 prop)
-
src/lib/sys/b_signalWait.c (modified) (1 diff, 1 prop)
-
src/lib/sys/b_threadInit.c (modified) (2 diffs, 1 prop)
-
src/lib/sys/exceptions.c (modified) (1 diff, 1 prop)
-
src/lib/sys/sharedpm.c (modified) (1 diff, 1 prop)
-
src/lib/sys/signals.c (modified) (13 diffs, 1 prop)
-
src/lib/sys/signals.h (modified) (2 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/InnoTekLIBC/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.9to1.10
r1617 r1618 560 560 * 561 561 * @returns 0 on success. 562 * @returns -Negative errnoon failure.562 * @returns on failure. 563 563 * @param iSignalNo Signal number. 564 564 * @param pSigAct Pointer to new signal action. … … 570 570 571 571 /** 572 573 574 575 576 577 578 579 580 581 582 583 584 572 585 * Changes and/or queries the alternative signal stack settings of a thread. 573 586 * … … 584 597 * 585 598 * @returns 0 on success. 586 * @returns -1 and errno set to EINVALon failure.599 * @returns on failure. 587 600 * @param pThrd Thread to apply this to. 588 601 * @param iHow Describes the action taken if pSigSetNew not NULL. Recognized … … 604 617 int __libc_Back_signalMask(__LIBC_PTHREAD pThrd, int iHow, const sigset_t * __restrict pSigSetNew, sigset_t * __restrict pSigSetOld); 605 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 606 654 /** @} */ 607 655 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/libc.h
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 29 29 30 30 #include <sys/cdefs.h> 31 31 32 32 33 __BEGIN_DECLS … … 41 42 extern int __libc_gfNoUnix; 42 43 44 45 46 47 48 49 50 43 51 __END_DECLS 44 52 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/thread.h
-
Property cvs2svn:cvs-rev
changed from
1.8to1.9
r1617 r1618 50 50 *******************************************************************************/ 51 51 struct _uheap; 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 52 76 53 77 /** … … 150 174 151 175 /** Thread status, chiefly used for the u member of the thread structure. */ 152 enum enmLIBCThreadStatus176 enum enmLIBCThreadStatus 153 177 { 154 178 /** The thread status must be queried from the OS. */ … … 158 182 /** The thread is in a sigwait(), sigwaitinfo(), or sigtimedwait() call. */ 159 183 enmLIBCThreadStatus_sigwait, 184 185 160 186 } enmStatus; 161 187 … … 166 192 { 167 193 /** enmLIBCThreadStatus_startup: Begin Thread Arguments. */ 168 struct __libc_thread_ startup194 struct __libc_thread_startup 169 195 { 170 196 /** Thread argument. */ … … 175 201 176 202 /** enmLIBCThreadStatus_sigwait: Thread blocked in sigwait(), sigwaitinfo() or sigtimedwait(). */ 177 struct __libc_thread_sigwait 178 { 179 /** The signals we're waiting for. */ 180 sigset_t SigSetWait; 181 /** The where to return signal info. */ 182 siginfo_t *pSigInfo; 183 } SigWait; 203 __LIBC_PTHREAD_SIGWAIT pSigWait; 204 /** enmLIBCThreadStatus_sigsuspend: Thread blocked in sigsuspend(). */ 205 __LIBC_PTHREAD_SIGSUSPEND pSigSuspend; 184 206 } u; 185 207 … … 211 233 } __LIBC_THREAD; 212 234 235 213 236 #ifndef __LIBC_THREAD_DECLARED 214 237 #define __LIBC_THREAD_DECLARED -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.75to1.76
r1617 r1618 1239 1239 "___libc_Back_signalStack" @1261 1240 1240 "___libc_Back_signalMask" @1262 1241 1242 1243 1244 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/_signal_os2.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include <signal.h> 32 32 #include <errno.h> 33 #include <InnoTekLIBC/signals.h> 33 #include <InnoTekLIBC/libc.h> 34 #include <InnoTekLIBC/backend.h> 34 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 35 36 #include <InnoTekLIBC/logstrict.h> … … 54 55 { 55 56 LIBC_ASSERTM_FAILED("invalid signal number for SIG_ACK %d\n", iSignalNo); 57 58 59 60 61 62 56 63 LIBCLOG_RETURN_P(SIG_ERR); 57 64 } … … 96 103 97 104 /* 98 * Gain exclusive access to the signal stuff.99 */100 if (__libc_back_signalSemRequest())101 LIBCLOG_RETURN_P(SIG_ERR);102 103 /*104 105 * Do work. 105 106 */ 106 107 if (__SIGSET_ISSET(&__libc_gSignalRestartMask, iSignalNo)) 107 108 SigAct.sa_flags |= SA_RESTART; 108 rc = __libc_back_signalAction(iSignalNo, &SigAct, &SigActOld); 109 110 /* 111 * Release semaphore. 112 */ 113 __libc_back_signalSemRelease(); 109 rc = __libc_Back_signalAction(iSignalNo, &SigAct, &SigActOld); 114 110 115 111 /* … … 118 114 if (!rc) 119 115 LIBCLOG_RETURN_P(SigActOld.__sigaction_u.__sa_handler); 116 120 117 } 121 118 LIBCLOG_RETURN_P(SIG_ERR); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/_signal_sysv.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include <signal.h> 32 32 #include <errno.h> 33 #include <InnoTekLIBC/signals.h> 33 #include <InnoTekLIBC/libc.h> 34 #include <InnoTekLIBC/backend.h> 34 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 35 36 #include <InnoTekLIBC/logstrict.h> … … 59 60 LIBCLOG_RETURN_P(SIG_ERR); 60 61 } 62 63 64 65 66 67 61 68 if (!__SIGSET_SIG_VALID(iSignalNo)) 62 69 { … … 74 81 75 82 /* 76 * Gain exclusive access to the signal stuff.77 */78 if (__libc_back_signalSemRequest())79 LIBCLOG_RETURN_P(SIG_ERR);80 81 /*82 83 * Change signal action. 83 84 */ 84 85 if (__SIGSET_ISSET(&__libc_gSignalRestartMask, iSignalNo)) 85 86 SigAct.sa_flags |= SA_RESTART; 86 rc = __libc_back_signalAction(iSignalNo, &SigAct, &SigActOld); 87 88 /* 89 * Release semaphore. 90 */ 91 __libc_back_signalSemRelease(); 92 93 /* 94 * Check for errors and return. 95 */ 96 if (rc) 97 LIBCLOG_RETURN_P(SIG_ERR); 98 LIBCLOG_RETURN_P(SigActOld.__sigaction_u.__sa_handler); 87 rc = __libc_Back_signalAction(iSignalNo, &SigAct, &SigActOld); 88 if (!rc) 89 LIBCLOG_RETURN_P(SigActOld.__sigaction_u.__sa_handler); 90 errno = -rc; 91 LIBCLOG_RETURN_P(SIG_ERR); 99 92 } 100 93 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/bsd_signal.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include <signal.h> 32 32 #include <errno.h> 33 #include <InnoTekLIBC/signals.h> 33 #include <InnoTekLIBC/libc.h> 34 #include <InnoTekLIBC/backend.h> 34 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 35 36 #include <InnoTekLIBC/logstrict.h> … … 59 60 LIBCLOG_RETURN_P(SIG_ERR); 60 61 } 62 63 64 65 66 67 61 68 if (!__SIGSET_SIG_VALID(iSignalNo)) 62 69 { … … 75 82 76 83 /* 77 * Gain exclusive access to the signal stuff.78 */79 if (__libc_back_signalSemRequest())80 LIBCLOG_RETURN_P(SIG_ERR);81 82 /*83 84 * Change signal action. 84 85 */ 85 86 if (__SIGSET_ISSET(&__libc_gSignalRestartMask, iSignalNo)) 86 87 SigAct.sa_flags |= SA_RESTART; 87 rc = __libc_back_signalAction(iSignalNo, &SigAct, &SigActOld); 88 89 /* 90 * Release semaphore. 91 */ 92 __libc_back_signalSemRelease(); 93 94 /* 95 * Check for errors and return. 96 */ 97 if (rc) 98 LIBCLOG_RETURN_P(SIG_ERR); 99 LIBCLOG_RETURN_P(SigActOld.__sigaction_u.__sa_handler); 88 rc = __libc_Back_signalAction(iSignalNo, &SigAct, &SigActOld); 89 if (!rc) 90 LIBCLOG_RETURN_P(SigActOld.__sigaction_u.__sa_handler); 91 errno = -rc; 92 LIBCLOG_RETURN_P(SIG_ERR); 100 93 } 101 94 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/killpg.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include <signal.h> 32 32 #include <errno.h> 33 #include <InnoTekLIBC/ signals.h>33 #include <InnoTekLIBC/.h> 34 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 35 35 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/pause.c
-
Property cvs2svn:cvs-rev
changed from
1.3to1.4
r1617 r1618 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 32 33 #include <signal.h> 33 34 #include <errno.h> 34 #include <InnoTekLIBC/signals.h>35 #include <InnoTekLIBC/thread.h>36 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 36 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/raise.c
-
Property cvs2svn:cvs-rev
changed from
1.4to1.5
r1617 r1618 32 32 #include <signal.h> 33 33 #include <process.h> 34 #include <InnoTekLIBC/signals.h>35 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 36 35 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigblock.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h> 35 #include <InnoTekLIBC/thread.h> 33 #include <InnoTekLIBC/backend.h> 36 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 35 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sighold.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 32 32 #include <signal.h> 33 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h>35 34 #include <InnoTekLIBC/thread.h> 35 36 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 37 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigignore.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 32 32 #include <signal.h> 33 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h>35 34 #include <InnoTekLIBC/thread.h> 35 36 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 37 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/siginterrupt.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 33 33 #include <signal.h> 34 34 #include <errno.h> 35 #include <InnoTekLIBC/signals.h> 36 #include <InnoTekLIBC/thread.h> 35 #include <InnoTekLIBC/backend.h> 37 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 38 37 #include <InnoTekLIBC/logstrict.h> … … 52 51 { 53 52 LIBCLOG_ENTER("iSignalNo=%d fFlag=%d\n", iSignalNo, fFlag); 54 struct sigaction SigAct = {{0}};55 int rc;56 int rc2 = 0;57 53 58 54 /* 59 * Validate.55 * . 60 56 */ 61 if (!__SIGSET_SIG_VALID(iSignalNo)) 62 { 63 LIBC_ASSERTM_FAILED("Invalid signal no %d\n", iSignalNo); 64 errno = EINVAL; 65 LIBCLOG_RETURN_INT(-1); 66 } 67 68 /* 69 * Gain exclusive access to the signal stuff. 70 */ 71 if (__libc_back_signalSemRequest()) 72 LIBCLOG_RETURN_INT(-1); 73 74 /* 75 * Get the previous signal action. 76 */ 77 rc = __libc_back_signalAction(iSignalNo, NULL, &SigAct); 57 int rc = __libc_Back_signalInterrupt(iSignalNo, fFlag); 78 58 if (!rc) 79 { 80 if (fFlag) 81 { /* interrupt */ 82 SigAct.sa_flags &= ~SA_RESTART; 83 __SIGSET_CLEAR(&__libc_gSignalRestartMask, iSignalNo); 84 } 85 else 86 { /* restart */ 87 SigAct.sa_flags |= SA_RESTART; 88 __SIGSET_SET(&__libc_gSignalRestartMask, iSignalNo); 89 } 90 rc2 = __libc_back_signalAction(iSignalNo, &SigAct, NULL); 91 } 92 93 /* 94 * Release semaphore. 95 */ 96 __libc_back_signalSemRelease(); 97 98 99 /* 100 * Check for failure and return. 101 */ 102 LIBC_ASSERTM(!rc2, "Impossible!\n"); 103 if (rc || rc2) 104 LIBCLOG_RETURN_INT(-1); 105 106 LIBCLOG_RETURN_INT(0); 59 LIBCLOG_RETURN_INT(0); 60 errno = -rc; 61 LIBCLOG_RETURN_INT(-1); 107 62 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/siginterrupt_data.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 29 29 *******************************************************************************/ 30 30 #include "libc-alias.h" 31 #include <InnoTekLIBC/ signals.h>31 #include <InnoTekLIBC/.h> 32 32 33 33 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/signal.c
-
Property cvs2svn:cvs-rev
changed from
1.3to1.4
r1617 r1618 30 30 #include "libc-alias.h" 31 31 #include <signal.h> 32 #include <InnoTekLIBC/ signals.h>32 #include <InnoTekLIBC/.h> 33 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 34 34 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigpause.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 34 34 #include <signal.h> 35 35 #include <errno.h> 36 #include <InnoTekLIBC/signals.h> 37 #include <InnoTekLIBC/thread.h> 36 #include <InnoTekLIBC/backend.h> 38 37 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 39 38 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigpause_bsd.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 32 32 #include <signal.h> 33 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h> 35 #include <InnoTekLIBC/thread.h> 34 #include <InnoTekLIBC/backend.h> 36 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 36 #include <InnoTekLIBC/logstrict.h> 37 38 39 38 40 39 41 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigpending.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include < InnoTekLIBC/signals.h>34 #include <InnoTekLIBC/ thread.h>33 #include <.h> 34 #include <InnoTekLIBC/d.h> 35 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 36 36 #include <InnoTekLIBC/logstrict.h> … … 47 47 { 48 48 LIBCLOG_ENTER("pSigSet=%p\n", (void *)pSigSet); 49 __LIBC_THREAD *pThrd = __libc_threadCurrent();50 sigset_t SigSet;51 49 52 __SIGSET_EMPTY(&SigSet); /* touch it! (paranoia) */ 53 54 /* 55 * Gain exclusive access to the signal stuff. 56 */ 57 if (__libc_back_signalSemRequest()) 58 LIBCLOG_RETURN_INT(-1); 59 60 /* 61 * Or the blocked and pending members for this thread. 62 */ 63 __SIGSET_OR(&SigSet, &__libc_gSignalPending, &pThrd->SigSetPending); 64 __SIGSET_AND(&SigSet, &pThrd->SigSetBlocked, &SigSet); 65 66 /* 67 * Release semaphore. 68 */ 69 __libc_back_signalSemRelease(); 70 71 /* 72 * Copy the set. 73 */ 74 *pSigSet = SigSet; 75 76 LIBCLOG_RETURN_MSG(0, "ret 0 (*pSigSet={%08lx %08lx})\n", SigSet.__bitmap[1], SigSet.__bitmap[0]); 50 int rc = __libc_Back_signalPending(pSigSet); 51 if (!rc) 52 LIBCLOG_RETURN_MSG(0, "ret 0 (*pSigSet={%08lx %08lx})\n", pSigSet->__bitmap[1], pSigSet->__bitmap[0]); 53 errno = -rc; 54 LIBCLOG_RETURN_INT(-1); 77 55 } 78 56 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigprocmask.c
-
Property cvs2svn:cvs-rev
changed from
1.2to1.3
r1617 r1618 80 80 if (pSigSetOld) 81 81 *pSigSetOld = SigSetOld; 82 83 LIBCLOG_RETURN_MSG(0, "ret 0 old={%08lx%08lx} new={%08lx%08lx}\n", 84 SigSetOld.__bitmap[1], SigSetOld.__bitmap[0], 85 SigSetNew.__bitmap[1], SigSetNew.__bitmap[0]); 82 LIBCLOG_RETURN_MSG(0, "ret 0 old={%08lx%08lx}\n", SigSetOld.__bitmap[1], SigSetOld.__bitmap[0]); 86 83 } 87 84 errno = -rc; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigrelse.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 32 32 #include <signal.h> 33 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h> 35 #include <InnoTekLIBC/thread.h> 34 #include <InnoTekLIBC/backend.h> 36 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 36 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigsetmask.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h> 35 #include <InnoTekLIBC/thread.h> 33 #include <InnoTekLIBC/backend.h> 36 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 35 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigsuspend.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 33 33 #include <signal.h> 34 34 #include <errno.h> 35 #include <InnoTekLIBC/signals.h>36 35 #include <InnoTekLIBC/thread.h> 36 37 37 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 38 38 #include <InnoTekLIBC/logstrict.h> … … 49 49 LIBCLOG_ENTER("pSigSet=%p {%08lx%08lx}\n", 50 50 (void *)pSigSet, pSigSet ? pSigSet->__bitmap[1] : 0, pSigSet ? pSigSet->__bitmap[0] : 0); 51 __LIBC_PTHREAD pThrd = __libc_threadCurrent();52 sigset_t SigSet;53 51 54 52 /* 55 * Make copy of the input (we can safely crash here).53 * . 56 54 */ 57 SigSet = *pSigSet; 58 59 /* 60 * Gain exclusive access to the signal stuff. 61 */ 62 if (__libc_back_signalSemRequest()) 55 int rc = __libc_Back_signalSuspend(pSigSet); 56 if (rc) 57 { 58 errno = -rc; 63 59 LIBCLOG_RETURN_INT(-1); 64 65 /* 66 * Change the signal mask. 67 */ 68 pThrd->SigSetBlockedOld = pThrd->SigSetBlocked; 69 pThrd->fSigSetBlockedOld = 1; 70 pThrd->SigSetBlocked = SigSet; 71 72 /* 73 * Go to sleep but check for pending signals first. 74 * 75 * We have to do this call from within the sem+mustcomplete section. 76 * The backend function will leave the section. 77 */ 78 __libc_back_signalSuspend(); 79 80 81 /* 82 * Return interrupt failure. 83 */ 84 errno = EINTR; 85 LIBCLOG_RETURN_INT(-1); 60 } 61 LIBCLOG_RETURN_INT(0); 86 62 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigtimedwait.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include <assert.h> 34 #include <InnoTekLIBC/signals.h> 33 #include <errno.h> 35 34 #include <InnoTekLIBC/thread.h> 35 36 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 37 #include <InnoTekLIBC/logstrict.h> … … 40 40 41 41 /** 42 * Wait for a signal to become pending. 42 * Wait for one or more signals and remove and return the first of them 43 * to occur. 43 44 * 44 * @returns 0 on success. 45 * Will return immediately if one of the signals is already pending. If more than 46 * one signal is pending the signal with highest priority will be returned. 47 * 48 * @returns Signal number on success. 45 49 * @returns -1 on failure, errno set. 46 50 * @param pSigSet Signals to wait for. 47 51 * @param pSigInfo Where to store the signal info for the signal 48 52 * that we accepted. 53 49 54 */ 50 55 int _STD(sigtimedwait)(const sigset_t *pSigSet, siginfo_t *pSigInfo, const struct timespec *pTimeout) … … 54 59 (void *)pSigInfo, 55 60 (void *)pTimeout, pTimeout ? pTimeout->tv_sec : ~0, pTimeout ? pTimeout->tv_nsec : ~0); 56 __LIBC_PTHREAD pThrd = __libc_threadCurrent();57 sigset_t SigSet;58 siginfo_t SigInfo = {0};59 struct timespec Timeout;60 int rc;61 61 62 62 /* 63 * Make copy of the input (we can safely crash here).63 * . 64 64 */ 65 SigSet = *pSigSet; 66 if (pTimeout) 67 Timeout = *pTimeout; 65 siginfo_t SigInfo; 66 int rc = __libc_Back_signalWait(pSigSet, &SigInfo, pTimeout); 67 if (!rc) 68 { 69 if (pSigInfo) 70 *pSigInfo = SigInfo; 71 LIBCLOG_RETURN_MSG(rc, "ret %d (*pSigInfo={si_signo=%d, si_errno=%d, si_code=%#x, si_timestamp=%#x, si_flags=%#x, si_pid=%d, si_tid=%d, si_uid=%d, si_status=%d, si_addr=%p, si_value=%#08x, si_band=%ld})\n", 72 rc, SigInfo.si_signo, SigInfo.si_errno, SigInfo.si_code, SigInfo.si_timestamp, 73 SigInfo.si_flags, SigInfo.si_pid, SigInfo.si_tid, SigInfo.si_uid, SigInfo.si_status, 74 SigInfo.si_addr, SigInfo.si_value.sigval_int, SigInfo.si_band); 75 } 68 76 69 /* 70 * Gain exclusive access to the signal stuff. 71 */ 72 if (__libc_back_signalSemRequest()) 73 LIBCLOG_RETURN_INT(-1); 74 75 /* 76 * Mark thread as blocked in begin in sigtimedwait(). 77 */ 78 if (pThrd->enmStatus != enmLIBCThreadStatus_unknown) 79 { 80 LIBC_ASSERTM_FAILED("Must push thread state!\n"); 81 __libc_back_signalSemRelease(); 82 assert(0); 83 LIBCLOG_RETURN_INT(-1); 84 } 85 pThrd->enmStatus = enmLIBCThreadStatus_sigwait; 86 pThrd->u.SigWait.SigSetWait = SigSet; 87 pThrd->u.SigWait.pSigInfo = &SigInfo; 88 89 /* 90 * Go to sleep. 91 * 92 * We have to do this call from within the sem+mustcomplete section. 93 * The backend function will leave the section. 94 */ 95 rc = __libc_back_signalWait(pTimeout ? &Timeout : NULL); 96 97 /* 98 * Store result. 99 */ 100 if (pSigInfo) 101 *pSigInfo = SigInfo; 102 103 LIBCLOG_RETURN_MSG(rc, "ret %d (*pSigInfo={si_signo=%d, si_errno=%d, si_code=%#x, si_pid=%d, si_uid=%d, si_status=%d, si_addr=%p, si_value=%#08x, si_band=%ld})\n", 104 rc, SigInfo.si_signo, SigInfo.si_errno, SigInfo.si_code, SigInfo.si_pid, SigInfo.si_uid, 105 SigInfo.si_status, SigInfo.si_addr, SigInfo.si_value.sigval_int, SigInfo.si_band); 77 errno = -rc; 78 LIBCLOG_RETURN_INT(-1); 106 79 } 107 80 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigvec.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 32 32 #include <signal.h> 33 33 #include <errno.h> 34 #include <InnoTekLIBC/signals.h>35 34 #include <InnoTekLIBC/thread.h> 35 36 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 37 37 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigwait.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include <InnoTekLIBC/signals.h>34 33 #include <InnoTekLIBC/thread.h> 34 35 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 36 36 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigwaitinfo.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 31 31 #include "libc-alias.h" 32 32 #include <signal.h> 33 #include <InnoTekLIBC/signals.h>34 33 #include <InnoTekLIBC/thread.h> 34 35 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 36 36 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/thread_internals.c
-
Property cvs2svn:cvs-rev
changed from
1.8to1.9
r1617 r1618 41 41 #include <InnoTekLIBC/thread.h> 42 42 #include <InnoTekLIBC/backend.h> 43 #include <InnoTekLIBC/signals.h>44 43 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD 45 44 #include <InnoTekLIBC/logstrict.h> … … 88 87 pThrd->iRand = 1; 89 88 pThrd->cRefs = 1; 90 /* ASSUMES sigemptyset() is equivalent with memsetting a sigset_t. */91 if (pParentThrd)92 {93 /*94 * Gain exclusive access to the signal stuff.95 */96 int rc = __libc_back_signalSemRequest();97 98 /*99 * Copy signal stuff.100 */101 pThrd->SigSetBlocked = pParentThrd->SigSetBlocked;102 if (pParentThrd->fSigSetBlockedOld)103 {104 pThrd->SigSetBlockedOld = pParentThrd->SigSetBlockedOld;105 pThrd->fSigSetBlockedOld = pParentThrd->fSigSetBlockedOld;106 }107 108 /*109 * Release semaphore.110 */111 if (!rc)112 __libc_back_signalSemRelease();113 }114 else115 {116 /** @todo try find info from parent process. */117 }118 119 89 __libc_Back_threadInit(pThrd, pParentThrd); 120 90 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__init.c
-
Property cvs2svn:cvs-rev
changed from
1.17to1.18
r1617 r1618 29 29 #include <InnoTekLIBC/sharedpm.h> 30 30 #include <InnoTekLIBC/backend.h> 31 #include <InnoTekLIBC/signals.h>32 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 33 32 #include <InnoTekLIBC/logstrict.h> 33 34 34 35 35 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.17to1.18
r1617 r1618 35 35 #include "syscalls.h" 36 36 #include "fs.h" 37 37 38 #include <InnoTekLIBC/thread.h> 38 39 #include <InnoTekLIBC/libc.h> 39 #include <InnoTekLIBC/ signals.h>40 #include <InnoTekLIBC/.h> 40 41 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 41 42 #include <InnoTekLIBC/logstrict.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalMask.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 48 48 * 49 49 * @returns 0 on success. 50 * @returns -1 and errno set to EINVALon failure.50 * @returns on failure. 51 51 * @param pThrd Thread to apply this to. 52 52 * @param iHow Describes the action taken if pSigSetNew not NULL. Recognized -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalStack.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #define INCL_BASE33 #define INCL_FSMACROS34 #define INCL_DOSSIGNALS35 #include <os2emx.h>36 37 32 #include <signal.h> 38 33 #include <errno.h> … … 41 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL 42 37 #include <InnoTekLIBC/logstrict.h> 43 #include "s yscalls.h"38 #include "sls.h" 44 39 45 40 /** -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalSuspend.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #define INCL_BASE 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 31 #include "libc-alias.h" 35 32 #include <signal.h> 36 33 #include <errno.h> 37 #include <InnoTekLIBC/signals.h> 38 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 34 #include <InnoTekLIBC/thread.h> 35 #include <InnoTekLIBC/backend.h> 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL 39 37 #include <InnoTekLIBC/logstrict.h> 40 41 42 /******************************************************************************* 43 * Structures and Typedefs * 44 *******************************************************************************/ 45 /** Registration record for signalSuspendXcptHandler(). */ 46 typedef struct XCPTREGREC 47 { 48 EXCEPTIONREGISTRATIONRECORD Core; 49 /** This event semaphore is signaled when a signal has been 50 * processed by the current thread. */ 51 HEV hev; 52 } XCPTREGREC, *PXCPTREGREC; 53 54 55 /******************************************************************************* 56 * Internal Functions * 57 *******************************************************************************/ 58 static ULONG _System signalSuspendXcptHandler(PEXCEPTIONREPORTRECORD pXcptRec, PEXCEPTIONREGISTRATIONRECORD pRegRec, PCONTEXTRECORD pCtx, PVOID pvSomething); 59 60 61 /** 62 * Exception handler use while waitin for signals to be 63 * delivered to this thread or the process being terminated. 64 */ 65 static ULONG _System signalSuspendXcptHandler(PEXCEPTIONREPORTRECORD pXcptRec, PEXCEPTIONREGISTRATIONRECORD pRegRec, PCONTEXTRECORD pCtx, PVOID pvSomething) 66 { 67 /* a thread counter? */ 68 /** @todo implement me! */ 69 return XCPT_CONTINUE_SEARCH; 70 } 38 #include "signals.h" 71 39 72 40 … … 75 43 * The signal semaphore is owned. 76 44 */ 77 int __libc_ back_signalSuspend(void)45 int __libc_) 78 46 { 79 LIBCLOG_ENTER("\n"); 80 int rc; 81 XCPTREGREC XcptReg; 82 FS_VAR(); 47 LIBCLOG_ENTER("pSigSet=%p {%08lx%08lx}\n", 48 (void *)pSigSet, pSigSet ? pSigSet->__bitmap[1] : 0, pSigSet ? pSigSet->__bitmap[0] : 0); 49 __LIBC_PTHREAD pThrd = __libc_threadCurrent(); 50 sigset_t SigSet = *pSigSet; 51 __LIBC_THREAD_SIGSUSPEND SigSuspend = {0}; 83 52 84 53 /* 85 * Register54 * 86 55 */ 87 FS_SAVE_LOAD(); 88 XcptReg.Core.ExceptionHandler = signalSuspendXcptHandler; 89 XcptReg.Core.prev_structure = (void *)~0; 90 rc = DosCreateEventSem(NULL, &XcptReg.hev, 0, FALSE); 91 if (!rc) 92 { 93 rc = DosSetExceptionHandler(&XcptReg.Core); 94 if (!rc) 95 { 96 PPIB pPib; 97 PTIB pTib; 98 99 /* 100 * Time to release the semaphore. 101 */ 102 __libc_back_signalSemRelease(); 103 if (pTib->tib_ptib2->tib2_usMCCount) 104 { 105 LIBC_ASSERTM_FAILED("Deadlock avoided. tried to wait for signal with must complete count %d\n", pTib->tib_ptib2->tib2_usMCCount); 106 LIBCLOG_RETURN_INT(-EDEADLK); 107 } 56 int rc =__libc_back_signalSemRequest(); 57 if (rc) 58 LIBCLOG_RETURN_INT(rc); 108 59 109 /*110 * Wait loop.111 */112 DosGetInfoBlocks(&pTib, &pPib);113 for (;;)114 {115 rc = DosWaitEventSem(XcptReg.hev, 30*1000);116 if (!rc)117 break;60 /* 61 . 62 */ 63 ; 64 65 66 ; 67 68 ; 118 69 119 /* Avoid deadlocks during termination. */ 120 if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/* ExitList */)) 121 { 122 LIBCLOG_MSG("resuming execution, anyhow. the process is terminating. (status=%#lx\n", pPib->pib_flstatus); 123 break; 124 } 125 } 126 127 DosUnsetExceptionHandler(&XcptReg.Core); 128 } 129 DosCloseEventSem(XcptReg.hev); 130 } 131 132 FS_RESTORE(); 133 LIBCLOG_RETURN_INT(0); 70 /* 71 * Perform signal wait and return. 72 */ 73 rc = __libc_back_signalWait(pThrd, &SigSuspend.fDone, NULL); 74 if (rc != EAGAIN) 75 __libc_back_signalSemRelease(); 76 LIBCLOG_RETURN_INT(rc); 134 77 } 135 78 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalWait.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 37 37 #include <errno.h> 38 38 #include <386/builtin.h> 39 #include <InnoTekLIBC/signals.h>39 #include 40 40 #include <InnoTekLIBC/thread.h> 41 41 42 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 42 43 #include <InnoTekLIBC/logstrict.h> 43 44 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 45 66 46 int __libc_back_signalWait(const struct timespec *pTimeout) 47 { 48 LIBCLOG_ENTER("pTimeout=%p {tv_sec=%d tv_nsec=%ld}\n", 49 (void *)pTimeout, 50 pTimeout->tv_sec, 51 pTimeout->tv_nsec); 52 /** @todo Implement me */ 53 #if 0 54 sigset_t SigSetPending; 67 __LIBC_PTHREAD pThrd = __libc_threadCurrent(); 68 sigset_t SigSet; 69 __LIBC_THREAD_SIGWAIT SigWait = {0}; 70 struct timespec Timeout; 71 int rc; 55 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 56 97 if ( !__SIGSET_ISEMPTY(&pThrd->SigSetPending) 57 98 || !__SIGSET_ISEMPTY(&__libc_gSignalPending)) 58 99 { 100 59 101 __SIGSET_OR(&SigSetPending, &pThrd->SigSetPending, &__libc_gSignalPending); 60 __SIGSET_AND(&SigSetPending, & SigSetPending, &SigSet);102 __SIGSET_AND(&SigSetPending, &SigSetPending, &SigSet); 61 103 if (!__SIGSET_ISEMPTY(&SigSetPending)) 62 rc = __libc_back_signalAccept(); 104 { 105 rc = __libc_back_signalAccept(pThrd, 0, &SigSetPending, (siginfo_t *)&SigWait.SigInfo); 106 if (rc > 0) 107 { 108 if (pSigInfo) 109 *pSigInfo = SigWait.SigInfo; 110 __libc_back_signalSemRelease(); 111 LIBCLOG_RETURN_INT(rc); 112 } 113 LIBC_ASSERT_FAILED(); 114 } 63 115 } 64 #endif 65 LIBCLOG_RETURN_INT(-1); 116 117 /* 118 * Mark thread as blocked in sigtimedwait(). 119 */ 120 if (pThrd->enmStatus != enmLIBCThreadStatus_unknown) 121 { 122 LIBC_ASSERTM_FAILED("Must push thread state!\n"); 123 __libc_back_signalSemRelease(); 124 LIBCLOG_RETURN_INT(-EDEADLK); 125 } 126 SigWait.fDone = 0; 127 SigWait.SigSetWait = SigSet; 128 SigWait.SigInfo.si_signo= 0; 129 pThrd->u.pSigWait = &SigWait; 130 pThrd->enmStatus = enmLIBCThreadStatus_sigwait; 131 132 /* 133 * Wait till state changes back and then return according to the wait result. 134 * 135 * The result is a bit tricky. EAGAIN means time out and no semaphore. While 136 * EINTR means that we've been interrupted by the delivery of a signal, which 137 * might mean that we got what we waited for or that some other signal was 138 * delivered to this thread. Very simple. :-) 139 */ 140 rc = __libc_back_signalWait(pThrd, &SigWait.fDone, pTimeout ? &Timeout : NULL); 141 if (rc != -EAGAIN) 142 __libc_back_signalSemRelease(); 143 if (rc == -EINTR) 144 { 145 if (SigWait.fDone && SigWait.SigInfo.si_signo > 0) 146 { 147 rc = SigWait.SigInfo.si_signo; 148 if (pSigInfo) 149 *pSigInfo = SigWait.SigInfo; 150 } 151 } 152 153 LIBCLOG_RETURN_MSG(rc, "ret %d SigWait.SigInfo={si_signo=%d, si_errno=%d, si_code=%#x, si_timestamp=%#x, si_flags=%#x, si_pid=%d, si_tid=%d, si_uid=%d, si_status=%d, si_addr=%p, si_value=%#08x, si_band=%ld}\n", 154 rc, SigWait.SigInfo.si_signo, SigWait.SigInfo.si_errno, SigWait.SigInfo.si_code, SigWait.SigInfo.si_timestamp, 155 SigWait.SigInfo.si_flags, SigWait.SigInfo.si_pid, SigWait.SigInfo.si_tid, SigWait.SigInfo.si_uid, SigWait.SigInfo.si_status, 156 SigWait.SigInfo.si_addr, SigWait.SigInfo.si_value.sigval_int, SigWait.SigInfo.si_band); 66 157 } 67 158 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadInit.c
-
Property cvs2svn:cvs-rev
changed from
1.4to1.5
r1617 r1618 33 33 #include <emx/syscalls.h> 34 34 #include "syscalls.h" 35 35 36 #include <InnoTekLIBC/thread.h> 36 37 #include <InnoTekLIBC/backend.h> … … 41 42 pThrd->b.sys.fd.hdir = HDIR_CREATE; 42 43 pThrd->b.sys.fd.cFiles = 0; 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 43 66 } 44 67 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/exceptions.c
-
Property cvs2svn:cvs-rev
changed from
1.2to1.3
r1617 r1618 37 37 #include <errno.h> 38 38 #include <386/builtin.h> 39 #include <InnoTekLIBC/signals.h>40 39 #include <InnoTekLIBC/thread.h> 41 40 #include <InnoTekLIBC/backend.h> 42 41 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL 43 42 #include <InnoTekLIBC/logstrict.h> 43 44 44 45 45 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/sharedpm.c
-
Property cvs2svn:cvs-rev
changed from
1.14to1.15
r1617 r1618 892 892 { 893 893 __atomic_xchg(&gpSPMSelf->fExeInited, 1); 894 return 0;895 894 } 896 895 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/signals.c
-
Property cvs2svn:cvs-rev
changed from
1.4to1.5
r1617 r1618 1027 1027 */ 1028 1028 if ( pThrdSig->enmStatus == enmLIBCThreadStatus_sigwait 1029 && __SIGSET_ISSET(&pThrdSig->u. SigWait.SigSetWait, iSignalNo))1029 && __SIGSET_ISSET(&pThrdSig->u.SigSetWait, iSignalNo)) 1030 1030 { 1031 1031 /* 1032 1032 * Wake up a sigwait call. 1033 1033 */ 1034 /** @todo install extra exception handler while accessing this. */1035 1034 if (pSigInfo) 1036 *pThrdSig->u.SigWait.pSigInfo = *pSigInfo;1035 SigInfo = *pSigInfo; 1037 1036 else 1038 { 1039 bzero(pThrdSig->u.SigWait.pSigInfo, sizeof(*pThrdSig->u.SigWait.pSigInfo)); 1040 pThrdSig->u.SigWait.pSigInfo->si_signo = iSignalNo; 1041 } 1037 bzero((void *)&pThrdSig->u.pSigWait->SigInfo, sizeof(pThrdSig->u.pSigWait->SigInfo)); 1038 pThrdSig->u.pSigWait->SigInfo.si_signo = iSignalNo; 1039 pThrdSig->u.pSigWait->fDone = 1; 1042 1040 pThrdSig->enmStatus = enmLIBCThreadStatus_unknown; 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1043 1056 if (pThrdSig != pThrd) 1044 1057 __libc_back_signalPokeThread(pThrdSig); 1045 LIBCLOG_MSG("wokeup sigwait in thread % don signal %d.\n", pThrdSig->tid, iSignalNo);1058 LIBCLOG_MSG("wokeup sigwait in thread % on signal %d.\n", pThrdSig->tid, iSignalNo); 1046 1059 } 1047 1060 else … … 1116 1129 if (pThrdSig != pThrd) 1117 1130 __libc_back_signalPokeThread(pThrdSig); 1118 LIBCLOG_MSG("setting %d pending on thread % d's and poking it.\n", pThrdSig->tid, iSignalNo);1131 LIBCLOG_MSG("setting %d pending on thread %'s and poking it.\n", pThrdSig->tid, iSignalNo); 1119 1132 } 1120 1133 } … … 1351 1364 1352 1365 /* 1353 * If we've got a queue node, queue it. 1354 */ 1355 if (pSig) 1356 { 1357 pSig->pNext = NULL; 1358 pSig->pPrev = pThrdSig->SigQueue.pTail; 1359 if (pThrdSig->SigQueue.pTail) 1360 pThrdSig->SigQueue.pTail->pNext = pSig; 1366 * Check if this was a sig*wait* case. 1367 */ 1368 if ( pThrdSig->enmStatus == enmLIBCThreadStatus_sigwait 1369 && __SIGSET_ISSET(&pThrdSig->u.pSigWait->SigSetWait, iSignalNo)) 1370 { 1371 /* 1372 * Store result with the thread. 1373 */ 1374 if (pSig) 1375 pThrdSig->u.pSigWait->SigInfo = pSig->SigInfo; 1361 1376 else 1362 pThrdSig->SigQueue.pHead = pSig; 1363 pThrdSig->SigQueue.pTail = pSig; 1364 } 1365 1366 /* 1367 * In any case, we set the signal pending and poke the thread. 1368 */ 1369 __SIGSET_SET(&pThrd->SigSetPending, iSignalNo); 1370 if (pThrdSig != pThrd) 1371 __libc_back_signalPokeThread(pThrdSig); 1372 LIBCLOG_MSG("setting %d pending on thread %d's and poking it.\n", pThrdSig->tid, iSignalNo); 1377 bzero((void *)&pThrdSig->u.pSigWait->SigInfo, sizeof(pThrdSig->u.pSigWait->SigInfo)); 1378 pThrdSig->u.pSigWait->SigInfo.si_signo = iSignalNo; 1379 pThrdSig->u.pSigWait->fDone = 1; 1380 pThrdSig->enmStatus = enmLIBCThreadStatus_unknown; 1381 1382 /* 1383 * Free the signal node. 1384 */ 1385 pSig->pNext = gpSigQueuedFree; 1386 gpSigQueuedFree = pSig->pNext; 1387 gcSigQueuedFree++; 1388 1389 /* 1390 * Check if there is an unqueued pending signal which we should clear. 1391 */ 1392 pSig = pThrdSig->SigQueue.pHead; 1393 while (pSig && pSig->SigInfo.si_signo != iSignalNo) 1394 pSig = pSig->pNext; 1395 if (!pSig) 1396 __SIGSET_CLEAR(&pThrdSig->SigSetPending, iSignalNo); 1397 else 1398 __SIGSET_SET(&pThrdSig->SigSetPending, iSignalNo); 1399 1400 /* 1401 * Poke the thread. 1402 */ 1403 if (pThrdSig != pThrd) 1404 __libc_back_signalPokeThread(pThrdSig); 1405 LIBCLOG_MSG("wokeup sigwait in thread %#x on signal %d.\n", pThrdSig->tid, iSignalNo); 1406 } 1407 else 1408 { 1409 /* 1410 * If we've got a queue node, queue it. 1411 */ 1412 if (pSig) 1413 { 1414 pSig->pNext = NULL; 1415 pSig->pPrev = pThrdSig->SigQueue.pTail; 1416 if (pThrdSig->SigQueue.pTail) 1417 pThrdSig->SigQueue.pTail->pNext = pSig; 1418 else 1419 pThrdSig->SigQueue.pHead = pSig; 1420 pThrdSig->SigQueue.pTail = pSig; 1421 } 1422 1423 /* 1424 * And in any case set it pending. 1425 */ 1426 __SIGSET_SET(&pThrd->SigSetPending, iSignalNo); 1427 1428 /* 1429 * Poke the thread. 1430 */ 1431 if (pThrdSig != pThrd) 1432 __libc_back_signalPokeThread(pThrdSig); 1433 LIBCLOG_MSG("setting %d pending on thread %#x's and poking it.\n", pThrdSig->tid, iSignalNo); 1434 } 1435 1373 1436 LIBCLOG_RETURN_VOID(); 1374 1437 } … … 1386 1449 { 1387 1450 LIBC_ASSERTM(__libc_back_signalSemIsOwner(), "Thread does not own the signal semaphore!!!\n"); 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1388 1461 1389 1462 /* … … 1423 1496 */ 1424 1497 if ( pCur->enmStatus == enmLIBCThreadStatus_sigwait 1425 && __SIGSET_ISSET(&pCur->u. SigWait.SigSetWait, pParam->iSignalNo))1498 && __SIGSET_ISSET(&pCur->u.SigSetWait, pParam->iSignalNo)) 1426 1499 { 1427 1500 if (pCur == pParam->pThrd) … … 1443 1516 || ( pBest 1444 1517 && pBest->enmStatus == enmLIBCThreadStatus_sigwait 1445 && __SIGSET_ISSET(&p Cur->u.SigWait.SigSetWait, pParam->iSignalNo)))1518 && __SIGSET_ISSET(&pSigSetWait, pParam->iSignalNo))) 1446 1519 return 0; 1447 1520 /* ok, it's not blocking it so it's ok to use it. */ … … 1552 1625 1553 1626 /* 1554 * Deliver signals /execute signal default actions in this order: 1555 * 0. Passed in signal (ignores blocking). 1556 * 1. SIGKILL 1557 * 2. Realtime signals. (queued) 1558 * 3. SIGTERM 1559 * 4. SIGABRT 1560 * 5. SIGCHLD 1561 * 6. SIGCONT 1562 * 7. Ascending from pending mask. 1563 * 1564 * Note that 0 and 1 may be violating the POSIX specs. 1565 */ 1566 if (!iSignalNo || !__SIGSET_ISSET(&pThrd->SigSetPending, iSignalNo)) 1567 { 1568 iSignalNo = SIGKILL; 1569 if (!__SIGSET_ISSET(&SigDeliver, SIGKILL)) 1570 { 1571 iSignalNo = SIGRTMIN; 1572 while (iSignalNo <= SIGRTMAX && !__SIGSET_ISSET(&SigDeliver, iSignalNo)) 1573 iSignalNo++; 1574 if (iSignalNo > SIGRTMAX) 1575 { 1576 iSignalNo = SIGTERM; 1577 if (!__SIGSET_ISSET(&SigDeliver, SIGTERM)) 1578 { 1579 iSignalNo = SIGABRT; 1580 if (!__SIGSET_ISSET(&SigDeliver, SIGABRT)) 1581 { 1582 iSignalNo = SIGCHLD; 1583 if (!__SIGSET_ISSET(&SigDeliver, SIGCHLD)) 1584 { 1585 iSignalNo = SIGCONT; 1586 if (!__SIGSET_ISSET(&SigDeliver, SIGCONT)) 1587 { 1588 iSignalNo = 1; 1589 while (iSignalNo < SIGRTMIN && !__SIGSET_ISSET(&SigDeliver, iSignalNo)) 1590 iSignalNo++; 1591 if (iSignalNo >= SIGRTMIN) 1592 { 1593 LIBC_ASSERTM_FAILED("Internal error!!!\n"); 1594 LIBCLOG_RETURN_INT(__LIBC_BSRR_CONTINUE); 1595 } 1596 } 1597 } 1598 } 1599 } 1600 } 1601 } 1602 } 1603 1604 /* 1605 * Check if there is a queue element for the signal. 1606 */ 1607 siginfo_t SigInfo = {0}; 1608 PSIGQUEUED pSig = pThrd->SigQueue.pHead; 1609 while (pSig) 1610 { 1611 if (pSig->SigInfo.si_signo == iSignalNo) 1612 { 1613 /* unlink */ 1614 if (pSig->pPrev) 1615 pSig->pPrev->pNext = pSig->pNext; 1616 else 1617 pThrd->SigQueue.pHead = pSig->pNext; 1618 if (pSig->pNext) 1619 pSig->pNext->pPrev = pSig->pPrev; 1620 else 1621 pThrd->SigQueue.pTail = pSig->pPrev; 1622 1623 /* 1624 * Check if more signals of this type so we can update the 1625 * pending mask correctly. 1626 */ 1627 PSIGQUEUED pSigMore = pSig->pNext; 1628 while (pSigMore && pSigMore->SigInfo.si_signo != iSignalNo) 1629 pSigMore = pSigMore->pNext; 1630 if (!pSigMore) 1631 __SIGSET_CLEAR(&pThrd->SigSetPending, iSignalNo); 1632 1633 /* 1634 * Copy the signal to the SigInfo structure on the stack 1635 * and then release the signal queue structure. 1636 */ 1637 SigInfo = pSig->SigInfo; 1638 break; 1639 } 1640 /* next */ 1641 pSig = pSig->pNext; 1642 } 1643 1644 /* 1645 * If no queued signal data, then we can simply clear it in the pending mask. 1646 */ 1647 if (!pSig) 1648 { 1649 SigInfo.si_signo = iSignalNo; 1650 __SIGSET_CLEAR(&pThrd->SigSetPending, iSignalNo); 1651 } 1652 1653 1654 /* 1655 * What to do for this signal? 1656 */ 1627 * Accept the signal. 1628 */ 1629 siginfo_t SigInfo; 1630 if (iSignalNo && __SIGSET_ISSET(&pThrd->SigSetPending, iSignalNo)) 1631 iSignalNo = __libc_back_signalAccept(pThrd, iSignalNo, &SigDeliver, &SigInfo); 1632 LIBC_ASSERTM(__SIGSET_SIG_VALID(iSignalNo), "iSignalNo=%d\n", iSignalNo); 1657 1633 struct sigaction SigAction = gaSignalActions[iSignalNo]; 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1658 1667 if ( SigAction.__sigaction_u.__sa_handler == SIG_IGN 1659 1668 || ( SigAction.__sigaction_u.__sa_handler == SIG_DFL … … 1666 1675 } 1667 1676 1677 1678 1679 1668 1680 if (SigAction.__sigaction_u.__sa_handler == SIG_DFL) 1669 1681 { … … 1730 1742 if (gafSignalProperties[iSignalNo] & SPP_NOBLOCK) 1731 1743 __SIGSET_CLEAR(&SigAction.sa_mask, iSignalNo); 1732 sigset_t SigSetOld = pThrd->SigSetBlocked;1744 sigset_t SigSetOld = d; 1733 1745 __SIGSET_OR(&pThrd->SigSetBlocked, &pThrd->SigSetBlocked, &SigAction.sa_mask); 1734 1746 … … 1992 2004 static int signalJobStop(int iSignalNo) 1993 2005 { 1994 LIBC_ASSERTM(__libc_threadCurrent()->tid == 1, "Invalid thread % d\n", __libc_threadCurrent()->tid);2006 LIBC_ASSERTM(__libc_threadCurrent()->tid == 1, "Invalid thread %\n", __libc_threadCurrent()->tid); 1995 2007 1996 2008 /* … … 2019 2031 static int signalJobResume(void) 2020 2032 { 2021 LIBC_ASSERTM(__libc_threadCurrent()->tid == 1, "Invalid thread % d\n", __libc_threadCurrent()->tid);2033 LIBC_ASSERTM(__libc_threadCurrent()->tid == 1, "Invalid thread %\n", __libc_threadCurrent()->tid); 2022 2034 2023 2035 /* … … 2358 2370 * 2359 2371 * @returns 0 on success. 2360 * @returns -Negative errnoon failure.2372 * @returns on failure. 2361 2373 * @param iSignalNo Signal number. 2362 2374 * @param pSigAct Pointer to new signal action. … … 2557 2569 2558 2570 /** 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2559 2799 * Gets the current timestamp. 2560 2800 * -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/signals.h
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r1617 r1618 30 30 #include <sys/cdefs.h> 31 31 #include <signal.h> 32 32 33 #include <InnoTekLIBC/backend.h> 33 34 35 /** Signal set of the signals which will interrupt system call execution.36 * By default all signals will interrupt syscall execution, since OS/2 can't really37 * restart system calls easily.38 * Update is protected by the signal semaphore, however read access isn't.39 */40 extern sigset_t __libc_gSignalRestartMask;41 34 42 35 /** Signal set for the signals which are pending on a process scope. … … 56 49 void __libc_back_signalPokeProcess(void); 57 50 int __libc_back_signalSuspend(void); 58 int __libc_back_signalWait(const struct timespec *pTimeout); 51 int __libc_back_signalAccept(__LIBC_PTHREAD pThrd, int iSignalNo, sigset_t *pSigSet, siginfo_t *pSigInfo); 52 int __libc_back_signalWait(__LIBC_PTHREAD pThrd, volatile int *pfDone, const struct timespec *pTimeout); 59 53 int __libc_back_signalSendPidOther(pid_t pid, int iSignalNo, siginfo_t *pSigInfo); 60 54 int __libc_back_signalAction(int iSignalNo, const struct sigaction *pSigAct, struct sigaction *pSigActOld); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
