mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
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 *".
This commit is contained in:
parent
541ffa65c3
commit
81e8264383
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user