summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-11 16:30:51 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-11 16:30:51 +0000
commit4c5080ed0926e845360fb3f97e3442d9de5ae30d (patch)
treee2b50177a14a450d24da1c9abd185519a47804dd
parentddd22e5d0d20377f202f814aa8e5583ae2e9c14e (diff)
downloadrtems-4c5080ed0926e845360fb3f97e3442d9de5ae30d.tar.bz2
Fix based on bug report from Jay Kulpinski <jskulpin@eng01.gdds.com>
that the per task reentrancy structure was not being processed properly during exit(). joel@oarcorp.com wrote: > > > This is always an ugly place to poke around. :( > > The code in newlib/libc/stdlib/exit.c walks the atexit chain for the > reentrancy structure for JUST the current task. The code in libc_wrapup() > does it for both the current task and the global reentrancy structure > (which tends to be where driver atexit()'s were registered. > > So I think the _wrapup_reent(0) in libc_wrapup() should be commented out. > > If you concur, then I will make the change and improve the comment on this > line of code to explain things: > > libc_wrapup(); /* Why? XXX */ > > --joel That does the job. cdtest.exe works correctly now.
-rw-r--r--c/src/exec/libcsupport/src/newlibc.c12
-rw-r--r--c/src/lib/libc/newlibc.c12
-rw-r--r--cpukit/libcsupport/src/newlibc.c12
3 files changed, 33 insertions, 3 deletions
diff --git a/c/src/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c
index 4926467837..6331997750 100644
--- a/c/src/exec/libcsupport/src/newlibc.c
+++ b/c/src/exec/libcsupport/src/newlibc.c
@@ -84,7 +84,11 @@ libc_wrapup(void)
if (!_System_state_Is_up(_System_state_Get()))
return;
+ /*
+ * This was already done if the user called exit() directly .
+
_wrapup_reent(0);
+ */
if (_REENT != &libc_global_reent)
{
_wrapup_reent(&libc_global_reent);
@@ -363,7 +367,13 @@ int get_errno()
#if !defined(RTEMS_UNIX) && !defined(_AM29K)
void _exit(int status)
{
- libc_wrapup(); /* Why? XXX */
+ /*
+ * We need to do the exit processing on the global reentrancy structure.
+ * This has already been done on the per task reentrancy structure
+ * associated with this task.
+ */
+
+ libc_wrapup();
rtems_shutdown_executive(status);
}
diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c
index 4926467837..6331997750 100644
--- a/c/src/lib/libc/newlibc.c
+++ b/c/src/lib/libc/newlibc.c
@@ -84,7 +84,11 @@ libc_wrapup(void)
if (!_System_state_Is_up(_System_state_Get()))
return;
+ /*
+ * This was already done if the user called exit() directly .
+
_wrapup_reent(0);
+ */
if (_REENT != &libc_global_reent)
{
_wrapup_reent(&libc_global_reent);
@@ -363,7 +367,13 @@ int get_errno()
#if !defined(RTEMS_UNIX) && !defined(_AM29K)
void _exit(int status)
{
- libc_wrapup(); /* Why? XXX */
+ /*
+ * We need to do the exit processing on the global reentrancy structure.
+ * This has already been done on the per task reentrancy structure
+ * associated with this task.
+ */
+
+ libc_wrapup();
rtems_shutdown_executive(status);
}
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
index 4926467837..6331997750 100644
--- a/cpukit/libcsupport/src/newlibc.c
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -84,7 +84,11 @@ libc_wrapup(void)
if (!_System_state_Is_up(_System_state_Get()))
return;
+ /*
+ * This was already done if the user called exit() directly .
+
_wrapup_reent(0);
+ */
if (_REENT != &libc_global_reent)
{
_wrapup_reent(&libc_global_reent);
@@ -363,7 +367,13 @@ int get_errno()
#if !defined(RTEMS_UNIX) && !defined(_AM29K)
void _exit(int status)
{
- libc_wrapup(); /* Why? XXX */
+ /*
+ * We need to do the exit processing on the global reentrancy structure.
+ * This has already been done on the per task reentrancy structure
+ * associated with this task.
+ */
+
+ libc_wrapup();
rtems_shutdown_executive(status);
}