summary refs log tree commit diff
path: root/elf/dl-misc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-10 18:04:16 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-10 18:04:16 +0000
commit8193034b1d0e3760dadb06b891a22cd4631c675a (patch)
treee1e1a283d6e2e1d9c10f2fed93d354d29a485a3a /elf/dl-misc.c
parent62c349c632dca31385304164ffcd6ca7b9f360cc (diff)
downloadglibc-8193034b1d0e3760dadb06b891a22cd4631c675a.tar.gz
glibc-8193034b1d0e3760dadb06b891a22cd4631c675a.tar.xz
glibc-8193034b1d0e3760dadb06b891a22cd4631c675a.zip
Update.
1998-03-10 17:54  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Add _dl_debug_message.
	* elf/dl-misc.c: Make _dl_debug_message a function.  Print the PID
	before every line.
	* elf/fini.c: Correctly use new _dl_debug_message function.
	* elf/init.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* sysdeps/unix/sysv/linux/libc-start.c: Likewise.
	* elf/dl-load.c: Likewise.  Add more debugging prints.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/dl-support.c: Add variables for debugging.
	* elf/rtld.c: Likewise.  Recognize new debug options.
	* elf/link.h: Declare new variables.

	* elf/dl-deps.c (_dl_map_object_deps): Little optimizations.

	* sysdeps/unix/sysv/linux/sys/quota.h: Extract information from
	kernel headers.  Patch by a sun <asun@saul7.u.washington.edu>.

1998-03-11 00:16  Tim Waugh  <tim@cyberelk.demon.co.uk>

	* posix/wordexp-test.c (command_line_test): New function to allow
	testing of specific cases from the command-line.

1998-03-10  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-init.c (_dl_init_next): Print nicer messages.
	* elf/dl-fini.c (_dl_fini): Likewise.
	* sysdeps/unix/sysv/linux/libc-start.c (__libc_start_main): Likewise.
Diffstat (limited to 'elf/dl-misc.c')
-rw-r--r--elf/dl-misc.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index 90288525f4..1e13d0d28a 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -22,8 +22,10 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
+#include <stdio-common/_itoa.h>
 
 #ifndef MAP_ANON
 /* This is the only dl-sysdep.c function that is actually needed at run-time
@@ -89,6 +91,54 @@ _dl_sysdep_output (int fd, const char *msg, ...)
       size_t len = strlen (msg);
       __write (fd, msg, len);
       msg = va_arg (ap, const char *);
-    } while (msg);
+    }
+  while (msg != NULL);
+  va_end (ap);
+}
+
+
+void
+_dl_debug_message (int new_line, const char *msg, ...)
+{
+  /* We print the strings we get passed one after the other but start all
+     lines using the current PID.  */
+  static int pid;
+  va_list ap;
+
+  if (pid == 0)
+    pid = getpid ();
+
+  va_start (ap, msg);
+  do
+    if (msg[0] == '\0')
+      /* Get the next argument.  */
+      msg = va_arg (ap, const char *);
+    else
+      {
+	const char *endp;
+
+	/* We actually will print something in this line.  So print the
+	   PID now if needed.  */
+	if (new_line)
+	  {
+	    char buf[7] = "00000:\t";
+	    __write (_dl_debug_fd, _itoa_word (pid, &buf[5], 10, 0), 7);
+	    new_line = 0;
+	  }
+
+	endp = strchr (msg, '\n');
+	if (endp == NULL)
+	  {
+	    __write (_dl_debug_fd, msg, strlen (msg));
+	    msg = va_arg (ap, const char *);
+	  }
+	else
+	  {
+	    __write (_dl_debug_fd, msg, endp - msg + 1);
+	    msg = endp + 1;
+	    new_line = 1;
+	  }
+      }
+  while (msg != NULL);
   va_end (ap);
 }