From a93dc2526d3248d115c5ff9ea8ea2a4dc57e7648 Mon Sep 17 00:00:00 2001 From: Benoit Dejean Date: Sat, 28 Feb 2015 00:20:28 +0100 Subject: [PATCH] The DEBUG macro enabled by --enable-debug is actually LIBGTOP_ENABLE_DEBUG. --- lib/command.c | 2 +- lib/open.c | 16 ++++++++-------- lib/read.c | 2 +- lib/read_data.c | 4 ++-- lib/write.c | 2 +- src/daemon/io.c | 6 +++--- src/daemon/main.c | 4 ++-- src/daemon/version.c | 2 +- sysdeps/bsd/open.c | 2 +- sysdeps/freebsd/suid_open.c | 2 +- sysdeps/openbsd/suid_open.c | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/command.c b/lib/command.c index 00297b09..9342fd65 100644 --- a/lib/command.c +++ b/lib/command.c @@ -52,7 +52,7 @@ glibtop_call_l (glibtop *server, unsigned command, size_t send_size, glibtop_read_l (server, sizeof (glibtop_response), &response); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "RESPONSE: %lu - %d\n", response.offset, response.data_size); #endif diff --git a/lib/open.c b/lib/open.c index dbce2287..a3d4fdd6 100644 --- a/lib/open.c +++ b/lib/open.c @@ -47,7 +47,7 @@ glibtop_open_l (glibtop *server, const char *program_name, server->error_method = GLIBTOP_ERROR_METHOD_DEFAULT; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "SIZEOF: %u - %u - %u - %u - %u - %u\n", sizeof (glibtop_command), sizeof (glibtop_response), sizeof (glibtop_mountentry), sizeof (glibtop_union), @@ -59,7 +59,7 @@ glibtop_open_l (glibtop *server, const char *program_name, server->features = 0; break; case GLIBTOP_METHOD_INET: -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Connecting to '%s' port %ld.\n", server->server_host, server->server_port); #endif @@ -68,7 +68,7 @@ glibtop_open_l (glibtop *server, const char *program_name, (server->server_host, server->server_port, &server->socket); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Connect Type is %d.\n", connect_type); #endif @@ -77,14 +77,14 @@ glibtop_open_l (glibtop *server, const char *program_name, server->features = -1; break; case GLIBTOP_METHOD_UNIX: -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Connecting to Unix Domain Socket.\n"); #endif connect_type = glibtop_make_connection ("unix", 0, &server->socket); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Connect Type is %d.\n", connect_type); #endif @@ -93,7 +93,7 @@ glibtop_open_l (glibtop *server, const char *program_name, server->features = -1; break; case GLIBTOP_METHOD_PIPE: -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Opening pipe to server (%s).\n", LIBGTOP_SERVER); #endif @@ -165,7 +165,7 @@ glibtop_open_l (glibtop *server, const char *program_name, memcpy (&server->sysdeps, &sysdeps, sizeof (glibtop_sysdeps)); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Server features are %lu.\n", server->features); #endif @@ -174,7 +174,7 @@ glibtop_open_l (glibtop *server, const char *program_name, /* In any case, we call the open functions of our own sysdeps * directory. */ -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Calling sysdeps open function.\n"); #endif diff --git a/lib/read.c b/lib/read.c index ba1bc42c..fb2ca491 100644 --- a/lib/read.c +++ b/lib/read.c @@ -33,7 +33,7 @@ glibtop_read_l (glibtop *server, size_t size, void *buf) int fd; glibtop_init_r (&server, 0, 0); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "LIBRARY: really reading %d bytes.\n", (int)size); #endif diff --git a/lib/read_data.c b/lib/read_data.c index e089b981..95880647 100644 --- a/lib/read_data.c +++ b/lib/read_data.c @@ -36,7 +36,7 @@ glibtop_read_data_l (glibtop *server) glibtop_init_r (&server, 0, 0); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "LIBRARY: reading %lu data bytes.\n", (unsigned long) sizeof (size_t)); #endif @@ -50,7 +50,7 @@ glibtop_read_data_l (glibtop *server) if (ret < 0) glibtop_error_io_r (server, _("read data size")); -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "LIBRARY: really reading %lu data bytes (ret = %d).\n", (unsigned long) size, ret); #endif diff --git a/lib/write.c b/lib/write.c index d11d3d7b..eb1b9b74 100644 --- a/lib/write.c +++ b/lib/write.c @@ -37,7 +37,7 @@ glibtop_write_l (glibtop *server, size_t size, void *buf) if (size == 0) return; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "LIBRARY: really writing %d bytes.\n", (int)size); #endif diff --git a/src/daemon/io.c b/src/daemon/io.c index 15365b9e..bcc3afeb 100644 --- a/src/daemon/io.c +++ b/src/daemon/io.c @@ -27,7 +27,7 @@ void do_output (int s, glibtop_response *resp, off_t offset, size_t data_size, const void *data) { -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Really writing %d bytes at offset %lu.\n", sizeof (glibtop_response), offset); #endif @@ -44,7 +44,7 @@ do_output (int s, glibtop_response *resp, off_t offset, } if (resp->data_size) { -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size); #endif @@ -88,7 +88,7 @@ do_read (int s, void *ptr, size_t total_size) tmp_ptr += nread; ptr = tmp_ptr; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "READ (%d): %d - %d - %d\n", nread, already_read, remaining, total_size); #endif diff --git a/src/daemon/main.c b/src/daemon/main.c index d21cda61..38f0c889 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -26,8 +26,8 @@ #ifndef PARENT_DEBUG #define PARENT_DEBUG 1 #endif -#ifndef DEBUG -#define DEBUG 1 +#ifndef LIBGTOP_ENABLE_DEBUG +#define LIBGTOP_ENABLE_DEBUG 1 #endif #endif diff --git a/src/daemon/version.c b/src/daemon/version.c index c559c4c8..28cbf79a 100644 --- a/src/daemon/version.c +++ b/src/daemon/version.c @@ -42,7 +42,7 @@ glibtop_send_version (glibtop *server, int fd) size = strlen (buffer) + 1; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "SERVER ID: |%s|\n", buffer); #endif diff --git a/sysdeps/bsd/open.c b/sysdeps/bsd/open.c index a375772a..b8608c69 100644 --- a/sysdeps/bsd/open.c +++ b/sysdeps/bsd/open.c @@ -52,7 +52,7 @@ glibtop_open_p (glibtop *server, const char *program_name, const unsigned long features, const unsigned flags) { -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ()); #endif diff --git a/sysdeps/freebsd/suid_open.c b/sysdeps/freebsd/suid_open.c index 13931d37..96bf7f49 100644 --- a/sysdeps/freebsd/suid_open.c +++ b/sysdeps/freebsd/suid_open.c @@ -56,7 +56,7 @@ glibtop_open_p (glibtop *server, const char *program_name, const unsigned flags) { char errbuf[_POSIX2_LINE_MAX]; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ()); #endif diff --git a/sysdeps/openbsd/suid_open.c b/sysdeps/openbsd/suid_open.c index 8eb1c93a..a76562f1 100644 --- a/sysdeps/openbsd/suid_open.c +++ b/sysdeps/openbsd/suid_open.c @@ -56,7 +56,7 @@ glibtop_open_p (glibtop *server, const char *program_name, const unsigned flags) { char errbuf[_POSIX2_LINE_MAX]; -#ifdef DEBUG +#ifdef LIBGTOP_ENABLE_DEBUG fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ()); #endif