changes to support logging

Started by Andrew Dunstanover 22 years ago3 messages
#1Andrew Dunstan
andrew@dunslane.net

To support some of the logging changes I'm working on, I propose to add
the following members to struct Port, unless anyone objects - these are
all calculated in postmaster/postmaster.c:

struct tm session_start;
char * remote_host;
char * remote_port;

Question: In setting these is it better to call strdup() or pstrdup() -
the code comments aren't entirely clear on that.

Another thing:

I've noticed an inconsistency in calls to gettimeofday(): sometimes it
is passed a struct tz (which is ignored) as the second argument, and
sometimes NULL as the second argument. My understanding is that the
second argument is basically useless anyway - on my Linux box man
gettimeofday says this:

The use of the timezone struct is obsolete; the tz_dsttime field has
never been used under Linux - it has not been and will not be supported
by libc or glibc.

I therefore propose to clean this up in the following places:

backend/commands/vacuum.c
backend/utils/adt/nabstime.c
backend/postmaster/postmaster.c (3)

(I know it's a minor nit, but what the heck?)

cheers

andrew

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: changes to support logging

Andrew Dunstan <andrew@dunslane.net> writes:

I've noticed an inconsistency in calls to gettimeofday(): sometimes it
is passed a struct tz (which is ignored) as the second argument, and
sometimes NULL as the second argument. My understanding is that the
second argument is basically useless anyway - on my Linux box man
gettimeofday says this:

You are confusing the second argument with something else (a field in
the first argument struct). However, if we're assuming that NULL works
in some places, we may as well use it everywhere that it makes sense.

regards, tom lane

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: changes to support logging

I should have said "struct timezone' instead of 'struct tz' (ain't no
such animal). But the first argument is a struct timeval *, which has
no reference to a timezone.

Anyway - pointless to argue - I'll make the changes. NULL should work:
the man page says this:

If either tv or tz is null, the corresponding structure is not set

cheers

andrew

Tom Lane wrote:

Show quoted text

Andrew Dunstan <andrew@dunslane.net> writes:

I've noticed an inconsistency in calls to gettimeofday(): sometimes it
is passed a struct tz (which is ignored) as the second argument, and
sometimes NULL as the second argument. My understanding is that the
second argument is basically useless anyway - on my Linux box man
gettimeofday says this:

You are confusing the second argument with something else (a field in
the first argument struct). However, if we're assuming that NULL works
in some places, we may as well use it everywhere that it makes sense.

regards, tom lane