From f8009e178605d986055d6d7fd9487a69e6d1dd1d Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Fri, 4 Oct 1996 20:17:11 +0000 Subject: [PATCH] The remainder of D'Arcy's changes, most notibly the usage of SIGNAL_ARGS --- src/backend/postmaster/postmaster.c | 48 +++++++++-------------------- src/backend/tcop/postgres.c | 12 ++++---- src/include/commands/async.h | 8 ++--- src/mk/postgres.mk | 14 ++++++++- 4 files changed, 36 insertions(+), 46 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 7de3703797..55c7fe8109 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.8 1996/09/26 03:17:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.9 1996/10/04 20:16:18 scrappy Exp $ * * NOTES * @@ -156,20 +156,14 @@ static void pmdaemonize(void); static int ConnStartup(Port *port); static int ConnCreate(int serverFd, int *newFdP); static void reset_shared(short port); -#if defined(linux) -static void pmdie(int); -static void reaper(int); -static void dumpstatus(int); -#else -static void pmdie(void); -static void reaper(void); -static void dumpstatus(); -#endif +static void pmdie(SIGNAL_ARGS); +static void reaper(SIGNAL_ARGS); +static void dumpstatus(SIGNAL_ARGS); static void CleanupProc(int pid, int exitstatus); static int DoExec(StartupInfo *packet, int portFd); static void ExitPostmaster(int status); -static void usage(); -static void checkDataDir(); +static void usage(const char *); +static void checkDataDir(void); int ServerLoop(void); int BackendStartup(StartupInfo *packet, Port *port, int *pidPtr); @@ -367,7 +361,7 @@ PostmasterMain(int argc, char *argv[]) } static void -pmdaemonize() +pmdaemonize(void) { int i; @@ -387,7 +381,7 @@ pmdaemonize() } static void -usage(char *progname) +usage(const char *progname) { fprintf(stderr, "usage: %s [options..]\n", progname); fprintf(stderr, "\t-a authsys\tdo/do not permit use of an authentication system\n"); @@ -405,7 +399,7 @@ usage(char *progname) } int -ServerLoop() +ServerLoop(void) { int serverFd = ServerSock; fd_set rmask, basemask; @@ -435,7 +429,7 @@ ServerLoop() fprintf(stderr, "%s: ServerLoop: select failed\n", progname); return(STATUS_ERROR); - } + } /* [TRH] * To avoid race conditions, block SIGCHLD signals while we are * handling the request. (both reaper() and ConnCreate() @@ -468,7 +462,7 @@ ServerLoop() --nSelected; FD_CLR(ServerSock, &rmask); } - + if (DebugLvl > 1) { fprintf(stderr, "%s: ServerLoop:\tnSelected=%d\n", progname, nSelected); @@ -661,11 +655,7 @@ reset_shared(short port) * pmdie -- signal handler for cleaning up after a kill signal. */ static void -#if defined(PORTNAME_linux) -pmdie(int i) -#else -pmdie() -#endif +pmdie(SIGNAL_ARGS) { exitpg(0); } @@ -674,11 +664,7 @@ pmdie() * Reaper -- signal handler to cleanup after a backend (child) dies. */ static void -#if defined(PORTNAME_linux) -reaper(int i) -#else -reaper() -#endif +reaper(SIGNAL_ARGS) { int status; /* backend exit status */ int pid; /* process id of dead backend */ @@ -1083,11 +1069,7 @@ ExitPostmaster(int status) } static void -#if defined(PORTNAME_linux) -dumpstatus(int i) -#else -dumpstatus() -#endif +dumpstatus(SIGNAL_ARGS) { Dlelem *curr = DLGetHead(PortList); @@ -1104,7 +1086,7 @@ dumpstatus() } static void -checkDataDir() +checkDataDir(void) { char path[MAXPATHLEN]; FILE *fp; diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 43fb9003c7..dd638c03c7 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.8 1996/09/16 05:36:38 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.9 1996/10/04 20:16:32 scrappy Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -707,13 +707,13 @@ pg_eval_dest(char *query_string, /* string to execute */ */ void -handle_warn() +handle_warn(SIGNAL_ARGS) { siglongjmp(Warn_restart, 1); } void -quickdie() +quickdie(SIGNAL_ARGS) { elog(NOTICE, "I have been signalled by the postmaster."); elog(NOTICE, "Some backend process has died unexpectedly and possibly"); @@ -731,14 +731,14 @@ quickdie() } void -die() +die(SIGNAL_ARGS) { ExitPostgres(0); } /* signal handler for floating point exception */ void -FloatExceptionHandler() +FloatExceptionHandler(SIGNAL_ARGS) { elog(WARN, "floating point exception! the last floating point operation eit\ her exceeded legal ranges or was a divide by zero"); @@ -1269,7 +1269,7 @@ PostgresMain(int argc, char *argv[]) */ if (IsUnderPostmaster == false) { puts("\nPOSTGRES backend interactive interface"); - puts("$Revision: 1.8 $ $Date: 1996/09/16 05:36:38 $"); + puts("$Revision: 1.9 $ $Date: 1996/10/04 20:16:32 $"); } /* ---------------- diff --git a/src/include/commands/async.h b/src/include/commands/async.h index c55cff2be8..bb500942e3 100644 --- a/src/include/commands/async.h +++ b/src/include/commands/async.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: async.h,v 1.1 1996/08/28 07:21:41 scrappy Exp $ + * $Id: async.h,v 1.2 1996/10/04 20:16:52 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -15,11 +15,7 @@ #include "nodes/memnodes.h" -#if defined(PORTNAME_linux) -extern void Async_NotifyHandler(int); -#else -extern void Async_NotifyHandler(void); -#endif +extern void Async_NotifyHandler(SIGNAL_ARGS); extern void Async_Notify(char *relname); extern void Async_NotifyAtCommit(void); extern void Async_NotifyAtAbort(void); diff --git a/src/mk/postgres.mk b/src/mk/postgres.mk index a925e07d83..06ac466f50 100644 --- a/src/mk/postgres.mk +++ b/src/mk/postgres.mk @@ -9,7 +9,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.mk,v 1.3 1996/09/23 08:24:11 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.mk,v 1.4 1996/10/04 20:17:11 scrappy Exp $ # #------------------------------------------------------------------------- @@ -89,6 +89,18 @@ endef include $(MKDIR)/../Makefile.global -include $(MKDIR)/port/postgres.mk.$(PORTNAME) +# The following is used as the arg list for signal handlers. Any ports +# that take something other than an int argument should change this in +# the port specific makefile. Note that variable names are required +# because it is used in both the prototypes as well as the definitions. +# Note also the long name. We expect that this won't collide with +# other names causing compiler warnings. +#ifndef SIGNAL_ARGS +#define SIGNAL_ARGS int postgres_signal_arg +#endif + +CFLAGS += -DSIGNAL_ARGS=$(SIGNAL_ARGS) + CURDIR:= $(shell pwd) # This is where we put all the .o's and the generated files.