1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00

pgindent run for 8.3.

This commit is contained in:
Bruce Momjian
2007-11-15 21:14:46 +00:00
parent 3adc760fb9
commit fdf5a5efb7
486 changed files with 10044 additions and 9664 deletions

View File

@ -4,7 +4,7 @@
* If dlopen() is available (Darwin 10.3 and later), we just use it.
* Otherwise we emulate it with the older, now deprecated, NSLinkModule API.
*
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.11 2006/10/08 19:31:03 tgl Exp $
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.12 2007/11/15 21:14:37 momjian Exp $
*/
#include "postgres.h"
@ -43,8 +43,7 @@ pg_dlerror(void)
{
return dlerror();
}
#else /* !HAVE_DLOPEN */
#else /* !HAVE_DLOPEN */
/*
* These routines were taken from the Apache source, but were made
@ -132,4 +131,4 @@ pg_dlerror(void)
return (char *) errorString;
}
#endif /* HAVE_DLOPEN */
#endif /* HAVE_DLOPEN */

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.51 2007/07/02 20:11:54 tgl Exp $
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.52 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -247,7 +247,7 @@ PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
/*
* Try to attach to the segment and see if it matches our data directory.
* This avoids shmid-conflict problems on machines that are running
* several postmasters under the same userid.
* several postmasters under the same userid.
*/
if (stat(DataDir, &statbuf) < 0)
return true; /* if can't stat, be conservative */

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.2 2007/10/29 14:04:42 mha Exp $
* $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.3 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -14,7 +14,7 @@
#include "postgres.h"
/*
* This file contains loaders for functions that are missing in the MinGW
* This file contains loaders for functions that are missing in the MinGW
* import libraries. It's only for actual Win32 API functions, so they are
* all present in proper Win32 compilers.
*/
@ -36,7 +36,7 @@ LoadKernel32()
if (kernel32 == NULL)
ereport(FATAL,
(errmsg_internal("could not load kernel32.dll: %d",
(int)GetLastError())));
(int) GetLastError())));
}
@ -44,11 +44,12 @@ LoadKernel32()
* Replacement for RegisterWaitForSingleObject(), which lives in
* kernel32.dll·
*/
typedef BOOL (WINAPI * __RegisterWaitForSingleObject)
(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
typedef
BOOL(WINAPI * __RegisterWaitForSingleObject)
(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL;
BOOL WINAPI
BOOL WINAPI
RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
HANDLE hObject,
WAITORTIMERCALLBACK Callback,
@ -66,7 +67,7 @@ RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
if (_RegisterWaitForSingleObject == NULL)
ereport(FATAL,
(errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: %d",
(int)GetLastError())));
(int) GetLastError())));
}
return (_RegisterWaitForSingleObject)
@ -74,4 +75,3 @@ RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
}
#endif

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.18 2007/06/04 13:39:28 mha Exp $
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.19 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -103,14 +103,15 @@ pgwin32_poll_signals(void)
}
static int
isDataGram(SOCKET s) {
int type;
int typelen = sizeof(type);
isDataGram(SOCKET s)
{
int type;
int typelen = sizeof(type);
if ( getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &typelen) )
if (getsockopt(s, SOL_SOCKET, SO_TYPE, (char *) &type, &typelen))
return 1;
return ( type == SOCK_DGRAM ) ? 1 : 0;
return (type == SOCK_DGRAM) ? 1 : 0;
}
int
@ -118,7 +119,7 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
{
static HANDLE waitevent = INVALID_HANDLE_VALUE;
static SOCKET current_socket = -1;
static int isUDP = 0;
static int isUDP = 0;
HANDLE events[2];
int r;
@ -139,9 +140,9 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
* socket from a previous call
*/
if (current_socket != s)
if (current_socket != s)
{
if ( current_socket != -1 )
if (current_socket != -1)
WSAEventSelect(current_socket, waitevent, 0);
isUDP = isDataGram(s);
}
@ -157,34 +158,32 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
events[0] = pgwin32_signal_event;
events[1] = waitevent;
/*
* Just a workaround of unknown locking problem with writing
* in UDP socket under high load:
* Client's pgsql backend sleeps infinitely in
* WaitForMultipleObjectsEx, pgstat process sleeps in
* pgwin32_select(). So, we will wait with small
* timeout(0.1 sec) and if sockect is still blocked,
* try WSASend (see comments in pgwin32_select) and wait again.
/*
* Just a workaround of unknown locking problem with writing in UDP socket
* under high load: Client's pgsql backend sleeps infinitely in
* WaitForMultipleObjectsEx, pgstat process sleeps in pgwin32_select().
* So, we will wait with small timeout(0.1 sec) and if sockect is still
* blocked, try WSASend (see comments in pgwin32_select) and wait again.
*/
if ((what & FD_WRITE) && isUDP)
{
for(;;)
for (;;)
{
r = WaitForMultipleObjectsEx(2, events, FALSE, 100, TRUE);
if ( r == WAIT_TIMEOUT )
if (r == WAIT_TIMEOUT)
{
char c;
WSABUF buf;
DWORD sent;
char c;
WSABUF buf;
DWORD sent;
buf.buf = &c;
buf.len = 0;
r = WSASend(s, &buf, 1, &sent, 0, NULL, NULL);
if (r == 0) /* Completed - means things are fine! */
if (r == 0) /* Completed - means things are fine! */
return 1;
else if ( WSAGetLastError() != WSAEWOULDBLOCK )
else if (WSAGetLastError() != WSAEWOULDBLOCK)
{
TranslateSocketError();
return 0;
@ -291,7 +290,7 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
int r;
DWORD b;
DWORD flags = f;
int n;
int n;
if (pgwin32_poll_signals())
return -1;
@ -317,8 +316,8 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
{
if (pgwin32_waitforsinglesocket(s, FD_READ | FD_CLOSE | FD_ACCEPT,
INFINITE) == 0)
return -1; /* errno already set */
return -1; /* errno already set */
r = WSARecv(s, &wbuf, 1, &b, &flags, NULL, NULL);
if (r == SOCKET_ERROR)
{
@ -326,10 +325,11 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
{
/*
* There seem to be cases on win2k (at least) where WSARecv
* can return WSAEWOULDBLOCK even when pgwin32_waitforsinglesocket
* claims the socket is readable. In this case, just sleep for a
* moment and try again. We try up to 5 times - if it fails more than
* that it's not likely to ever come back.
* can return WSAEWOULDBLOCK even when
* pgwin32_waitforsinglesocket claims the socket is readable.
* In this case, just sleep for a moment and try again. We try
* up to 5 times - if it fails more than that it's not likely
* to ever come back.
*/
pg_usleep(10000);
continue;
@ -340,7 +340,7 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
return b;
}
ereport(NOTICE,
(errmsg_internal("Failed to read from ready socket (after retries)")));
(errmsg_internal("Failed to read from ready socket (after retries)")));
errno = EWOULDBLOCK;
return -1;
}
@ -359,11 +359,11 @@ pgwin32_send(SOCKET s, char *buf, int len, int flags)
wbuf.buf = buf;
/*
* Readiness of socket to send data to UDP socket
* may be not true: socket can become busy again! So loop
* until send or error occurs.
* Readiness of socket to send data to UDP socket may be not true: socket
* can become busy again! So loop until send or error occurs.
*/
for(;;) {
for (;;)
{
r = WSASend(s, &wbuf, 1, &b, flags, NULL, NULL);
if (r != SOCKET_ERROR && b > 0)
/* Write succeeded right away */