1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Run pgindent on 9.2 source tree in preparation for first 9.3

commit-fest.
This commit is contained in:
Bruce Momjian
2012-06-10 15:20:04 -04:00
parent 60801944fa
commit 927d61eeff
494 changed files with 7343 additions and 7046 deletions

View File

@ -2,7 +2,7 @@
* src/backend/port/darwin/system.c
*
* only needed in OS X 10.1 and possibly early 10.2 releases */
#include <AvailabilityMacros.h> /* pgrminclude ignore */
#include <AvailabilityMacros.h> /* pgrminclude ignore */
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 || !defined(MAC_OS_X_VERSION_10_2)
/*

View File

@ -16,7 +16,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* In some older systems, the RTLD_NOW flag isn't defined and the mode

View File

@ -13,7 +13,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* In some older systems, the RTLD_NOW flag isn't defined and the mode

View File

@ -18,7 +18,7 @@
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on NetBSD 1.0.

View File

@ -15,7 +15,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on Irix.

View File

@ -14,7 +14,7 @@
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#ifdef HAVE_DLOPEN
#include <dlfcn.h>
#endif

View File

@ -19,7 +19,7 @@
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on NetBSD 1.0.

View File

@ -18,7 +18,7 @@
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on NetBSD 1.0.

View File

@ -16,7 +16,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on Alpha OSF/1.x

View File

@ -15,7 +15,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on SCO 3.2v5.0.2

View File

@ -15,7 +15,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* In some older systems, the RTLD_NOW flag isn't defined and the mode

View File

@ -18,7 +18,7 @@
#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
/*
* Dynamic Loader on UnixWare.

View File

@ -4,7 +4,7 @@
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#include "utils/dynamic_loader.h" /* pgrminclude ignore */
#define pg_dlopen(f) dlopen((f), 1)
#define pg_dlsym dlsym

View File

@ -183,6 +183,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
{
int result = 0;
int rc;
#ifdef HAVE_POLL
struct pollfd pfds[3];
int nfds;
@ -235,14 +236,15 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
*
* Note: we assume that the kernel calls involved in drainSelfPipe()
* and SetLatch() will provide adequate synchronization on machines
* with weak memory ordering, so that we cannot miss seeing is_set
* if the signal byte is already in the pipe when we drain it.
* with weak memory ordering, so that we cannot miss seeing is_set if
* the signal byte is already in the pipe when we drain it.
*/
drainSelfPipe();
if ((wakeEvents & WL_LATCH_SET) && latch->is_set)
{
result |= WL_LATCH_SET;
/*
* Leave loop immediately, avoid blocking again. We don't attempt
* to report any other events that might also be satisfied.
@ -309,13 +311,14 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
{
result |= WL_SOCKET_WRITEABLE;
}
/*
* We expect a POLLHUP when the remote end is closed, but because we
* don't expect the pipe to become readable or to have any errors
* either, treat those as postmaster death, too.
*/
if ((wakeEvents & WL_POSTMASTER_DEATH) &&
(pfds[nfds - 1].revents & (POLLHUP | POLLIN | POLLERR | POLLNVAL)))
(pfds[nfds - 1].revents & (POLLHUP | POLLIN | POLLERR | POLLNVAL)))
{
/*
* According to the select(2) man page on Linux, select(2) may
@ -329,8 +332,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
if (!PostmasterIsAlive())
result |= WL_POSTMASTER_DEATH;
}
#else /* !HAVE_POLL */
#else /* !HAVE_POLL */
FD_ZERO(&input_mask);
FD_ZERO(&output_mask);
@ -387,7 +389,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
result |= WL_SOCKET_WRITEABLE;
}
if ((wakeEvents & WL_POSTMASTER_DEATH) &&
FD_ISSET(postmaster_alive_fds[POSTMASTER_FD_WATCH], &input_mask))
FD_ISSET(postmaster_alive_fds[POSTMASTER_FD_WATCH], &input_mask))
{
/*
* According to the select(2) man page on Linux, select(2) may
@ -401,7 +403,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
if (!PostmasterIsAlive())
result |= WL_POSTMASTER_DEATH;
}
#endif /* HAVE_POLL */
#endif /* HAVE_POLL */
} while (result == 0);
waiting = false;
@ -423,9 +425,9 @@ SetLatch(volatile Latch *latch)
pid_t owner_pid;
/*
* XXX there really ought to be a memory barrier operation right here,
* to ensure that any flag variables we might have changed get flushed
* to main memory before we check/set is_set. Without that, we have to
* XXX there really ought to be a memory barrier operation right here, to
* ensure that any flag variables we might have changed get flushed to
* main memory before we check/set is_set. Without that, we have to
* require that callers provide their own synchronization for machines
* with weak memory ordering (see latch.h).
*/
@ -450,12 +452,12 @@ SetLatch(volatile Latch *latch)
* Postgres; and PG database processes should handle excess SIGUSR1
* interrupts without a problem anyhow.
*
* Another sort of race condition that's possible here is for a new process
* to own the latch immediately after we look, so we don't signal it.
* This is okay so long as all callers of ResetLatch/WaitLatch follow the
* standard coding convention of waiting at the bottom of their loops,
* not the top, so that they'll correctly process latch-setting events that
* happen before they enter the loop.
* Another sort of race condition that's possible here is for a new
* process to own the latch immediately after we look, so we don't signal
* it. This is okay so long as all callers of ResetLatch/WaitLatch follow
* the standard coding convention of waiting at the bottom of their loops,
* not the top, so that they'll correctly process latch-setting events
* that happen before they enter the loop.
*/
owner_pid = latch->owner_pid;
if (owner_pid == 0)
@ -484,7 +486,7 @@ ResetLatch(volatile Latch *latch)
/*
* XXX there really ought to be a memory barrier operation right here, to
* ensure that the write to is_set gets flushed to main memory before we
* examine any flag variables. Otherwise a concurrent SetLatch might
* examine any flag variables. Otherwise a concurrent SetLatch might
* falsely conclude that it needn't signal us, even though we have missed
* seeing some flag updates that SetLatch was supposed to inform us of.
* For the moment, callers must supply their own synchronization of flag

View File

@ -42,8 +42,8 @@ LoadKernel32()
kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0);
if (kernel32 == NULL)
ereport(FATAL,
(errmsg_internal("could not load kernel32.dll: error code %lu",
GetLastError())));
(errmsg_internal("could not load kernel32.dll: error code %lu",
GetLastError())));
}

View File

@ -151,7 +151,7 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
(errmsg_internal("could not reset socket waiting event: error code %lu", GetLastError())));
/*
* Track whether socket is UDP or not. (NB: most likely, this is both
* Track whether socket is UDP or not. (NB: most likely, this is both
* useless and wrong; there is no reason to think that the behavior of
* WSAEventSelect is different for TCP and UDP.)
*/
@ -160,8 +160,9 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
current_socket = s;
/*
* Attach event to socket. NOTE: we must detach it again before returning,
* since other bits of code may try to attach other events to the socket.
* Attach event to socket. NOTE: we must detach it again before
* returning, since other bits of code may try to attach other events to
* the socket.
*/
if (WSAEventSelect(s, waitevent, what) != 0)
{

View File

@ -97,8 +97,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
timerCommArea.event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (timerCommArea.event == NULL)
ereport(FATAL,
(errmsg_internal("could not create timer event: error code %lu",
GetLastError())));
(errmsg_internal("could not create timer event: error code %lu",
GetLastError())));
MemSet(&timerCommArea.value, 0, sizeof(struct itimerval));
@ -107,8 +107,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
timerThreadHandle = CreateThread(NULL, 0, pg_timer_thread, NULL, 0, NULL);
if (timerThreadHandle == INVALID_HANDLE_VALUE)
ereport(FATAL,
(errmsg_internal("could not create timer thread: error code %lu",
GetLastError())));
(errmsg_internal("could not create timer thread: error code %lu",
GetLastError())));
}
/* Request the timer thread to change settings */

View File

@ -173,6 +173,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
if ((wakeEvents & WL_LATCH_SET) && latch->is_set)
{
result |= WL_LATCH_SET;
/*
* Leave loop immediately, avoid blocking again. We don't attempt
* to report any other events that might also be satisfied.
@ -199,7 +200,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
/* Latch is set, we'll handle that on next iteration of loop */
}
else if ((wakeEvents & (WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE)) &&
rc == WAIT_OBJECT_0 + 2) /* socket is at event slot 2 */
rc == WAIT_OBJECT_0 + 2) /* socket is at event slot 2 */
{
WSANETWORKEVENTS resEvents;
@ -222,7 +223,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
rc == WAIT_OBJECT_0 + pmdeath_eventno)
{
/*
* Postmaster apparently died. Since the consequences of falsely
* Postmaster apparently died. Since the consequences of falsely
* returning WL_POSTMASTER_DEATH could be pretty unpleasant, we
* take the trouble to positively verify this with
* PostmasterIsAlive(), even though there is no known reason to

View File

@ -162,7 +162,7 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
if (errno != 0)
ereport(FATAL,
(errmsg("could not lock semaphore: error code %lu", GetLastError())));
(errmsg("could not lock semaphore: error code %lu", GetLastError())));
}
/*
@ -204,7 +204,7 @@ PGSemaphoreTryLock(PGSemaphore sema)
/* Otherwise we are in trouble */
ereport(FATAL,
(errmsg("could not try-lock semaphore: error code %lu", GetLastError())));
(errmsg("could not try-lock semaphore: error code %lu", GetLastError())));
/* keep compiler quiet */
return false;