diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-19 16:38:16 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-19 16:38:16 +0000 |
commit | 1e60d6c9e0521284f6386c4fbc66f1cc799f2ed9 (patch) | |
tree | 928f1f5f0118c75c8ca876a91a70b1e5e58226b7 /nuttx/arch/c5471/src | |
parent | e01d4b0082c059469de4e8492b21c9b220ea56a8 (diff) | |
download | px4-nuttx-1e60d6c9e0521284f6386c4fbc66f1cc799f2ed9.tar.gz px4-nuttx-1e60d6c9e0521284f6386c4fbc66f1cc799f2ed9.tar.bz2 px4-nuttx-1e60d6c9e0521284f6386c4fbc66f1cc799f2ed9.zip |
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
Diffstat (limited to 'nuttx/arch/c5471/src')
-rw-r--r-- | nuttx/arch/c5471/src/up_sigdeliver.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nuttx/arch/c5471/src/up_sigdeliver.c b/nuttx/arch/c5471/src/up_sigdeliver.c index 528a2864e..8ec10599a 100644 --- a/nuttx/arch/c5471/src/up_sigdeliver.c +++ b/nuttx/arch/c5471/src/up_sigdeliver.c @@ -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); } |