Re: [HACKERS] problems with sunos4 port, endian? - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: [HACKERS] problems with sunos4 port, endian?
Date
Msg-id 4eae6bff222d35769fc998bbac7937ac
Whole thread Raw
In response to [HACKERS] problems with sunos4 port, endian?  (Chris McGonagle <pglist@FOUR.net>)
List pgsql-hackers
Thomas,

>Tatsuo Ishii wrote:
>> Here is a patch to fix the endian problem of 6.1. With this patch,
>> your big endian postgres server will begin to speak little endian as
>> 6.0!
>
>I have tested this patch on my Linux/i686/little-endian machine with
>v6.1 and it does not damage my already working installation.
>
>Tatsuo I. reports successful tests on several platforms. I vaguely
>recall that someone else reported success on a mixed-endian pair of
>platforms. Is there any reason to not introduce it into the source tree?
>
>If no one expresses reservations in the next couple of days, and if no
>one claims the job, I will go ahead and commit this to the source tree
>as a candidate change for the upcoming jumbo-patch.
>
>            - Tom
>
>btw, I used the patch which was re-posted by Tatsuo a couple of days ago
>and which included as new patch for postgres.h as well as the original
>patch for pqcomprim.c

Sorry. I forgot to explain about this.

pqcomprim.c goes into trouble if BYTE_ORDER macro is not properly
defined. For example, in the src/include/port/sparc_solaris.h there
are statements trying to define the value of BYTE_ORDER macro:

    #ifndef        BYTE_ORDER
    #define        BYTE_ORDER    BIG_ENDIAN
    #endif

Since sparc solaris does not have the endian.h, the value of
BIG_ENDIAN is not defined anywhere. As a result, following statement
in the pqcomprim.c:

    #if BYTE_ORDER == LITTLE_ENDIAN

always falls into true. The patch for postgres.h defines values of
BIG_ENDIAN, LITTLE_ENDIAN and PDP_ENDIAN if endian.h does not exist. I
a little bit hesitate to patch postgres.h. But I couldn'y find more
proper place.
- --
Tatsuo Ishii
t-ishii@sra.co.jp

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

pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] problems with sunos4 port, endian?
Next
From: Andrew Martin
Date:
Subject: Re: [HACKERS] Patch to psql.c to allow .psqlrc file