Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 93b57eb

Browse files
committed
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>
1 parent dbaab4a commit 93b57eb

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/backend/utils/misc/trace.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
#include <stdio.h>
1313
#include <string.h>
14-
#include <time.h>
1514
#include <stdarg.h>
1615
#include <unistd.h>
1716
#include <signal.h>
17+
#include <sys/time.h>
1818
#include <sys/types.h>
1919
#include <sys/stat.h>
2020
#include <fcntl.h>
@@ -47,7 +47,7 @@
4747
* Trace option names, must match the constants in trace_opts[].
4848
*/
4949
static char *opt_names[] = {
50-
"all",
50+
"all", /* 0=trace some, 1=trace all, -1=trace none */
5151
"verbose",
5252
"query",
5353
"plan",
@@ -73,6 +73,8 @@ static char *opt_names[] = {
7373
"syslog", /* use syslog for error messages */
7474
"hostlookup", /* enable hostname lookup in ps_status */
7575
"showportnumber", /* show port number in ps_status */
76+
77+
/* NUM_PG_OPTIONS */ /* must be the last item of enum */
7678
};
7779

7880
/*
@@ -92,7 +94,6 @@ tprintf(int flag, const char *fmt,...)
9294

9395
#ifdef USE_SYSLOG
9496
int log_level;
95-
9697
#endif
9798

9899
if ((flag == TRACE_ALL) || (pg_options[TRACE_ALL] > 0))
@@ -208,7 +209,6 @@ write_syslog(int level, char *line)
208209
syslog(level, "%s", line);
209210
}
210211
}
211-
212212
#endif
213213

214214
#ifdef ELOG_TIMESTAMPS
@@ -219,24 +219,24 @@ char *
219219
tprintf_timestamp()
220220
{
221221
struct timeval tv;
222+
struct timezone tz = { 0, 0 };
222223
struct tm *time;
223224
time_t tm;
224225
static char timestamp[32],
225226
pid[8];
226227

227-
gettimeofday(&tv, DST_NONE);
228+
gettimeofday(&tv, &tz);
228229
tm = tv.tv_sec;
229230
time = localtime(&tm);
230231

231232
sprintf(pid, "[%d]", MyProcPid);
232233
sprintf(timestamp, "%02d%02d%02d.%02d:%02d:%02d.%03d %7s ",
233234
time->tm_year, time->tm_mon + 1, time->tm_mday,
234235
time->tm_hour, time->tm_min, time->tm_sec,
235-
tv.tv_usec / 1000, pid);
236+
(int) (tv.tv_usec/1000), pid);
236237

237238
return timestamp;
238239
}
239-
240240
#endif
241241

242242
#ifdef NOT_USED

src/include/utils/trace.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ extern void read_pg_options(SIGNAL_ARGS);
3737
* Trace options, used as index into pg_options.
3838
* Must match the constants in pg_options[].
3939
*/
40-
enum pg_option_enum
41-
{
42-
TRACE_ALL, /* 0=trace some, 1=trace all, -1=trace
43-
* none */
40+
enum pg_option_enum {
41+
TRACE_ALL, /* 0=trace some, 1=trace all, -1=trace none */
4442
TRACE_VERBOSE,
4543
TRACE_QUERY,
4644
TRACE_PLAN,

0 commit comments

Comments
 (0)