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

SunOS patch for memcmp()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: SunOS patch for memcmp()
Date: 2001-12-17 05:30:59
Message-ID: 200112170530.fBH5Uxq06554@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
> > SunOS        Tatsuo Ishii
> >               Are we giving up on this one? Still relevant?
> 
> What should we do? The only remaining issue is a non-8-bit-clean
> memcmp, which seems pretty easy to fix it.

OK, here is a patch to allow SunOS to pass the regression tests.  One
attachment is the patch, which is quite small except that the line
numbers in configure changed with autoconf, and that bloated the patch. 
The second attachment is the file memcmp.c which should be placed in
src/utils.  I got this from NetBSD.

I tested the patch several ways.  First I tested the regression tests
without the new memcmp().  Then I enabled the memcmp().  Thirdly, I had
the memcmp() always return '1' on non-equals rather than +/- 1, and saw
the same failures Tatuso saw.

One interesting item is that I had to compile with
backend/utils/adt/varbit.c with -fno-builtin because my gcc 2.X manual
says:

       -fno-builtin
              Don't  recognize built-in functions that do not be-
              gin with two leading underscores.   Currently,  the
              functions affected include _exit, abort, abs, allo-
              ca, cos, exit, fabs,  labs,  memcmp,  memcpy,  sin,
              sqrt, strcmp, strcpy, and strlen.

So if you don't give that flag on BSD/OS, the memcmp() is inlined and
never called.  Nice feature.  Tatsuo, is there a newer compiler for
SunOS that will do this and bypass the broken libc memcmp() on that
platform?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

Responses

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 2001-12-17 06:46:37
Subject: 7.2 is slow?
Previous:From: Doug McNaughtDate: 2001-12-17 05:06:22
Subject: Re: Explicit config patch 7.2B4

pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-12-17 07:43:48
Subject: Re: SunOS patch for memcmp()
Previous:From: Peter EisentrautDate: 2001-12-16 22:23:56
Subject: Re: [PATCHES] system catalog relation of a table and a

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