Use rtld_putstr() instead of write() for the rtld msg() macro

This removes an unnecessary libc dependency from rtld.
See https://reviews.freebsd.org/D20663 for more details.
This commit is contained in:
Alex Richardson 2019-06-26 15:43:26 +00:00
parent df5e392483
commit e69dc8626a
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#include <string.h>
#include <unistd.h>
#include "rtld_printf.h"
void debug_printf(const char *, ...) __printflike(1, 2);
extern int debug;
@ -57,7 +57,7 @@ extern int debug;
#define assert(cond) ((cond) ? (void) 0 : \
(msg(_MYNAME ": assert failed: " __FILE__ ":" \
__XSTRING(__LINE__) "\n"), abort()))
#define msg(s) write(STDOUT_FILENO, s, strlen(s))
#define msg(s) rtld_putstr(s)
#define trace() msg(_MYNAME ": " __XSTRING(__LINE__) "\n")

View File

@ -31,6 +31,7 @@
#define RTLD_PRINTF_H 1
#include <sys/cdefs.h>
#include <stdarg.h>
#include <unistd.h>
int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...)