diff options
Diffstat (limited to 'libexec/rtld-elf/malloc.c')
-rw-r--r-- | libexec/rtld-elf/malloc.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c index 38ae89a..9591659 100644 --- a/libexec/rtld-elf/malloc.c +++ b/libexec/rtld-elf/malloc.c @@ -49,7 +49,6 @@ static char *rcsid = "$FreeBSD$"; #include <sys/types.h> #include <sys/sysctl.h> -#include <err.h> #include <paths.h> #include <stdarg.h> #include <stddef.h> @@ -59,6 +58,7 @@ static char *rcsid = "$FreeBSD$"; #include <unistd.h> #include <sys/param.h> #include <sys/mman.h> +#include "rtld_printf.h" #ifndef BSD #define MAP_COPY MAP_PRIVATE #define MAP_FILE 0 @@ -150,8 +150,7 @@ botch(s) #endif /* Debugging stuff */ -static void xprintf(const char *, ...); -#define TRACE() xprintf("TRACE %s:%d\n", __FILE__, __LINE__) +#define TRACE() rtld_printf("TRACE %s:%d\n", __FILE__, __LINE__) extern int pagesize; @@ -503,7 +502,8 @@ int n; caddr_t addr = (caddr_t) (((long)pagepool_start + pagesz - 1) & ~(pagesz - 1)); if (munmap(addr, pagepool_end - addr) != 0) - warn("morepages: munmap %p", addr); + rtld_fdprintf(STDERR_FILENO, "morepages: munmap %p", + addr); } offset = (long)pagepool_start - ((long)pagepool_start & ~(pagesz - 1)); @@ -511,7 +511,7 @@ int n; if ((pagepool_start = mmap(0, n * pagesz, PROT_READ|PROT_WRITE, MAP_ANON|MAP_COPY, fd, 0)) == (caddr_t)-1) { - xprintf("Cannot map anonymous memory"); + rtld_printf("Cannot map anonymous memory\n"); return 0; } pagepool_end = pagepool_start + n * pagesz; @@ -522,18 +522,3 @@ int n; #endif return n; } - -/* - * Non-mallocing printf, for use by malloc itself. - */ -static void -xprintf(const char *fmt, ...) -{ - char buf[256]; - va_list ap; - - va_start(ap, fmt); - vsprintf(buf, fmt, ap); - (void)write(STDOUT_FILENO, buf, strlen(buf)); - va_end(ap); -} |