37
37
*
38
38
*
39
39
* IDENTIFICATION
40
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.599 2010/01/02 16:57:50 momjian Exp $
40
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.600 2010/01/10 14: 16:08 mha Exp $
41
41
*
42
42
* NOTES
43
43
*
@@ -172,7 +172,7 @@ int ReservedBackends;
172
172
173
173
/* The socket(s) we're listening to. */
174
174
#define MAXLISTEN 64
175
- static int ListenSocket [MAXLISTEN ];
175
+ static pgsocket ListenSocket [MAXLISTEN ];
176
176
177
177
/*
178
178
* Set by the -o option
@@ -382,7 +382,7 @@ static pid_t internal_forkexec(int argc, char *argv[], Port *port);
382
382
#ifdef WIN32
383
383
typedef struct
384
384
{
385
- SOCKET origsocket ; /* Original socket value, or -1 if not a
385
+ SOCKET origsocket ; /* Original socket value, or PGINVALID_SOCKET if not a
386
386
* socket */
387
387
WSAPROTOCOL_INFO wsainfo ;
388
388
} InheritableSocket ;
@@ -400,7 +400,7 @@ typedef struct
400
400
Port port ;
401
401
InheritableSocket portsocket ;
402
402
char DataDir [MAXPGPATH ];
403
- int ListenSocket [MAXLISTEN ];
403
+ pgsocket ListenSocket [MAXLISTEN ];
404
404
long MyCancelKey ;
405
405
int MyPMChildSlot ;
406
406
#ifndef WIN32
@@ -807,7 +807,7 @@ PostmasterMain(int argc, char *argv[])
807
807
* Establish input sockets.
808
808
*/
809
809
for (i = 0 ; i < MAXLISTEN ; i ++ )
810
- ListenSocket [i ] = -1 ;
810
+ ListenSocket [i ] = PGINVALID_SOCKET ;
811
811
812
812
if (ListenAddresses )
813
813
{
@@ -860,7 +860,7 @@ PostmasterMain(int argc, char *argv[])
860
860
861
861
#ifdef USE_BONJOUR
862
862
/* Register for Bonjour only if we opened TCP socket(s) */
863
- if (enable_bonjour && ListenSocket [0 ] != -1 )
863
+ if (enable_bonjour && ListenSocket [0 ] != PGINVALID_SOCKET )
864
864
{
865
865
DNSServiceErrorType err ;
866
866
@@ -908,7 +908,7 @@ PostmasterMain(int argc, char *argv[])
908
908
/*
909
909
* check that we have some socket to listen on
910
910
*/
911
- if (ListenSocket [0 ] == -1 )
911
+ if (ListenSocket [0 ] == PGINVALID_SOCKET )
912
912
ereport (FATAL ,
913
913
(errmsg ("no socket created for listening" )));
914
914
@@ -1392,7 +1392,7 @@ ServerLoop(void)
1392
1392
1393
1393
for (i = 0 ; i < MAXLISTEN ; i ++ )
1394
1394
{
1395
- if (ListenSocket [i ] == -1 )
1395
+ if (ListenSocket [i ] == PGINVALID_SOCKET )
1396
1396
break ;
1397
1397
if (FD_ISSET (ListenSocket [i ], & rmask ))
1398
1398
{
@@ -1493,7 +1493,7 @@ initMasks(fd_set *rmask)
1493
1493
{
1494
1494
int fd = ListenSocket [i ];
1495
1495
1496
- if (fd == -1 )
1496
+ if (fd == PGINVALID_SOCKET )
1497
1497
break ;
1498
1498
FD_SET (fd , rmask );
1499
1499
@@ -2002,10 +2002,10 @@ ClosePostmasterPorts(bool am_syslogger)
2002
2002
/* Close the listen sockets */
2003
2003
for (i = 0 ; i < MAXLISTEN ; i ++ )
2004
2004
{
2005
- if (ListenSocket [i ] != -1 )
2005
+ if (ListenSocket [i ] != PGINVALID_SOCKET )
2006
2006
{
2007
2007
StreamClose (ListenSocket [i ]);
2008
- ListenSocket [i ] = -1 ;
2008
+ ListenSocket [i ] = PGINVALID_SOCKET ;
2009
2009
}
2010
2010
}
2011
2011
@@ -4408,7 +4408,7 @@ extern slock_t *ProcStructLock;
4408
4408
extern PROC_HDR * ProcGlobal ;
4409
4409
extern PGPROC * AuxiliaryProcs ;
4410
4410
extern PMSignalData * PMSignalState ;
4411
- extern int pgStatSock ;
4411
+ extern pgsocket pgStatSock ;
4412
4412
4413
4413
#ifndef WIN32
4414
4414
#define write_inheritable_socket (dest , src , childpid ) ((*(dest) = (src)), true)
@@ -4522,7 +4522,7 @@ static bool
4522
4522
write_inheritable_socket (InheritableSocket * dest , SOCKET src , pid_t childpid )
4523
4523
{
4524
4524
dest -> origsocket = src ;
4525
- if (src != 0 && src != -1 )
4525
+ if (src != 0 && src != PGINVALID_SOCKET )
4526
4526
{
4527
4527
/* Actual socket */
4528
4528
if (WSADuplicateSocket (src , childpid , & dest -> wsainfo ) != 0 )
@@ -4544,7 +4544,7 @@ read_inheritable_socket(SOCKET *dest, InheritableSocket *src)
4544
4544
{
4545
4545
SOCKET s ;
4546
4546
4547
- if (src -> origsocket == -1 || src -> origsocket == 0 )
4547
+ if (src -> origsocket == PGINVALID_SOCKET || src -> origsocket == 0 )
4548
4548
{
4549
4549
/* Not a real socket! */
4550
4550
* dest = src -> origsocket ;
0 commit comments