7.4 shared memory error on 64-bit SPARC/Solaris 5.8 - Mailing list pgsql-patches
From | Thomas Baden |
---|---|
Subject | 7.4 shared memory error on 64-bit SPARC/Solaris 5.8 |
Date | |
Msg-id | 20031119031744.48639.qmail@web60507.mail.yahoo.com Whole thread Raw |
Responses |
Re: 7.4 shared memory error on 64-bit SPARC/Solaris 5.8
Re: 7.4 shared memory error on 64-bit SPARC/Solaris 5.8 Re: 7.4 shared memory error on 64-bit SPARC/Solaris 5.8 |
List | pgsql-patches |
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 shmaddr); static void IpcMemoryDelete(int status, Datum shmId); 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 size) + InternalIpcMemoryCreate(IpcMemoryKey memKey, size_t size) { 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; #endif - 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); Cheers, -Thomas __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree
pgsql-patches by date: