mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpq-fe.h,v 1.30 1998/06/16 07:29:49 momjian Exp $
|
||||
* $Id: libpq-fe.h,v 1.31 1998/07/09 03:29:09 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -174,8 +174,11 @@ extern "C"
|
||||
int sock; /* Unix FD for socket, -1 if not connected */
|
||||
SockAddr laddr; /* Local address */
|
||||
SockAddr raddr; /* Remote address */
|
||||
int raddr_len; /* Length of remote address */
|
||||
|
||||
/* Miscellaneous stuff */
|
||||
int be_pid; /* PID of backend --- needed for cancels */
|
||||
int be_key; /* key of backend --- needed for cancels */
|
||||
char salt[2]; /* password salt received from backend */
|
||||
PGlobjfuncs *lobjfuncs; /* private state for large-object access fns */
|
||||
|
||||
@@ -273,6 +276,8 @@ extern "C"
|
||||
#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
|
||||
/* close the current connection and free the PGconn data structure */
|
||||
extern void PQfinish(PGconn *conn);
|
||||
/* issue a cancel request */
|
||||
extern int PQrequestCancel(PGconn *conn);
|
||||
|
||||
/*
|
||||
* close the current connection and restablish a new one with the same
|
||||
@@ -305,7 +310,6 @@ extern "C"
|
||||
/* Routines for managing an asychronous query */
|
||||
extern int PQisBusy(PGconn *conn);
|
||||
extern void PQconsumeInput(PGconn *conn);
|
||||
extern int PQrequestCancel(PGconn *conn);
|
||||
/* Routines for copy in/out */
|
||||
extern int PQgetline(PGconn *conn, char *string, int length);
|
||||
extern void PQputline(PGconn *conn, const char *string);
|
||||
|
Reference in New Issue
Block a user