aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/dsm_impl.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2014-05-06 12:12:18 -0400
committerBruce Momjian <bruce@momjian.us>2014-05-06 12:12:18 -0400
commit0a7832005792fa6dad171f9cadb8d587fe0dd800 (patch)
tree365cfc42c521a52607e41394b08ef44d338d8fc1 /src/backend/storage/ipc/dsm_impl.c
parentfb85cd4320414c3f6e9c8bc69ec944200ae1e493 (diff)
downloadpostgresql-0a7832005792fa6dad171f9cadb8d587fe0dd800.tar.gz
postgresql-0a7832005792fa6dad171f9cadb8d587fe0dd800.zip
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
Diffstat (limited to 'src/backend/storage/ipc/dsm_impl.c')
-rw-r--r--src/backend/storage/ipc/dsm_impl.c323
1 files changed, 162 insertions, 161 deletions
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c
index fa253f0af53..74dace999ef 100644
--- a/src/backend/storage/ipc/dsm_impl.c
+++ b/src/backend/storage/ipc/dsm_impl.c
@@ -76,40 +76,40 @@ static bool dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
#endif
#ifdef USE_DSM_SYSV
static bool dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
- void **impl_private, void **mapped_address,
- Size *mapped_size, int elevel);
+ void **impl_private, void **mapped_address,
+ Size *mapped_size, int elevel);
#endif
#ifdef USE_DSM_WINDOWS
static bool dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
- void **impl_private, void **mapped_address,
- Size *mapped_size, int elevel);
+ void **impl_private, void **mapped_address,
+ Size *mapped_size, int elevel);
#endif
#ifdef USE_DSM_MMAP
static bool dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
Size *mapped_size, int elevel);
#endif
-static int errcode_for_dynamic_shared_memory(void);
+static int errcode_for_dynamic_shared_memory(void);
const struct config_enum_entry dynamic_shared_memory_options[] = {
#ifdef USE_DSM_POSIX
- { "posix", DSM_IMPL_POSIX, false},
+ {"posix", DSM_IMPL_POSIX, false},
#endif
#ifdef USE_DSM_SYSV
- { "sysv", DSM_IMPL_SYSV, false},
+ {"sysv", DSM_IMPL_SYSV, false},
#endif
#ifdef USE_DSM_WINDOWS
- { "windows", DSM_IMPL_WINDOWS, false},
+ {"windows", DSM_IMPL_WINDOWS, false},
#endif
#ifdef USE_DSM_MMAP
- { "mmap", DSM_IMPL_MMAP, false},
+ {"mmap", DSM_IMPL_MMAP, false},
#endif
- { "none", DSM_IMPL_NONE, false},
+ {"none", DSM_IMPL_NONE, false},
{NULL, 0, false}
};
/* Implementation selector. */
-int dynamic_shared_memory_type;
+int dynamic_shared_memory_type;
/* Size of buffer to be used for zero-filling. */
#define ZBUFFER_SIZE 8192
@@ -137,20 +137,20 @@ int dynamic_shared_memory_type;
* segment.
*
* Arguments:
- * op: The operation to be performed.
- * handle: The handle of an existing object, or for DSM_OP_CREATE, the
- * a new handle the caller wants created.
- * request_size: For DSM_OP_CREATE, the requested size. For DSM_OP_RESIZE,
- * the new size. Otherwise, 0.
- * impl_private: Private, implementation-specific data. Will be a pointer
- * to NULL for the first operation on a shared memory segment within this
- * backend; thereafter, it will point to the value to which it was set
- * on the previous call.
- * mapped_address: Pointer to start of current mapping; pointer to NULL
- * if none. Updated with new mapping address.
- * mapped_size: Pointer to size of current mapping; pointer to 0 if none.
- * Updated with new mapped size.
- * elevel: Level at which to log errors.
+ * op: The operation to be performed.
+ * handle: The handle of an existing object, or for DSM_OP_CREATE, the
+ * a new handle the caller wants created.
+ * request_size: For DSM_OP_CREATE, the requested size. For DSM_OP_RESIZE,
+ * the new size. Otherwise, 0.
+ * impl_private: Private, implementation-specific data. Will be a pointer
+ * to NULL for the first operation on a shared memory segment within this
+ * backend; thereafter, it will point to the value to which it was set
+ * on the previous call.
+ * mapped_address: Pointer to start of current mapping; pointer to NULL
+ * if none. Updated with new mapping address.
+ * mapped_size: Pointer to size of current mapping; pointer to 0 if none.
+ * Updated with new mapped size.
+ * elevel: Level at which to log errors.
*
* Return value: true on success, false on failure. When false is returned,
* a message should first be logged at the specified elevel, except in the
@@ -165,7 +165,7 @@ dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size,
{
Assert(op == DSM_OP_CREATE || op == DSM_OP_RESIZE || request_size == 0);
Assert((op != DSM_OP_CREATE && op != DSM_OP_ATTACH) ||
- (*mapped_address == NULL && *mapped_size == 0));
+ (*mapped_address == NULL && *mapped_size == 0));
switch (dynamic_shared_memory_type)
{
@@ -243,10 +243,10 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
- char name[64];
- int flags;
- int fd;
- char *address;
+ char name[64];
+ int flags;
+ int fd;
+ char *address;
snprintf(name, 64, "/PostgreSQL.%u", handle);
@@ -258,8 +258,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
*mapped_address = NULL;
@@ -268,8 +268,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not remove shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not remove shared memory segment \"%s\": %m",
+ name)));
return false;
}
return true;
@@ -290,7 +290,7 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not open shared memory segment \"%s\": %m",
- name)));
+ name)));
return false;
}
@@ -304,7 +304,7 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
if (fstat(fd, &st) != 0)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -314,14 +314,14 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not stat shared memory segment \"%s\": %m",
- name)));
+ name)));
return false;
}
request_size = st.st_size;
}
else if (*mapped_size != request_size && ftruncate(fd, request_size))
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -332,8 +332,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not resize shared memory segment %s to %zu bytes: %m",
- name, request_size)));
+ errmsg("could not resize shared memory segment %s to %zu bytes: %m",
+ name, request_size)));
return false;
}
@@ -347,7 +347,7 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
return true;
if (munmap(*mapped_address, *mapped_size) != 0)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -358,8 +358,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
*mapped_address = NULL;
@@ -367,11 +367,11 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
}
/* Map it. */
- address = mmap(NULL, request_size, PROT_READ|PROT_WRITE,
- MAP_SHARED|MAP_HASSEMAPHORE, fd, 0);
+ address = mmap(NULL, request_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_HASSEMAPHORE, fd, 0);
if (address == MAP_FAILED)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -409,11 +409,11 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
- key_t key;
- int ident;
- char *address;
- char name[64];
- int *ident_cache;
+ key_t key;
+ int ident;
+ char *address;
+ char name[64];
+ int *ident_cache;
/* Resize is not supported for System V shared memory. */
if (op == DSM_OP_RESIZE)
@@ -427,38 +427,38 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
return true;
/*
- * POSIX shared memory and mmap-based shared memory identify segments
- * with names. To avoid needless error message variation, we use the
- * handle as the name.
+ * POSIX shared memory and mmap-based shared memory identify segments with
+ * names. To avoid needless error message variation, we use the handle as
+ * the name.
*/
snprintf(name, 64, "%u", handle);
/*
- * The System V shared memory namespace is very restricted; names are
- * of type key_t, which is expected to be some sort of integer data type,
- * but not necessarily the same one as dsm_handle. Since we use
- * dsm_handle to identify shared memory segments across processes, this
- * might seem like a problem, but it's really not. If dsm_handle is
- * bigger than key_t, the cast below might truncate away some bits from
- * the handle the user-provided, but it'll truncate exactly the same bits
- * away in exactly the same fashion every time we use that handle, which
- * is all that really matters. Conversely, if dsm_handle is smaller than
- * key_t, we won't use the full range of available key space, but that's
- * no big deal either.
+ * The System V shared memory namespace is very restricted; names are of
+ * type key_t, which is expected to be some sort of integer data type, but
+ * not necessarily the same one as dsm_handle. Since we use dsm_handle to
+ * identify shared memory segments across processes, this might seem like
+ * a problem, but it's really not. If dsm_handle is bigger than key_t,
+ * the cast below might truncate away some bits from the handle the
+ * user-provided, but it'll truncate exactly the same bits away in exactly
+ * the same fashion every time we use that handle, which is all that
+ * really matters. Conversely, if dsm_handle is smaller than key_t, we
+ * won't use the full range of available key space, but that's no big deal
+ * either.
*
- * We do make sure that the key isn't negative, because that might not
- * be portable.
+ * We do make sure that the key isn't negative, because that might not be
+ * portable.
*/
key = (key_t) handle;
- if (key < 1) /* avoid compiler warning if type is unsigned */
+ if (key < 1) /* avoid compiler warning if type is unsigned */
key = -key;
/*
* There's one special key, IPC_PRIVATE, which can't be used. If we end
- * up with that value by chance during a create operation, just pretend
- * it already exists, so that caller will retry. If we run into it
- * anywhere else, the caller has passed a handle that doesn't correspond
- * to anything we ever created, which should not happen.
+ * up with that value by chance during a create operation, just pretend it
+ * already exists, so that caller will retry. If we run into it anywhere
+ * else, the caller has passed a handle that doesn't correspond to
+ * anything we ever created, which should not happen.
*/
if (key == IPC_PRIVATE)
{
@@ -469,9 +469,9 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
}
/*
- * Before we can do anything with a shared memory segment, we have to
- * map the shared memory key to a shared memory identifier using shmget().
- * To avoid repeated lookups, we store the key using impl_private.
+ * Before we can do anything with a shared memory segment, we have to map
+ * the shared memory key to a shared memory identifier using shmget(). To
+ * avoid repeated lookups, we store the key using impl_private.
*/
if (*impl_private != NULL)
{
@@ -480,8 +480,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
}
else
{
- int flags = IPCProtection;
- size_t segsize;
+ int flags = IPCProtection;
+ size_t segsize;
/*
* Allocate the memory BEFORE acquiring the resource, so that we don't
@@ -506,7 +506,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
{
if (errno != EEXIST)
{
- int save_errno = errno;
+ int save_errno = errno;
+
pfree(ident_cache);
errno = save_errno;
ereport(elevel,
@@ -529,8 +530,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
*mapped_address = NULL;
@@ -539,8 +540,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not remove shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not remove shared memory segment \"%s\": %m",
+ name)));
return false;
}
return true;
@@ -553,7 +554,7 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
if (shmctl(ident, IPC_STAT, &shm) != 0)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -564,7 +565,7 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not stat shared memory segment \"%s\": %m",
- name)));
+ name)));
return false;
}
request_size = shm.shm_segsz;
@@ -574,7 +575,7 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
address = shmat(ident, NULL, PG_SHMAT_FLAGS);
if (address == (void *) -1)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -614,9 +615,9 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
Size *mapped_size, int elevel)
{
- char *address;
+ char *address;
HANDLE hmap;
- char name[64];
+ char name[64];
MEMORY_BASIC_INFORMATION info;
/* Resize is not supported for Windows shared memory. */
@@ -631,12 +632,12 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
return true;
/*
- * Storing the shared memory segment in the Global\ namespace, can
- * allow any process running in any session to access that file
- * mapping object provided that the caller has the required access rights.
- * But to avoid issues faced in main shared memory, we are using the naming
- * convention similar to main shared memory. We can change here once
- * issue mentioned in GetSharedMemName is resolved.
+ * Storing the shared memory segment in the Global\ namespace, can allow
+ * any process running in any session to access that file mapping object
+ * provided that the caller has the required access rights. But to avoid
+ * issues faced in main shared memory, we are using the naming convention
+ * similar to main shared memory. We can change here once issue mentioned
+ * in GetSharedMemName is resolved.
*/
snprintf(name, 64, "%s.%u", SEGMENT_NAME_PREFIX, handle);
@@ -652,8 +653,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
_dosmaperr(GetLastError());
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
if (*impl_private != NULL
@@ -662,8 +663,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
_dosmaperr(GetLastError());
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not remove shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not remove shared memory segment \"%s\": %m",
+ name)));
return false;
}
@@ -688,9 +689,9 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
size_low = (DWORD) request_size;
hmap = CreateFileMapping(INVALID_HANDLE_VALUE, /* Use the pagefile */
- NULL, /* Default security attrs */
- PAGE_READWRITE, /* Memory is read/write */
- size_high, /* Upper 32 bits of size */
+ NULL, /* Default security attrs */
+ PAGE_READWRITE, /* Memory is read/write */
+ size_high, /* Upper 32 bits of size */
size_low, /* Lower 32 bits of size */
name);
if (!hmap)
@@ -698,8 +699,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
_dosmaperr(GetLastError());
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not create shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not create shared memory segment \"%s\": %m",
+ name)));
return false;
}
_dosmaperr(GetLastError());
@@ -718,8 +719,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
else
{
hmap = OpenFileMapping(FILE_MAP_WRITE | FILE_MAP_READ,
- FALSE, /* do not inherit the name */
- name); /* name of mapping object */
+ FALSE, /* do not inherit the name */
+ name); /* name of mapping object */
if (!hmap)
{
_dosmaperr(GetLastError());
@@ -736,7 +737,7 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
0, 0, 0);
if (!address)
{
- int save_errno;
+ int save_errno;
_dosmaperr(GetLastError());
/* Back out what's already been done. */
@@ -752,14 +753,14 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
}
/*
- * VirtualQuery gives size in page_size units, which is 4K for Windows.
- * We need size only when we are attaching, but it's better to get the
- * size when creating new segment to keep size consistent both for
+ * VirtualQuery gives size in page_size units, which is 4K for Windows. We
+ * need size only when we are attaching, but it's better to get the size
+ * when creating new segment to keep size consistent both for
* DSM_OP_CREATE and DSM_OP_ATTACH.
*/
if (VirtualQuery(address, &info, sizeof(info)) == 0)
{
- int save_errno;
+ int save_errno;
_dosmaperr(GetLastError());
/* Back out what's already been done. */
@@ -770,8 +771,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not stat shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not stat shared memory segment \"%s\": %m",
+ name)));
return false;
}
@@ -799,13 +800,13 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
- char name[64];
- int flags;
- int fd;
- char *address;
+ char name[64];
+ int flags;
+ int fd;
+ char *address;
snprintf(name, 64, PG_DYNSHMEM_DIR "/" PG_DYNSHMEM_MMAP_FILE_PREFIX "%u",
- handle);
+ handle);
/* Handle teardown cases. */
if (op == DSM_OP_DETACH || op == DSM_OP_DESTROY)
@@ -815,8 +816,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
*mapped_address = NULL;
@@ -825,8 +826,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
{
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not remove shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not remove shared memory segment \"%s\": %m",
+ name)));
return false;
}
return true;
@@ -840,7 +841,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not open shared memory segment \"%s\": %m",
- name)));
+ name)));
return false;
}
@@ -854,7 +855,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
if (fstat(fd, &st) != 0)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -864,14 +865,14 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not stat shared memory segment \"%s\": %m",
- name)));
+ name)));
return false;
}
request_size = st.st_size;
}
else if (*mapped_size > request_size && ftruncate(fd, request_size))
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -882,8 +883,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not resize shared memory segment %s to %zu bytes: %m",
- name, request_size)));
+ errmsg("could not resize shared memory segment %s to %zu bytes: %m",
+ name, request_size)));
return false;
}
else if (*mapped_size < request_size)
@@ -891,23 +892,23 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
/*
* Allocate a buffer full of zeros.
*
- * Note: palloc zbuffer, instead of just using a local char array,
- * to ensure it is reasonably well-aligned; this may save a few
- * cycles transferring data to the kernel.
+ * Note: palloc zbuffer, instead of just using a local char array, to
+ * ensure it is reasonably well-aligned; this may save a few cycles
+ * transferring data to the kernel.
*/
- char *zbuffer = (char *) palloc0(ZBUFFER_SIZE);
- uint32 remaining = request_size;
- bool success = true;
+ char *zbuffer = (char *) palloc0(ZBUFFER_SIZE);
+ uint32 remaining = request_size;
+ bool success = true;
/*
- * Zero-fill the file. We have to do this the hard way to ensure
- * that all the file space has really been allocated, so that we
- * don't later seg fault when accessing the memory mapping. This
- * is pretty pessimal.
+ * Zero-fill the file. We have to do this the hard way to ensure that
+ * all the file space has really been allocated, so that we don't
+ * later seg fault when accessing the memory mapping. This is pretty
+ * pessimal.
*/
while (success && remaining > 0)
{
- Size goal = remaining;
+ Size goal = remaining;
if (goal > ZBUFFER_SIZE)
goal = ZBUFFER_SIZE;
@@ -919,7 +920,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
if (!success)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -931,7 +932,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
errmsg("could not resize shared memory segment %s to %zu bytes: %m",
- name, request_size)));
+ name, request_size)));
return false;
}
}
@@ -946,7 +947,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
return true;
if (munmap(*mapped_address, *mapped_size) != 0)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -957,8 +958,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
ereport(elevel,
(errcode_for_dynamic_shared_memory(),
- errmsg("could not unmap shared memory segment \"%s\": %m",
- name)));
+ errmsg("could not unmap shared memory segment \"%s\": %m",
+ name)));
return false;
}
*mapped_address = NULL;
@@ -966,11 +967,11 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
}
/* Map it. */
- address = mmap(NULL, request_size, PROT_READ|PROT_WRITE,
- MAP_SHARED|MAP_HASSEMAPHORE, fd, 0);
+ address = mmap(NULL, request_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_HASSEMAPHORE, fd, 0);
if (address == MAP_FAILED)
{
- int save_errno;
+ int save_errno;
/* Back out what's already been done. */
save_errno = errno;
@@ -1009,24 +1010,24 @@ dsm_impl_keep_segment(dsm_handle handle, void *impl_private)
{
#ifdef USE_DSM_WINDOWS
case DSM_IMPL_WINDOWS:
- {
- HANDLE hmap;
-
- if (!DuplicateHandle(GetCurrentProcess(), impl_private,
- PostmasterHandle, &hmap, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
{
- char name[64];
-
- snprintf(name, 64, "%s.%u", SEGMENT_NAME_PREFIX, handle);
- _dosmaperr(GetLastError());
- ereport(ERROR,
- (errcode_for_dynamic_shared_memory(),
- errmsg("could not duplicate handle for \"%s\": %m",
- name)));
+ HANDLE hmap;
+
+ if (!DuplicateHandle(GetCurrentProcess(), impl_private,
+ PostmasterHandle, &hmap, 0, FALSE,
+ DUPLICATE_SAME_ACCESS))
+ {
+ char name[64];
+
+ snprintf(name, 64, "%s.%u", SEGMENT_NAME_PREFIX, handle);
+ _dosmaperr(GetLastError());
+ ereport(ERROR,
+ (errcode_for_dynamic_shared_memory(),
+ errmsg("could not duplicate handle for \"%s\": %m",
+ name)));
+ }
+ break;
}
- break;
- }
#endif
default:
break;