*
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.199 2010/01/28 14:25:41 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.200 2010/01/31 17:39:34 mha Exp $
* ----------
*/
#include "postgres.h"
/*
* Create the socket.
*/
- if ((pgStatSock = socket(addr->ai_family, SOCK_DGRAM, 0)) < 0)
+ if ((pgStatSock = socket(addr->ai_family, SOCK_DGRAM, 0)) == PGINVALID_SOCKET)
{
ereport(LOG,
(errcode_for_socket_access(),
}
/* Did we find a working address? */
- if (!addr || pgStatSock < 0)
+ if (!addr || pgStatSock == PGINVALID_SOCKET)
goto startup_failed;
/*
if (addrs)
pg_freeaddrinfo_all(hints.ai_family, addrs);
- if (pgStatSock >= 0)
+ if (pgStatSock != PGINVALID_SOCKET)
closesocket(pgStatSock);
pgStatSock = PGINVALID_SOCKET;
* Check that the socket is there, else pgstat_init failed and we can do
* nothing useful.
*/
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return 0;
/*
int len;
/* It's unlikely we'd get here with no socket, but maybe not impossible */
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
/*
PgStat_StatFuncEntry *funcentry;
int len;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
/*
{
PgStat_MsgDropdb msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_DROPDB);
PgStat_MsgTabpurge msg;
int len;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
msg.m_tableid[0] = relid;
{
PgStat_MsgResetcounter msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
if (!superuser())
{
PgStat_MsgResetsharedcounter msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
if (!superuser())
{
PgStat_MsgResetsinglecounter msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
if (!superuser())
{
PgStat_MsgAutovacStart msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_AUTOVAC_START);
{
PgStat_MsgVacuum msg;
- if (pgStatSock < 0 || !pgstat_track_counts)
+ if (pgStatSock == PGINVALID_SOCKET || !pgstat_track_counts)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_VACUUM);
{
PgStat_MsgAnalyze msg;
- if (pgStatSock < 0 || !pgstat_track_counts)
+ if (pgStatSock == PGINVALID_SOCKET || !pgstat_track_counts)
return;
/*
{
PgStat_MsgDummy msg;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_DUMMY);
return;
}
- if (pgStatSock < 0 || !pgstat_track_counts)
+ if (pgStatSock == PGINVALID_SOCKET || !pgstat_track_counts)
{
/* We're not counting at all */
rel->pgstat_info = NULL;
{
int rc;
- if (pgStatSock < 0)
+ if (pgStatSock == PGINVALID_SOCKET)
return;
((PgStat_MsgHdr *) msg)->m_size = len;