Changeset 1625
- Timestamp:
- Nov 8, 2004, 2:06:54 AM (21 years ago)
- Location:
- trunk/src/emx/src/lib
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/process/bsd_signal.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1624 r1625 79 79 SigAct.sa_flags = 0; 80 80 __SIGSET_EMPTY(&SigAct.sa_mask); 81 81 if (__SIGSET_ISSET(&__libc_gSignalRestartMask, iSignalNo)) 82 SigAct.sa_flags |= SA_RESTART; 82 83 83 84 /* 84 85 * Change signal action. 85 86 */ 86 if (__SIGSET_ISSET(&__libc_gSignalRestartMask, iSignalNo))87 SigAct.sa_flags |= SA_RESTART;88 87 rc = __libc_Back_signalAction(iSignalNo, &SigAct, &SigActOld); 89 88 if (!rc) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/signal.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1624 r1625 36 36 37 37 /** 38 * Defaul signal() style is BSD.38 * Default signal() style is BSD. 39 39 * 40 40 * @returns pointer to previous signal handler. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/sigprocmask.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1624 r1625 50 50 * values are SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK. 51 51 * 52 * SIG_BLOCK means to orthe sigset pointed to by pSigSetNew with52 * SIG_BLOCK means to OR the sigset pointed to by pSigSetNew with 53 53 * the signal mask for the current thread. 54 * SIG_UNBLOCK means to andthe 0 complement of the sigset pointed54 * SIG_UNBLOCK means to AND the 0 complement of the sigset pointed 55 55 * to by pSigSetNew with the signal mask of the current thread. 56 * SIG_SETMASK means to setthe signal mask of the current thread56 * SIG_SETMASK means to REPLACE the signal mask of the current thread 57 57 * to the sigset pointed to by pSigSetNew. 58 58 * -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalSuspend.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1624 r1625 68 68 pThrd->enmStatus = enmLIBCThreadStatus_sigsuspend; 69 69 70 /** @todo The specs say no rescheduling of signals in sigsuspend()... I'm not sure if that's a great idea. */ 71 70 72 /* 71 73 * Perform signal wait and return. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/sharedpm.c
-
Property cvs2svn:cvs-rev
changed from
1.16
to1.17
r1624 r1625 956 956 */ 957 957 if ( ( gpSPMHdr->cSigActive < gpSPMHdr->cSigMaxActive 958 && gpSPMSelf->cSigsSent < _ _LIBC_SPM_SIGNALS_MAX_SENT)958 && gpSPMSelf->cSigsSent < _POSIX_SIGQUEUE_MAX) 959 959 || pSignal->si_signo == SIGCHLD) 960 960 { … … 1023 1023 { 1024 1024 LIBCLOG_MSG("Limit reached: cSigActive=%d cSigMaxActive=%d cSigsSent=%d (max %d)\n", 1025 gpSPMHdr->cSigActive, gpSPMHdr->cSigMaxActive, pProcess->cSigsSent, _ _LIBC_SPM_SIGNALS_MAX_SENT);1025 gpSPMHdr->cSigActive, gpSPMHdr->cSigMaxActive, pProcess->cSigsSent, _POSIX_SIGQUEUE_MAX); 1026 1026 rc = -EAGAIN; 1027 1027 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/signals.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1624 r1625 78 78 #include <malloc.h> 79 79 #include <386/builtin.h> 80 #include <emx/umalloc.h> 80 81 #include <InnoTekLIBC/thread.h> 81 82 #include <InnoTekLIBC/fork.h> … … 529 530 * All access to this array is protected by the signal semaphore. 530 531 */ 531 static PSIGQUEUED gpSigQueuedFree = &gpaSigQueuedPreAlloced[0];532 static PSIGQUEUED gpSigQueuedFree = &gpaSigQueuedPreAlloced[0]; 532 533 /** Number of structures in the free queue. */ 533 static unsignedgcSigQueuedFree = sizeof(gpaSigQueuedPreAlloced) / sizeof(gpaSigQueuedPreAlloced[0]);534 static volatile unsigned gcSigQueuedFree = sizeof(gpaSigQueuedPreAlloced) / sizeof(gpaSigQueuedPreAlloced[0]); 534 535 535 536 /** Flag indicating that this LIBC instance have installed the signal handler. … … 781 782 782 783 /** 783 * Worker called after __libc_Back_signalRaise() was called with a 784 * preallocated signal queue entry. This function will make sure 785 * we're not ending up with too many heap allocated packets in the 786 * free list. 787 */ 788 void __libc_Back_signalFreeWorker(void) 789 { 790 LIBCLOG_ENTER("\n"); 791 if (gcSigQueuedFree > sizeof(gpaSigQueuedPreAlloced) * 2 / sizeof(gpaSigQueuedPreAlloced[0])) 792 { 793 if (!__libc_back_signalSemRequest()) 784 * Reschedule signals. 785 * Typically called after a block mask have been updated. 786 * 787 * @returns On success a flag mask out of the __LIBC_BSRR_* #defines is returned. 788 * @returns On failure a negative error code (errno.h) is returned. 789 * @param pThrd Current thread. 790 */ 791 int __libc_back_signalReschedule(__LIBC_PTHREAD pThrd) 792 { 793 LIBC_ASSERT(__libc_back_signalSemIsOwner()); 794 signalScheduleSPM(pThrd); 795 signalScheduleProcess(pThrd); 796 return signalDeliver(pThrd, 0, NULL); 797 } 798 799 800 /** 801 * Raises a signal in the current process. 802 * 803 * @returns On success a flag mask out of the __LIBC_BSRR_* #defines is returned. 804 * @returns On failure a negative error code (errno.h) is returned. 805 * @param iSignalNo Signal to raise. 806 * @param pSigInfo Pointer to signal info for this signal. 807 * NULL is allowed. 808 * @param pvXcptOrQueued Exception handler parameter list. 809 * Or if __LIBC_BSRF_QUEUED is set, a pointer to locally malloced 810 * SIGQUEUED node. 811 * @param fFlags Flags of the #defines __LIBC_BSRF_* describing how to 812 * deliver the signal. 813 * 814 * @remark This Backend Signal API does NOT require the caller to own the signal semaphore. 815 */ 816 int __libc_back_signalQueueSelf(int iSignalNo, siginfo_t *pSigInfo) 817 { 818 LIBCLOG_ENTER("iSignalNo=%d pSigInfo=%p\n", iSignalNo, (void *)pSigInfo); 819 820 /* 821 * Preallocate a queue entry to avoid entering and leaving the semaphore unecessary. 822 */ 823 PSIGQUEUED pSigToFree = NULL; 824 PSIGQUEUED pSig = _hmalloc(sizeof(*pSig)); 825 826 /* 827 * Take sempahore. 828 */ 829 int rc = __libc_back_signalSemRequest(); 830 if (!rc) 831 { 832 /* 833 * Release heap memory accumulated in node 834 */ 835 if (gcSigQueuedFree > sizeof(gpaSigQueuedPreAlloced) * 2 / sizeof(gpaSigQueuedPreAlloced[0])) 794 836 { 795 837 /* 796 * Free nodes which was allocated from the heap until we're below the water line. 838 * No need for the preallocated one! 839 */ 840 if (pSig) 841 pSig->pNext = NULL; 842 pSigToFree = pSig; 843 844 /* 845 * Unlink heap allocated nodes until we're below the waterline again 797 846 */ 798 847 PSIGQUEUED pSigPrev = NULL; 799 PSIGQUEUEDpSig = gpSigQueuedFree;848 pSig = gpSigQueuedFree; 800 849 int cToMany = gcSigQueuedFree - sizeof(gpaSigQueuedPreAlloced) * 2 / sizeof(gpaSigQueuedPreAlloced[0]); 801 850 while (cToMany > 0) … … 810 859 gpSigQueuedFree = pSigNext; 811 860 812 /* free */ 813 free(pSig); 861 /* queue for free */ 862 pSig->pNext = pSigToFree; 863 pSigToFree = pSig; 814 864 815 865 /* next */ … … 822 872 } 823 873 } 824 __libc_back_signalSemRelease(); 825 } 826 } 827 LIBCLOG_RETURN_VOID(); 828 } 829 830 831 /** 832 * Reschedule signals. 833 * Typically called after a block mask have been updated. 834 * 835 * @returns On success a flag mask out of the __LIBC_BSRR_* #defines is returned. 836 * @returns On failure a negative error code (errno.h) is returned. 837 * @param pThrd Current thread. 838 */ 839 int __libc_back_signalReschedule(__LIBC_PTHREAD pThrd) 840 { 841 LIBC_ASSERT(__libc_back_signalSemIsOwner()); 842 signalScheduleSPM(pThrd); 843 signalScheduleProcess(pThrd); 844 return signalDeliver(pThrd, 0, NULL); 874 875 pSig = NULL; 876 } 877 878 /* 879 * Raise the signal the normal way. 880 */ 881 rc = __libc_Back_signalRaise(iSignalNo, pSigInfo, pSig, __LIBC_BSRF_QUEUED); 882 __libc_back_signalSemRelease(); 883 if (rc > 0) 884 rc = 0; 885 } 886 887 /* 888 * Cleanup and return. 889 */ 890 while (pSigToFree) 891 { 892 void *pvToFree = pSigToFree; 893 pSigToFree = pSigToFree->pNext; 894 free(pvToFree); 895 } 896 LIBCLOG_RETURN_INT(rc); 845 897 } 846 898 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/signals.h
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1624 r1625 49 49 void __libc_back_signalPokeProcess(void); 50 50 int __libc_back_signalReschedule(__LIBC_PTHREAD pThrd); 51 int __libc_back_signalQueueSelf(int iSignalNo, siginfo_t *pSigInfo); 51 52 int __libc_back_signalSuspend(void); 52 53 int __libc_back_signalAccept(__LIBC_PTHREAD pThrd, int iSignalNo, sigset_t *pSigSet, siginfo_t *pSigInfo); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.