summaryrefslogtreecommitdiff
path: root/src/backend/libpq
diff options
context:
space:
mode:
authorBruce Momjian2000-10-03 03:11:26 +0000
committerBruce Momjian2000-10-03 03:11:26 +0000
commit87c0e623ba14c2de376ca9af06fb21da7b2c2215 (patch)
treee67887aaff9248f2e0c866566ed0b2967cabaae2 /src/backend/libpq
parentde1af06287dd0b169385b0756074a0b24feb123c (diff)
New diff that now covers the entire tree. Applying this gets postgresql
working on the VERY latest version of BeOS. I'm sure there will be alot of comments, but then if there weren't I'd be disappointed! Thanks for your continuing efforts to get this into your tree. Haven't bothered with the new files as they haven't changed. BTW Peter, the compiler is "broken" about the bool define and so on. I'm filing a bug report to try and get it addressed. Hopefully then we can tidy up the code a bit. I await the replies with interest :) David Reid
Diffstat (limited to 'src/backend/libpq')
-rw-r--r--src/backend/libpq/pqcomm.c20
-rw-r--r--src/backend/libpq/pqpacket.c11
2 files changed, 24 insertions, 7 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 8417cd475ab..68ee5a03bde 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.103 2000/10/02 21:45:31 petere Exp $
+ * $Id: pqcomm.c,v 1.104 2000/10/03 03:11:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -208,11 +208,16 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
MemSet((char *) &saddr, 0, sizeof(saddr));
saddr.sa.sa_family = family;
+
+/* I know this isn't a good way of testing, but until we have a
+ * define for this it'll do!
+ * we have Unix sockets...
+ */
+#ifdef HAVE_SYS_UN_H
if (family == AF_UNIX)
{
len = UNIXSOCK_PATH(saddr.un, portName);
strcpy(sock_path, saddr.un.sun_path);
-
/*
* If the socket exists but nobody has an advisory lock on it we
* can safely delete the file.
@@ -231,13 +236,16 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
}
#endif /* HAVE_FCNTL_SETLK */
}
- else
- {
+#endif /* HAVE_SYS_UN_H */
+
+ if (family == AF_INET)
+ {
saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.in.sin_port = htons(portName);
len = sizeof(struct sockaddr_in);
}
- err = bind(fd, &saddr.sa, len);
+
+ err = bind(fd, (struct sockaddr *)&saddr.sa, len);
if (err < 0)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
@@ -258,6 +266,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
return STATUS_ERROR;
}
+#ifdef HAVE_SYS_UN_H /* yeah I know... */
if (family == AF_UNIX)
{
on_proc_exit(StreamDoUnlink, 0);
@@ -279,6 +288,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
}
#endif /* HAVE_FCNTL_SETLK */
}
+#endif /* HAVE_SYS_UN_H */
listen(fd, SOMAXCONN);
diff --git a/src/backend/libpq/pqpacket.c b/src/backend/libpq/pqpacket.c
index defc57f69af..8e51a97f225 100644
--- a/src/backend/libpq/pqpacket.c
+++ b/src/backend/libpq/pqpacket.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.26 2000/04/12 17:15:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.27 2000/10/03 03:11:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,11 @@ PacketReceiveFragment(Port *port)
got = SSL_read(port->ssl, pkt->ptr, pkt->nrtodo);
else
#endif
+#ifndef __BEOS__
got = read(port->sock, pkt->ptr, pkt->nrtodo);
+#else
+ got = recv(port->sock, pkt->ptr, pkt->nrtodo, 0);
+#endif /* __BEOS__ */
if (got > 0)
{
pkt->nrtodo -= got;
@@ -150,8 +154,11 @@ PacketSendFragment(Port *port)
done = SSL_write(port->ssl, pkt->ptr, pkt->nrtodo);
else
#endif
+#ifndef __BEOS__
done = write(port->sock, pkt->ptr, pkt->nrtodo);
-
+#else
+ done = send(port->sock, pkt->ptr, pkt->nrtodo, 0);
+#endif
if (done > 0)
{
pkt->nrtodo -= done;