Hi there.  My install was failing the regression tests
due to a shared memory error.

I'm running Solaris 5.8, YASSP, and I am using the Sun
Forte 7 compiler suite generating 64-bit code.

I did some digging around, and it turns out that the
IpcMemoryKey is a 64-bit number.  The source code uses
uint32.  Changing this to a size_t fixes the problem
under Solaris.  I don't know whether this would break
other systems.  Anyway, here's the fix:

I don't have the GNU diff, so please forgive the
crudeness of the following.

in file postgresql-7.4/src/backend/port/sysv_shmem.c,
lines 42-48:
  IpcMemoryKey UsedShmemSegID = 0;
  void     *UsedShmemSegAddr = NULL;

- static void *InternalIpcMemoryCreate(IpcMemoryKey
memKey, uint32 size);
+ static void *InternalIpcMemoryCreate(IpcMemoryKey
memKey, size_t size);
  static void IpcMemoryDetach(int status, Datum
  static void IpcMemoryDelete(int status, Datum
  static PGShmemHeader
*PGSharedMemoryAttach(IpcMemoryKey key,

in file postgresql-7.4/src/backend/port/sysv_shmem.c,
lines 62-68:
   * print out an error and abort.  Other types of
errors are not recoverable.
  static void *
- InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32
+ InternalIpcMemoryCreate(IpcMemoryKey memKey, size_t
        IpcMemoryId shmid;
        void       *memAddress;

in file postgresql-7.4/src/backend/port/sysv_shmem.c,
lines 234-240:
   * zero will be passed.
  PGShmemHeader *
- PGSharedMemoryCreate(uint32 size, bool makePrivate,
int port)
+ PGSharedMemoryCreate(size_t size, bool makePrivate,
int port)
        IpcMemoryKey NextShmemSegID;
        void       *memAddress;

in file postgresql-7.4/src/include/storage/pg_shmem.h,
lines 24-30:
  #ifndef PG_SHMEM_H
  #define PG_SHMEM_H

- typedef uint32 IpcMemoryKey;  /* shared memory key
passed to shmget(2) */
+ typedef size_t IpcMemoryKey;  /* shared memory key
passed to shmget(2) */

  typedef struct PGShmemHeader  /* standard header for
all Postgres shmem */

in file postgresql-7.4/src/include/storage/pg_shmem.h,
lines 41-47:
  extern void *UsedShmemSegAddr;

- extern PGShmemHeader *PGSharedMemoryCreate(uint32
size, bool makePrivate,
+ extern PGShmemHeader *PGSharedMemoryCreate(size_t
size, bool makePrivate,
                                         int port);
  extern bool PGSharedMemoryIsInUse(unsigned long id1,
unsigned long id2);
  extern void PGSharedMemoryDetach(void);


Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to