summaryrefslogtreecommitdiff
path: root/src/include/libpq/libpq-be.h
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-07-09 03:29:11 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-07-09 03:29:11 +0000
commita0659e3e2c79be49feb4aa527d823c71d7bcaf07 (patch)
tree7dc58e872cdfce999dd0848000fcd3f2e4edbafa /src/include/libpq/libpq-be.h
parent8bf61820f033d7df0e89433a0272d7b2567378b8 (diff)
downloadpostgresql-a0659e3e2c79be49feb4aa527d823c71d7bcaf07.tar.gz
From: Tom Lane <tgl@sss.pgh.pa.us>
Making PQrequestCancel safe to call in a signal handler turned out to be much easier than I feared. So here are the diffs. Some notes: * I modified the postmaster's packet "iodone" callback interface to allow the callback routine to return a continue-or-drop-connection return code; this was necessary to allow the connection to be closed after receiving a Cancel, rather than proceeding to launch a new backend... Being a neatnik, I also made the iodone proc have a typechecked parameter list. * I deleted all code I could find that had to do with OOB. * I made some edits to ensure that all signals mentioned in the code are referred to symbolically not by numbers ("SIGUSR2" not "2"). I think Bruce may have already done at least some of the same edits; I hope that merging these patches is not too painful.
Diffstat (limited to 'src/include/libpq/libpq-be.h')
-rw-r--r--src/include/libpq/libpq-be.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h
index 7058eec246..5d0c6d7ac6 100644
--- a/src/include/libpq/libpq-be.h
+++ b/src/include/libpq/libpq-be.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-be.h,v 1.10 1998/02/26 04:41:49 momjian Exp $
+ * $Id: libpq-be.h,v 1.11 1998/07/09 03:29:00 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,16 +68,20 @@ typedef enum
WritingPacket
} PacketState;
+typedef int (*PacketDoneProc) (void * arg, PacketLen pktlen, void * pktdata);
+
typedef struct Packet
{
PacketState state; /* What's in progress. */
PacketLen len; /* Actual length */
int nrtodo; /* Bytes still to transfer */
char *ptr; /* Buffer pointer */
- void (*iodone) (); /* I/O complete callback */
- char *arg; /* Argument to callback */
+ PacketDoneProc iodone; /* I/O complete callback */
+ void *arg; /* Argument to callback */
- /* A union of all the different packets. */
+ /* We declare the data buffer as a union of the allowed packet types,
+ * mainly to ensure that enough space is allocated for the largest one.
+ */
union
{
@@ -89,6 +93,7 @@ typedef struct Packet
/* These are incoming and have a packet length prepended. */
StartupPacket si;
+ CancelRequestPacket canc;
PasswordPacketV0 pwv0;
PasswordPacket pw;
} pkt;
@@ -126,16 +131,15 @@ typedef struct Port
extern FILE *Pfout,
*Pfin;
-extern int PQAsyncNotifyWaiting;
extern ProtocolVersion FrontendProtocol;
/*
* prototypes for functions in pqpacket.c
*/
-void PacketReceiveSetup(Packet *pkt, void (*iodone) (), char *arg);
+void PacketReceiveSetup(Packet *pkt, PacketDoneProc iodone, void *arg);
int PacketReceiveFragment(Packet *pkt, int sock);
-void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone) (), char *arg);
+void PacketSendSetup(Packet *pkt, int nbytes, PacketDoneProc iodone, void *arg);
int PacketSendFragment(Packet *pkt, int sock);
void PacketSendError(Packet *pkt, char *errormsg);