Re: Problem with ControlFileData structure being ABI dependent

From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Rainer Bauer <usenet(at)munnin(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with ControlFileData structure being ABI dependent
Date: 2007-12-07 11:27:35
Message-ID: 47592E27.7000802@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> AFAIK, time_t is a Unix-ism, so it's pretty unlikely to be used in the
> APIs of anything on Windows.

Oh, it is.

> I guess my advice would be to see if we can define _USE_32BIT_TIME_T
> in port/win32.h and make it go away that way. It'd definitely be nice
> if MSVC and Mingw builds weren't binary-incompatible.

The attached patch defines it in the MSVC project files along with the
other API-config related macros. It fixes all the offsets so they match
mingw, but the CRC is still different for some as-yet unknown reason...

VC++ with patch:

WARNING: sizeof(ControlFileData)=392
WARNING: offsetof(state)=16
WARNING: offsetof(time)=20
WARNING: offsetof(checkPoint)=24
WARNING: offsetof(prevCheckPoint)=32
WARNING: offsetof(checkPointCopy)=40
WARNING: offsetof(minRecoveryPoint)=76
WARNING: offsetof(maxAlign)=84
WARNING: offsetof(floatFormat)=88
WARNING: offsetof(blcksz)=96
WARNING: offsetof(relseg)=100
WARNING: offsetof(xlog)=104
WARNING: offsetof(xlog)=108
WARNING: offsetof(nameDataLen)=112
WARNING: offsetof(indexMaxKeys)=116
WARNING: offsetof(toast)=120
WARNING: offsetof(enableIntTimes)=124
WARNING: offsetof(localeBuflen)=128
WARNING: offsetof(lc)=132
WARNING: offsetof(lc)=260
WARNING: offsetof(crc)=388
WARNING: crc = 2265484434

Mingw:

WARNING: sizeof(ControlFileData)=392
WARNING: offsetof(state)=16
WARNING: offsetof(time)=20
WARNING: offsetof(checkPoint)=24
WARNING: offsetof(prevCheckPoint)=32
WARNING: offsetof(checkPointCopy)=40
WARNING: offsetof(minRecoveryPoint)=76
WARNING: offsetof(maxAlign)=84
WARNING: offsetof(floatFormat)=88
WARNING: offsetof(blcksz)=96
WARNING: offsetof(relseg)=100
WARNING: offsetof(xlog)=104
WARNING: offsetof(xlog)=108
WARNING: offsetof(nameDataLen)=112
WARNING: offsetof(indexMaxKeys)=116
WARNING: offsetof(toast)=120
WARNING: offsetof(enableIntTimes)=124
WARNING: offsetof(localeBuflen)=128
WARNING: offsetof(lc)=132
WARNING: offsetof(lc)=260
WARNING: offsetof(crc)=388
WARNING: crc = 3643130025

/D

Attachment Content-Type Size
32bit-time_t.diff text/x-patch 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2007-12-07 11:49:28 Re: Problem with ControlFileData structure being ABI dependent
Previous Message Albert Cervera i Areny 2007-12-07 07:51:59 Re: "distributed checkpoint"