Must preserve the value of errno; it can be changed by signal handling
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@95 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
83857ea52b
commit
006abb3ca3
|
@ -80,6 +80,13 @@ void up_sigdeliver(void)
|
|||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
sig_deliver_t sigdeliver;
|
||||
|
||||
/* Save the errno. This must be preserved throughout the
|
||||
* signal handling so that the the user code final gets
|
||||
* the correct errno value (probably EINTR).
|
||||
*/
|
||||
|
||||
int saved_errno = rtcb->errno;
|
||||
|
||||
up_ledon(LED_SIGNAL);
|
||||
|
||||
dbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||
|
@ -110,11 +117,19 @@ void up_sigdeliver(void)
|
|||
|
||||
sigdeliver(rtcb);
|
||||
|
||||
/* Output any debug messaged BEFORE restoreing errno
|
||||
* (becuase they may alter errno), then restore the
|
||||
* original errno that is needed by the user logic
|
||||
* (it is probably EINTR).
|
||||
*/
|
||||
|
||||
dbg("Resuming\n");
|
||||
rtcb->errno = saved_errno;
|
||||
|
||||
/* Then restore the correct state for this thread of
|
||||
* execution.
|
||||
*/
|
||||
|
||||
up_ledoff(LED_SIGNAL);
|
||||
dbg("Resuming\n");
|
||||
up_fullcontextrestore(regs);
|
||||
}
|
||||
|
|
|
@ -77,9 +77,16 @@
|
|||
void up_sigdeliver(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 regs[XCPTCONTEST_REGS];
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
sig_deliver_t sigdeliver;
|
||||
|
||||
/* Save the errno. This must be preserved throughout the
|
||||
* signal handling so that the the user code final gets
|
||||
* the correct errno value (probably EINTR).
|
||||
*/
|
||||
|
||||
int saved_errno = rtcb->errno;
|
||||
|
||||
dbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
||||
ASSERT(rtcb->xcp.sigdeliver != NULL);
|
||||
|
@ -108,10 +115,18 @@ void up_sigdeliver(void)
|
|||
|
||||
sigdeliver(rtcb);
|
||||
|
||||
/* Output any debug messaged BEFORE restoreing errno
|
||||
* (becuase they may alter errno), then restore the
|
||||
* original errno that is needed by the user logic
|
||||
* (it is probably EINTR).
|
||||
*/
|
||||
|
||||
dbg("Resuming\n");
|
||||
rtcb->errno = saved_errno;
|
||||
|
||||
/* Then restore the correct state for this thread of
|
||||
* execution.
|
||||
*/
|
||||
|
||||
dbg("Resuming\n");
|
||||
up_fullcontextrestore(regs);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue