diff options
| author | Magnus Hagander <magnus@hagander.net> | 2010-01-10 14:16:08 +0000 |
|---|---|---|
| committer | Magnus Hagander <magnus@hagander.net> | 2010-01-10 14:16:08 +0000 |
| commit | 87091cb1f1ed914e2ddca424fa28f94fdf8461d2 (patch) | |
| tree | ec717192f02f29f0f2a7b602e0020d43fc584f61 /src/include | |
| parent | 84b6d5f35941a0406210e7938d10c3cce4e11340 (diff) | |
| download | postgresql-87091cb1f1ed914e2ddca424fa28f94fdf8461d2.tar.gz | |
Create typedef pgsocket for storing socket descriptors.
This silences some warnings on Win64. Not using the proper SOCKET datatype
was actually wrong on Win32 as well, but didn't cause any warnings there.
Also create define PGINVALID_SOCKET to indicate an invalid/non-existing
socket, instead of using a hardcoded -1 value.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/libpq/libpq-be.h | 4 | ||||
| -rw-r--r-- | src/include/libpq/libpq.h | 8 | ||||
| -rw-r--r-- | src/include/port.h | 15 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index c714add81a..1d35871528 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.72 2010/01/02 16:58:04 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.73 2010/01/10 14:16:08 mha Exp $ * *------------------------------------------------------------------------- */ @@ -103,7 +103,7 @@ typedef struct typedef struct Port { - int sock; /* File descriptor */ + pgsocket sock; /* File descriptor */ ProtocolVersion proto; /* FE/BE protocol version */ SockAddr laddr; /* local addr (postmaster) */ SockAddr raddr; /* remote addr (client) */ diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index 314ce69bce..c9c7e0d764 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq.h,v 1.72 2010/01/02 16:58:04 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq.h,v 1.73 2010/01/10 14:16:08 mha Exp $ * *------------------------------------------------------------------------- */ @@ -45,10 +45,10 @@ typedef struct * prototypes for functions in pqcomm.c */ extern int StreamServerPort(int family, char *hostName, - unsigned short portNumber, char *unixSocketName, int ListenSocket[], + unsigned short portNumber, char *unixSocketName, pgsocket ListenSocket[], int MaxListen); -extern int StreamConnection(int server_fd, Port *port); -extern void StreamClose(int sock); +extern int StreamConnection(pgsocket server_fd, Port *port); +extern void StreamClose(pgsocket sock); extern void TouchSocketFile(void); extern void pq_init(void); extern void pq_comm_reset(void); diff --git a/src/include/port.h b/src/include/port.h index b5c22cb0c4..2a4f9b4818 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.128 2010/01/02 16:58:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.129 2010/01/10 14:16:08 mha Exp $ * *------------------------------------------------------------------------- */ @@ -17,9 +17,18 @@ #include <netdb.h> #include <pwd.h> +/* socket has a different definition on WIN32 */ +#ifndef WIN32 +typedef int pgsocket; +#define PGINVALID_SOCKET -1 +#else +typedef SOCKET pgsocket; +#define PGINVALID_SOCKET INVALID_SOCKET +#endif + /* non-blocking */ -extern bool pg_set_noblock(int sock); -extern bool pg_set_block(int sock); +extern bool pg_set_noblock(pgsocket sock); +extern bool pg_set_block(pgsocket sock); /* Portable path handling for Unix/Win32 (in path.c) */ |
