Changeset 2308


Ignore:
Timestamp:
Aug 27, 2005, 6:56:52 PM (20 years ago)
Author:
bird
Message:

Fixed two incorrect unlocks after deliver.

Location:
trunk/src/emx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/ChangeLog.LIBC

    • Property cvs2svn:cvs-rev changed from 1.128 to 1.129
    r2307 r2308  
    22
    33TODO: open replace on RAMFS fails with error 32!
     4
     52005-08-27: knut st. osmundsen <bird-gccos2-spam@anduin.net>
     6    - libc:
     7        o Fixed two cases where the signal semaphore was incorrectly unlocked
     8          after signalDeliver().
    49
    5102005-08-24: knut st. osmundsen <bird-gccos2-spam@anduin.net>
  • trunk/src/emx/src/lib/sys/b_signalMask.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r2307 r2308  
    9797     * Gain exclusive access to the signal stuff.
    9898     */
     99    int fRelease = 1;
    99100    int rc = __libc_back_signalSemRequest();
    100101    if (rc)
     
    134135        __SIGSET_AND(&SigSetPending, &SigSetPending, &SigSetNotBlocked);
    135136        if (!__SIGSET_ISEMPTY(&SigSetPending))
     137        {
    136138            __libc_back_signalReschedule(pThrd);
     139            fRelease = 0;
     140        }
    137141    }
    138142
     
    140144     * Release semaphore.
    141145     */
    142     __libc_back_signalSemRelease();
     146    if (fRelease)
     147        __libc_back_signalSemRelease();
    143148
    144149    /*
  • trunk/src/emx/src/lib/sys/signals.c

    • Property cvs2svn:cvs-rev changed from 1.31 to 1.32
    r2307 r2308  
    724724 * Typically called after a block mask have been updated.
    725725 *
     726 * The caller must own the signal semaphore, this function will release the ownership!
     727 *
    726728 * @returns On success a flag mask out of the __LIBC_BSRR_* #defines is returned.
    727729 * @returns On failure a negative error code (errno.h) is returned.
     
    18411843                && !(gafSignalProperties[iSignalNo] & SPP_NORESET))
    18421844            {
     1845                LIBCLOG_MSG("Performing SA_RESETHAND on %d.\n", iSignalNo);
    18431846                gaSignalActions[iSignalNo].__sigaction_u.__sa_handler = SIG_DFL;
    18441847                gaSignalActions[iSignalNo].sa_flags &= ~SA_SIGINFO;
     
    18591862            __SIGSET_OR(&pThrd->SigSetBlocked, &pThrd->SigSetBlocked, &SigAction.sa_mask);
    18601863
     1864            /*
     1865             * Setup ucontext.
     1866             */
    18611867            void *pvCtx = NULL;
    18621868            if (SigAction.sa_flags & SA_SIGINFO)
     
    18731879                ||  !pThrd->cbSigStack)
    18741880            {
     1881                LIBCLOG_MSG("Calling %p(%d, %p:{.si_signo=%d, .si_errno=%d, .si_code=%#x, .si_timestamp=%#x, .si_flags=%#x .si_pid=%#x, .si_pgrp=%#x, .si_tid=%#x, .si_uid=%d, .si_status=%d, .si_addr=%p, .si_value=%p, .si_band=%ld, .si_fd=%d}, %p)\n",
     1882                            (void *)SigAction.__sigaction_u.__sa_sigaction, iSignalNo, (void *)&SigInfo, SigInfo.si_signo, SigInfo.si_errno,
     1883                            SigInfo.si_code, SigInfo.si_timestamp, SigInfo.si_flags, SigInfo.si_pid, SigInfo.si_pgrp, SigInfo.si_tid,
     1884                            SigInfo.si_uid, SigInfo.si_status, SigInfo.si_addr, SigInfo.si_value.sigval_ptr, SigInfo.si_band, SigInfo.si_fd, pvCtx);
    18751885                __libc_back_signalSemRelease();
    18761886                SigAction.__sigaction_u.__sa_sigaction(iSignalNo, &SigInfo, pvCtx);
     
    19021912                pTib->tib_pstack      = pThrd->pvSigStack;
    19031913                pTib->tib_pstacklimit = (char *)pThrd->pvSigStack + pThrd->cbSigStack;
     1914
     1915                LIBCLOG_MSG("Calling %p(%d, %p:{.si_signo=%d, .si_errno=%d, .si_code=%#x, .si_timestamp=%#x, .si_flags=%#x .si_pid=%#x, .si_pgrp=%#x, .si_tid=%#x, .si_uid=%d, .si_status=%d, .si_addr=%p, .si_value=%p, .si_band=%ld, .si_fd=%d}, %p) on stack %p-%p (old stack %p-%p)\n",
     1916                            (void *)SigAction.__sigaction_u.__sa_sigaction, iSignalNo, (void *)&SigInfo, SigInfo.si_signo, SigInfo.si_errno,
     1917                            SigInfo.si_code, SigInfo.si_timestamp, SigInfo.si_flags, SigInfo.si_pid, SigInfo.si_pgrp, SigInfo.si_tid,
     1918                            SigInfo.si_uid, SigInfo.si_status, SigInfo.si_addr, SigInfo.si_value.sigval_ptr, SigInfo.si_band, SigInfo.si_fd,
     1919                            pvCtx, pTib->tib_pstack, pTib->tib_pstacklimit, pvOldStack, pvOldStackLimit);
    19041920
    19051921                /* release, switch and call. */
     
    19461962            /*
    19471963             * Re-take the signal semaphore and restore the signal mask.
    1948              * We'll have to reschedule signals here unless the two masks are 100% equal
     1964             * We'll have to reschedule signals here unless the two masks are 100% equal.
    19491965             */
    19501966            if (__libc_back_signalSemRequest())
    1951                 break;
     1967                LIBCLOG_ERROR_RETURN_INT(rcRet);
    19521968            pThrd->SigSetBlocked = SigSetOld;
    19531969            signalScheduleSPM(pThrd);
     
    23082324    signalDeliver(pThrd, 0, NULL);
    23092325
    2310     __libc_back_signalSemRelease();
    23112326    if (!rc)
    23122327        LIBCLOG_RETURN_INT(rc);
     
    24412456
    24422457    /*
    2443      * Deliver signals.
     2458     * Deliver signals and release the semaphore.
    24442459     */
    24452460    signalDeliver(pThrd, 0, NULL);
     
    24992514            {
    25002515                /*
    2501                  * Clear the indicator and deliver signals.
     2516                 * Clear the indicator and deliver signals (releaseing the semaphore).
    25022517                 */
    25032518                __atomic_xchg(&pThrd->fSigBeingPoked, 0);
     
    25152530    }
    25162531    else
    2517         LIBC_ASSERTM_FAILED("No thread structure! This is really impossible!\n");
     2532        LIBC_ASSERTM_FAILED("No thread structure! This is really quite impossible!\n");
    25182533
    25192534    return -EINVAL;
Note: See TracChangeset for help on using the changeset viewer.