Skip site navigation (1) Skip section navigation (2)

Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-29 02:58:41
Message-ID: 200408290258.i7T2wfk16120@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-cygwinpgsql-patches
Your patch highlighted several bugs in our code.  First, I wasn't
testing for CYGWIN in the backend pgport_palloc code.  Second, I added
an #undef to prevent compiler warnings.  Third I added your Cygwin
includes with an #ifdef.  These will appear in beta2.

On the timezone issue, I see this in dt.h:
	
	/* Global variable holding time zone information. */
	#if !defined(__CYGWIN__) && !defined(WIN32)
	#define TIMEZONE_GLOBAL timezone
	#else
	#define TIMEZONE_GLOBAL _timezone
	#define tzname _tzname          /* should be in time.h? */
	#endif

so are you saying your _timezone is time_t and not an int?  Sometimes it
is just a short because it is only minutes west of GMT, not an actually
seconds since 1970 or anything.  Making it time_t actually sounds like
overkill, but we can work around that in dt.h if indeed that is how your
OS defines it.  The easiest fix would probably be to add the cast to int
right in dt.h and only for Cygwin:

	#define TIMEZONE_GLOBAL ((int)_timezone)

Does that work for you?

---------------------------------------------------------------------------

Reini Urban wrote:
> Attached patches are required for cygwin:
> 
> 2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> 	* (postmaster/syslogger.c) struct timeval is
>            declared in sys/time.h, not in time.h
> 
> 2004-08-24 20:20:54 rurban:
> 	* (port/dirmod.c) cygwin needs different header locations,
>            and unlink is a macro. There are no pgport_palloc
>            versions yet
> 
> 
> timezone/pgtz.c:
> Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
> PGAC_VAR_INT_TIMEZONE
> 
> In the meantime I've hacked it with a cast from time_t to (int) in
> timezone/pgtz.c: get_timezone_offset
> 
> but timezone really is of time_t, not int. I don't know what you are 
> trying to do here.
> 
> 
> There's on remaining issue for the cygwin build:
> ../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined 
> reference to `__imp__CurrentMemoryContext'
> ../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined 
> reference to `__imp__CurrentMemoryContext'
> 
> which explains the pgport_palloc problem.
> -- 
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
> 

> 2004-08-24 20:20:54 rurban: 
> 	* cygwin needs different header locations, and unlink is a macro
>  	* There are no pgport_palloc versions yet
> 
> --- postgresql-8.0.0beta1/src/port/dirmod.c.orig	2004-08-08 07:44:36.000000000 +0100
> +++ postgresql-8.0.0beta1/src/port/dirmod.c	2004-08-24 19:20:56.557435000 +0100
> @@ -33,16 +33,28 @@
>  
>  
>  #include "miscadmin.h"
> +
> +#ifdef __CYGWIN__
> +#include <windows.h>
> +#include <w32api/winioctl.h>
> +#else
>  #include <winioctl.h>
> +#undef unlink
> +#endif
>  
>  #undef rename
> -#undef unlink
>  
> +/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
> +#if 0 
>  #ifndef FRONTEND
> +#undef palloc
> +#undef pstrdup
> +#undef pfree
>  #define palloc(sz)	pgport_palloc(sz)
>  #define pstrdup(str)	pgport_pstrdup(str)
>  #define pfree(pointer)	pgport_pfree(pointer)
>  #endif
> +#endif
>  
>  
>  /*

> 2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> 	* struct timeval is declared in sys/time.h, not in time.h
> 
> --- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig	2004-08-06 20:17:31.000000000 +0100
> +++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c	2004-08-24 20:21:26.057851800 +0100
> @@ -28,6 +28,7 @@
>  #include <signal.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <sys/time.h>
>  #include <sys/stat.h>
>  
>  #include "libpq/pqsignal.h"

> --- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig	2004-07-31 20:12:15.000000000 +0100
> +++ postgresql-8.0.0beta1/src/timezone/pgtz.c	2004-08-24 19:56:30.686367800 +0100
> @@ -97,9 +97,9 @@
>  	return tm->tm_gmtoff;
>  #elif defined(HAVE_INT_TIMEZONE)
>  #ifdef HAVE_UNDERSCORE_TIMEZONE
> -	return -_timezone;
> +	return -(int)_timezone;
>  #else
> -	return -timezone;
> +	return -(int)timezone;
>  #endif
>  #else
>  #error No way to determine TZ? Can this happen?

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-cygwin by date

Next:From: Reini UrbanDate: 2004-08-29 10:49:50
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Previous:From: Reini UrbanDate: 2004-08-28 10:09:13
Subject: Re: postgresql-7.4.5-1 ready for review

pgsql-patches by date

Next:From: Bruce MomjianDate: 2004-08-29 03:04:35
Subject: Re: add hint
Previous:From: Serguei MokhovDate: 2004-08-29 01:23:04
Subject: Translation updates for 7.4/8.0: postgres-ru

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group