svn commit: r349417 - head/libexec/rtld-elf

Alex Richardson arichardson at FreeBSD.org
Wed Jun 26 15:43:29 UTC 2019


Author: arichardson
Date: Wed Jun 26 15:43:26 2019
New Revision: 349417
URL: https://svnweb.freebsd.org/changeset/base/349417

Log:
  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.

Modified:
  head/libexec/rtld-elf/debug.h
  head/libexec/rtld-elf/rtld_printf.h

Modified: head/libexec/rtld-elf/debug.h
==============================================================================
--- head/libexec/rtld-elf/debug.h	Wed Jun 26 15:43:20 2019	(r349416)
+++ head/libexec/rtld-elf/debug.h	Wed Jun 26 15:43:26 2019	(r349417)
@@ -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")
 
 

Modified: head/libexec/rtld-elf/rtld_printf.h
==============================================================================
--- head/libexec/rtld-elf/rtld_printf.h	Wed Jun 26 15:43:20 2019	(r349416)
+++ head/libexec/rtld-elf/rtld_printf.h	Wed Jun 26 15:43:26 2019	(r349417)
@@ -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, ...)


More information about the svn-src-all mailing list