errno now defined to be *get_errno_ptr()

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@607 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-02-01 21:23:19 +00:00
parent 1e52a8f36a
commit ac37ac75e0
21 changed files with 120 additions and 126 deletions

View File

@ -314,4 +314,6 @@
* Added a test case to verify the Pascal P-Code interpreter
* Added /dev/zero
* 'errno' is now defined to be *get_errno_ptr() with no name conflicts

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: January 31, 2008</p>
<p>Last Updated: February 1, 2008</p>
</td>
</tr>
</table>
@ -964,6 +964,7 @@ Other memory:
* Added a test case to verify the Pascal P-Code interpreter
* Added /dev/zero
* 'errno' is now defined to be *get_errno_ptr() with no name conflicts
</pre></ul>
<table width ="100%">

View File

@ -1,7 +1,7 @@
/************************************************************
/****************************************************************************
* common/up_sigdeliver.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
@ -47,23 +47,23 @@
#include "up_internal.h"
#include "up_arch.h"
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Data
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Funtions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Name: up_sigdeliver
*
* Description:
@ -72,7 +72,7 @@
* with and forced to branch to this location with interrupts
* disabled.
*
************************************************************/
****************************************************************************/
void up_sigdeliver(void)
{
@ -86,7 +86,7 @@ void up_sigdeliver(void)
* the correct errno value (probably EINTR).
*/
int saved_errno = rtcb->errno;
int saved_errno = rtcb->pterrno;
up_ledon(LED_SIGNAL);
@ -125,7 +125,7 @@ void up_sigdeliver(void)
*/
dbg("Resuming\n");
rtcb->errno = saved_errno;
rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of
* execution.

View File

@ -91,7 +91,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->errno;
int saved_errno = rtcb->pterrno;
up_ledon(LED_SIGNAL);
@ -131,7 +131,7 @@ void up_sigdeliver(void)
*/
dbg("Resuming\n");
rtcb->errno = saved_errno;
rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of
* execution.

View File

@ -90,7 +90,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->errno;
int saved_errno = rtcb->pterrno;
up_ledon(LED_SIGNAL);
@ -129,7 +129,7 @@ void up_sigdeliver(void)
*/
dbg("Resuming\n");
rtcb->errno = saved_errno;
rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of
* execution.

View File

@ -65,10 +65,6 @@
#else
/* Get errno using a pointer */
# define errno *get_errno_ptr()
/* Used lib_rawprintf() so that there is not confusion from buffered IO */
# define message(...) lib_rawprintf(__VA_ARGS__)

View File

@ -52,8 +52,6 @@
#define NSH_MAX_ARGUMENTS 6
#define errno (*get_errno_ptr())
/****************************************************************************
* Public Types
****************************************************************************/

View File

@ -44,8 +44,6 @@
* Definitions
****************************************************************************/
#define errno *get_errno_ptr()
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/udp/udp-internal.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -63,10 +63,6 @@
#else
/* Get errno using a pointer */
# define errno *get_errno_ptr()
/* If debug is enabled, use the synchronous lib_lowprintf so that the
* program output does not get disassociated in the debug output.
*/

View File

@ -1,7 +1,7 @@
/************************************************************************
* errno.h
* include/errno.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -44,6 +44,10 @@
* Definitions
************************************************************************/
/* Convenience/compatibility definition */
#define errno *get_errno_ptr()
/* Definitions of error numbers and the string that would be
* returned by strerror().
*/

View File

@ -238,7 +238,7 @@ struct _TCB
/* Library related fields *****************************************************/
int errno; /* Current per-thread errno */
int pterrno; /* Current per-thread errno */
/* File system support ********************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* netutils/dhcpd/dhcpd.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -55,7 +55,6 @@ typedef unsigned char boolean;
# include <nuttx/config.h>
# include <debug.h>
# include <net/uip/dhcpd.h>
# define errno *get_errno_ptr()
#endif
#include <sys/types.h>

View File

@ -53,8 +53,6 @@
* Public Functions
****************************************************************************/
#define errno *get_errno_ptr()
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -2,7 +2,7 @@
* netutils/webserver/httpd.c
* httpd Web server
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* This is a leverage of similar logic from uIP:
@ -76,8 +76,6 @@
#define ISO_slash 0x2f
#define ISO_colon 0x3a
#define errno *get_errno_ptr()
#undef CONFIG_NETUTILS_HTTPD_DUMPBUFFER
#undef CONFIG_NETUTILS_HTTPD_DUMPPSTATE

View File

@ -1,5 +1,5 @@
/****************************************************************************
* get_errno_ptr.c
* sched/get_errno_ptr.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -44,6 +44,7 @@
#include "os_internal.h"
#undef get_errno_ptr
#undef errno
/****************************************************************************
* Private Data
@ -93,7 +94,7 @@ FAR int *get_errno_ptr(void)
* thread-private errno in the TCB of the running task.
*/
return &rtcb->errno;
return &rtcb->pterrno;
}
}

View File

@ -112,7 +112,7 @@ static void mq_rcvtimeout(int argc, uint32 pid)
{
/* Mark the errno value for the thread. */
wtcb->errno = ETIMEDOUT;
wtcb->pterrno = ETIMEDOUT;
/* Restart the the task. */

View File

@ -113,7 +113,7 @@ static void mq_sndtimeout(int argc, uint32 pid)
{
/* Mark the errno value for the thread. */
wtcb->errno = ETIMEDOUT;
wtcb->pterrno = ETIMEDOUT;
/* Restart the the task. */

View File

@ -1,7 +1,7 @@
/************************************************************
* mq_waitirq.c
/****************************************************************************
* sched/mq_waitirq.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <sys/types.h>
#include <sched.h>
@ -43,35 +43,35 @@
#include <nuttx/arch.h>
#include "sem_internal.h"
/************************************************************
/****************************************************************************
* Compilation Switches
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: sem_waitirq
*
* Description:
@ -89,7 +89,7 @@
*
* Assumptions:
*
************************************************************/
****************************************************************************/
void mq_waitirq(FAR _TCB *wtcb)
{
@ -111,7 +111,7 @@ void mq_waitirq(FAR _TCB *wtcb)
{
/* Mark the errno value for the thread. */
wtcb->errno = EINTR;
wtcb->pterrno = EINTR;
/* Restart the the task. */

View File

@ -105,10 +105,10 @@ enum os_crash_codes_e
/* A more efficient ways to access the errno */
#define SET_ERRNO(e) \
{ _TCB *rtcb = _TCB*)g_readytorun.head; rtcb->errno = (e); }
{ _TCB *rtcb = _TCB*)g_readytorun.head; rtcb->pterrno = (e); }
#define _SET_TCB_ERRNO(t,e) \
{ (t)->errno = (e); }
{ (t)->pterrno = (e); }
/****************************************************************************
* Public Type Definitions

View File

@ -1,7 +1,7 @@
/************************************************************
* sem_waitirq.c
/****************************************************************************
* sched/sem_waitirq.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <sys/types.h>
#include <sched.h>
@ -43,35 +43,35 @@
#include <nuttx/arch.h>
#include "sem_internal.h"
/************************************************************
/****************************************************************************
* Compilation Switches
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: sem_waitirq
*
* Description:
@ -90,7 +90,7 @@
*
* Assumptions:
*
************************************************************/
****************************************************************************/
void sem_waitirq(FAR _TCB *wtcb)
{
@ -115,7 +115,7 @@ void sem_waitirq(FAR _TCB *wtcb)
/* Mark the errno value for the thread. */
wtcb->errno = EINTR;
wtcb->pterrno = EINTR;
/* Restart the the task. */

View File

@ -1,7 +1,7 @@
/************************************************************
* sig_deliver.c
/****************************************************************************
* sched/sig_deliver.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,13 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <signal.h>
@ -43,35 +45,36 @@
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "sem_internal.h"
#include "sig_internal.h"
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: sig_deliver
*
* Description:
@ -79,7 +82,7 @@
* the signal receiving task. It processes all queued
* signals then returns.
*
************************************************************/
****************************************************************************/
void sig_deliver(FAR _TCB *stcb)
{
@ -99,7 +102,7 @@ void sig_deliver(FAR _TCB *stcb)
* was reawakened by a signal must be retained.
*/
saved_errno = stcb->errno;
saved_errno = stcb->pterrno;
for (sigq = (FAR sigq_t*)stcb->sigpendactionq.head; (sigq); sigq = next)
{
next = sigq->flink;
@ -158,7 +161,7 @@ void sig_deliver(FAR _TCB *stcb)
sig_releasependingsigaction(sigq);
}
stcb->errno = saved_errno;
stcb->pterrno = saved_errno;
sched_unlock();
}