aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1999-06-05 04:18:09 +0000
committerMarc G. Fournier <scrappy@hub.org>1999-06-05 04:18:09 +0000
commit93b57eb53383372cd21d9063e8657752a5ed0d51 (patch)
tree06d366077a6e72a31c999eb2d87c75d4733575c8
parentdbaab4a4d42f09148dcdb55f3a1912458f250f20 (diff)
downloadpostgresql-93b57eb53383372cd21d9063e8657752a5ed0d51.tar.gz
postgresql-93b57eb53383372cd21d9063e8657752a5ed0d51.zip
trace.patch (compilation error)
the gettimeofday doesn't compile under Linux with glibc2 because the DST_NONE constant is no more defined. It seems that this code (written by me) has always be wrong but for some reason working. From: Massimo Dal Zotto <dz@cs.unitn.it>
-rw-r--r--src/backend/utils/misc/trace.c14
-rw-r--r--src/include/utils/trace.h6
2 files changed, 9 insertions, 11 deletions
diff --git a/src/backend/utils/misc/trace.c b/src/backend/utils/misc/trace.c
index 04bb063e3b2..9676ca570a0 100644
--- a/src/backend/utils/misc/trace.c
+++ b/src/backend/utils/misc/trace.c
@@ -11,10 +11,10 @@
#include <stdio.h>
#include <string.h>
-#include <time.h>
#include <stdarg.h>
#include <unistd.h>
#include <signal.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -47,7 +47,7 @@
* Trace option names, must match the constants in trace_opts[].
*/
static char *opt_names[] = {
- "all",
+ "all", /* 0=trace some, 1=trace all, -1=trace none */
"verbose",
"query",
"plan",
@@ -73,6 +73,8 @@ static char *opt_names[] = {
"syslog", /* use syslog for error messages */
"hostlookup", /* enable hostname lookup in ps_status */
"showportnumber", /* show port number in ps_status */
+
+ /* NUM_PG_OPTIONS */ /* must be the last item of enum */
};
/*
@@ -92,7 +94,6 @@ tprintf(int flag, const char *fmt,...)
#ifdef USE_SYSLOG
int log_level;
-
#endif
if ((flag == TRACE_ALL) || (pg_options[TRACE_ALL] > 0))
@@ -208,7 +209,6 @@ write_syslog(int level, char *line)
syslog(level, "%s", line);
}
}
-
#endif
#ifdef ELOG_TIMESTAMPS
@@ -219,12 +219,13 @@ char *
tprintf_timestamp()
{
struct timeval tv;
+ struct timezone tz = { 0, 0 };
struct tm *time;
time_t tm;
static char timestamp[32],
pid[8];
- gettimeofday(&tv, DST_NONE);
+ gettimeofday(&tv, &tz);
tm = tv.tv_sec;
time = localtime(&tm);
@@ -232,11 +233,10 @@ tprintf_timestamp()
sprintf(timestamp, "%02d%02d%02d.%02d:%02d:%02d.%03d %7s ",
time->tm_year, time->tm_mon + 1, time->tm_mday,
time->tm_hour, time->tm_min, time->tm_sec,
- tv.tv_usec / 1000, pid);
+ (int) (tv.tv_usec/1000), pid);
return timestamp;
}
-
#endif
#ifdef NOT_USED
diff --git a/src/include/utils/trace.h b/src/include/utils/trace.h
index 1ec2fd480cf..3174026ca5c 100644
--- a/src/include/utils/trace.h
+++ b/src/include/utils/trace.h
@@ -37,10 +37,8 @@ extern void read_pg_options(SIGNAL_ARGS);
* Trace options, used as index into pg_options.
* Must match the constants in pg_options[].
*/
-enum pg_option_enum
-{
- TRACE_ALL, /* 0=trace some, 1=trace all, -1=trace
- * none */
+enum pg_option_enum {
+ TRACE_ALL, /* 0=trace some, 1=trace all, -1=trace none */
TRACE_VERBOSE,
TRACE_QUERY,
TRACE_PLAN,