mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.10 2009/05/05 21:51:46 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.11 2009/06/11 14:49:00 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -57,11 +57,11 @@ GetSharedMemName(void)
|
||||
elog(FATAL, "could not generate full pathname for datadir %s: %lu",
|
||||
DataDir, GetLastError());
|
||||
|
||||
/*
|
||||
/*
|
||||
* XXX: Intentionally overwriting the Global\ part here. This was not the
|
||||
* original approach, but putting it in the actual Global\ namespace
|
||||
* causes permission errors in a lot of cases, so we leave it in
|
||||
* the default namespace for now.
|
||||
* causes permission errors in a lot of cases, so we leave it in the
|
||||
* default namespace for now.
|
||||
*/
|
||||
for (cp = retptr; *cp; cp++)
|
||||
if (*cp == '\\')
|
||||
@ -135,19 +135,22 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
|
||||
/*
|
||||
* When recycling a shared memory segment, it may take a short while
|
||||
* before it gets dropped from the global namespace. So re-try after
|
||||
* sleeping for a second, and continue retrying 10 times.
|
||||
* (both the 1 second time and the 10 retries are completely arbitrary)
|
||||
* sleeping for a second, and continue retrying 10 times. (both the 1
|
||||
* second time and the 10 retries are completely arbitrary)
|
||||
*/
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
/* In case CreateFileMapping() doesn't set the error code to 0 on success */
|
||||
/*
|
||||
* In case CreateFileMapping() doesn't set the error code to 0 on
|
||||
* success
|
||||
*/
|
||||
SetLastError(0);
|
||||
|
||||
hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */
|
||||
NULL, /* Default security attrs */
|
||||
PAGE_READWRITE, /* Memory is Read/Write */
|
||||
hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */
|
||||
NULL, /* Default security attrs */
|
||||
PAGE_READWRITE, /* Memory is Read/Write */
|
||||
0L, /* Size Upper 32 Bits */
|
||||
(DWORD) size, /* Size Lower 32 bits */
|
||||
(DWORD) size, /* Size Lower 32 bits */
|
||||
szShareMem);
|
||||
|
||||
if (!hmap)
|
||||
@ -162,8 +165,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
|
||||
*/
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
CloseHandle(hmap); /* Close the handle, since we got a valid
|
||||
* one to the previous segment. */
|
||||
CloseHandle(hmap); /* Close the handle, since we got a valid one
|
||||
* to the previous segment. */
|
||||
hmap = NULL;
|
||||
Sleep(1000);
|
||||
continue;
|
||||
@ -177,8 +180,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
|
||||
*/
|
||||
if (!hmap)
|
||||
ereport(FATAL,
|
||||
(errmsg("pre-existing shared memory block is still in use"),
|
||||
errhint("Check if there are any old server processes still running, and terminate them.")));
|
||||
(errmsg("pre-existing shared memory block is still in use"),
|
||||
errhint("Check if there are any old server processes still running, and terminate them.")));
|
||||
|
||||
free(szShareMem);
|
||||
|
||||
|
Reference in New Issue
Block a user