diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 0f170dbb9b6d..8dca7a0daece 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -135,4 +135,9 @@ extern const char *__progname; */ extern struct _spinlock *__malloc_lock; +/* + * Function to clean up streams, called from abort() and exit(). + */ +extern void (*__cleanup)(void); + #endif /* _LIBC_PRIVATE_H_ */ diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h index 16a9e78db6ff..74c3238357ac 100644 --- a/lib/libc/stdio/local.h +++ b/lib/libc/stdio/local.h @@ -65,7 +65,6 @@ extern fpos_t __sseek(void *, fpos_t, int); extern int __sclose(void *); extern void __sinit(void); extern void _cleanup(void); -extern void (*__cleanup)(void); extern void __smakebuf(FILE *); extern int __swhatbuf(FILE *, size_t *, int *); extern int _fwalk(int (*)(FILE *)); diff --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c index bc8a468f2580..bdade6754cfa 100644 --- a/lib/libc/stdio/makebuf.c +++ b/lib/libc/stdio/makebuf.c @@ -46,9 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include "local.h" #include "un-namespace.h" +#include "libc_private.h" +#include "local.h" + /* * Allocate a file buffer, or switch to unbuffered I/O. * Per the ANSI C standard, ALL tty devices default to line buffered. diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c index 36cd15ba62bb..468a9bf40d87 100644 --- a/lib/libc/stdlib/abort.c +++ b/lib/libc/stdlib/abort.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" -void (*__cleanup)(); +#include "libc_private.h" void abort() diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c index 83abdbd5d506..cafb127eeea9 100644 --- a/lib/libc/stdlib/exit.c +++ b/lib/libc/stdlib/exit.c @@ -41,9 +41,11 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" -#include "atexit.h" -void (*__cleanup)(); +#include "atexit.h" +#include "libc_private.h" + +void (*__cleanup)(void); /* * This variable is zero until a process has created a thread.