Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2019 15:43:26 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349417 - head/libexec/rtld-elf
Message-ID:  <201906261543.x5QFhQ7B024853@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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, ...)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906261543.x5QFhQ7B024853>