Commit 81e82643 authored by Tom Lane's avatar Tom Lane

Declare AnonymousShmem pointer as "void *".

The original coding had it as "PGShmemHeader *", but that doesn't offer any
notational benefit because we don't dereference it.  And it was resulting
in compiler warnings on some platforms, notably buildfarm member
castoroides, where mmap() and munmap() are evidently declared to take and
return "char *".
parent 541ffa65
......@@ -65,7 +65,7 @@ typedef int IpcMemoryId; /* shared memory ID returned by shmget(2) */
unsigned long UsedShmemSegID = 0;
void *UsedShmemSegAddr = NULL;
static Size AnonymousShmemSize;
static PGShmemHeader *AnonymousShmem;
static void *AnonymousShmem;
static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size);
static void IpcMemoryDetach(int status, Datum shmaddr);
......@@ -382,7 +382,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
PGShmemHeader *hdr;
IpcMemoryId shmid;
struct stat statbuf;
Size allocsize = size;
Size sysvsize = size;
/* Room for a header? */
Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
......@@ -440,7 +440,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
AnonymousShmemSize = size;
/* Now we need only allocate a minimal-sized SysV shmem block. */
allocsize = sizeof(PGShmemHeader);
sysvsize = sizeof(PGShmemHeader);
}
#endif
......@@ -453,7 +453,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
for (NextShmemSegID++;; NextShmemSegID++)
{
/* Try to create new segment */
memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize);
memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize);
if (memAddress)
break; /* successful create and attach */
......@@ -492,7 +492,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
/*
* Now try again to create the segment.
*/
memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize);
memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize);
if (memAddress)
break; /* successful create and attach */
......@@ -540,8 +540,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
if (AnonymousShmem == NULL)
return hdr;
memcpy(AnonymousShmem, hdr, sizeof(PGShmemHeader));
return AnonymousShmem;
return (PGShmemHeader *) AnonymousShmem;
}
#ifdef EXEC_BACKEND
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment