summaryrefslogtreecommitdiff
path: root/libc/stdlib/atexit.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2001-01-17 17:42:06 +0000
committerManuel Novoa III <mjn3@codepoet.org>2001-01-17 17:42:06 +0000
commit867df8dda093c409f6f2b86e568aca243a103f12 (patch)
tree55728cb8704a2a3f435802d08edcecc5dd2fcaa9 /libc/stdlib/atexit.c
parent8960c2a5edce96b5ea8e6db942b73e6649441f90 (diff)
Note about need to match _SC_ATEXIT_MAX. Minor macro name change.
Diffstat (limited to 'libc/stdlib/atexit.c')
-rw-r--r--libc/stdlib/atexit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 20195fa96..5079692af 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -15,7 +15,12 @@
#include <errno.h>
/* ATEXIT.H */
-#define MAXONEXIT 20 /* AIUI Posix requires 10 */
+
+/*
+ * NOTE!!! The following should match the value returned by
+ * by sysconf(_SC_ATEXIT_MAX) in unistd/sysconf.c
+ */
+#define MAXATEXIT 20 /* AIUI Posix requires 10 */
typedef void (*vfuncp) (void);
@@ -23,7 +28,7 @@ extern vfuncp __cleanup;
extern void __do_exit();
extern void _exit __P((int __status)) __attribute__ ((__noreturn__));
-extern vfuncp __atexit_table[MAXONEXIT];
+extern vfuncp __atexit_table[MAXATEXIT];
extern int __atexit_count;
/* End ATEXIT.H */
@@ -31,7 +36,7 @@ extern int __atexit_count;
#ifdef L_atexit
int atexit(vfuncp ptr)
{
- if ((__atexit_count < 0) || (__atexit_count >= MAXONEXIT)) {
+ if ((__atexit_count < 0) || (__atexit_count >= MAXATEXIT)) {
errno = ENOMEM;
return -1;
}
@@ -42,7 +47,7 @@ int atexit(vfuncp ptr)
return 0;
}
-vfuncp __atexit_table[MAXONEXIT];
+vfuncp __atexit_table[MAXATEXIT];
int __atexit_count = 0;
void __do_exit(int rv)