The remainder of D'Arcy's changes, most notibly the usage of SIGNAL_ARGS

This commit is contained in:
Marc G. Fournier 1996-10-04 20:17:11 +00:00
parent 312b4dabfe
commit f8009e1786
4 changed files with 36 additions and 46 deletions

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
@ -156,20 +156,14 @@ static void pmdaemonize(void);
static int ConnStartup(Port *port); static int ConnStartup(Port *port);
static int ConnCreate(int serverFd, int *newFdP); static int ConnCreate(int serverFd, int *newFdP);
static void reset_shared(short port); static void reset_shared(short port);
#if defined(linux) static void pmdie(SIGNAL_ARGS);
static void pmdie(int); static void reaper(SIGNAL_ARGS);
static void reaper(int); static void dumpstatus(SIGNAL_ARGS);
static void dumpstatus(int);
#else
static void pmdie(void);
static void reaper(void);
static void dumpstatus();
#endif
static void CleanupProc(int pid, int exitstatus); static void CleanupProc(int pid, int exitstatus);
static int DoExec(StartupInfo *packet, int portFd); static int DoExec(StartupInfo *packet, int portFd);
static void ExitPostmaster(int status); static void ExitPostmaster(int status);
static void usage(); static void usage(const char *);
static void checkDataDir(); static void checkDataDir(void);
int ServerLoop(void); int ServerLoop(void);
int BackendStartup(StartupInfo *packet, Port *port, int *pidPtr); int BackendStartup(StartupInfo *packet, Port *port, int *pidPtr);
@ -367,7 +361,7 @@ PostmasterMain(int argc, char *argv[])
} }
static void static void
pmdaemonize() pmdaemonize(void)
{ {
int i; int i;
@ -387,7 +381,7 @@ pmdaemonize()
} }
static void static void
usage(char *progname) usage(const char *progname)
{ {
fprintf(stderr, "usage: %s [options..]\n", progname); fprintf(stderr, "usage: %s [options..]\n", progname);
fprintf(stderr, "\t-a authsys\tdo/do not permit use of an authentication system\n"); fprintf(stderr, "\t-a authsys\tdo/do not permit use of an authentication system\n");
@ -405,7 +399,7 @@ usage(char *progname)
} }
int int
ServerLoop() ServerLoop(void)
{ {
int serverFd = ServerSock; int serverFd = ServerSock;
fd_set rmask, basemask; fd_set rmask, basemask;
@ -435,7 +429,7 @@ ServerLoop()
fprintf(stderr, "%s: ServerLoop: select failed\n", fprintf(stderr, "%s: ServerLoop: select failed\n",
progname); progname);
return(STATUS_ERROR); return(STATUS_ERROR);
} }
/* [TRH] /* [TRH]
* To avoid race conditions, block SIGCHLD signals while we are * To avoid race conditions, block SIGCHLD signals while we are
* handling the request. (both reaper() and ConnCreate() * handling the request. (both reaper() and ConnCreate()
@ -468,7 +462,7 @@ ServerLoop()
--nSelected; --nSelected;
FD_CLR(ServerSock, &rmask); FD_CLR(ServerSock, &rmask);
} }
if (DebugLvl > 1) { if (DebugLvl > 1) {
fprintf(stderr, "%s: ServerLoop:\tnSelected=%d\n", fprintf(stderr, "%s: ServerLoop:\tnSelected=%d\n",
progname, nSelected); progname, nSelected);
@ -661,11 +655,7 @@ reset_shared(short port)
* pmdie -- signal handler for cleaning up after a kill signal. * pmdie -- signal handler for cleaning up after a kill signal.
*/ */
static void static void
#if defined(PORTNAME_linux) pmdie(SIGNAL_ARGS)
pmdie(int i)
#else
pmdie()
#endif
{ {
exitpg(0); exitpg(0);
} }
@ -674,11 +664,7 @@ pmdie()
* Reaper -- signal handler to cleanup after a backend (child) dies. * Reaper -- signal handler to cleanup after a backend (child) dies.
*/ */
static void static void
#if defined(PORTNAME_linux) reaper(SIGNAL_ARGS)
reaper(int i)
#else
reaper()
#endif
{ {
int status; /* backend exit status */ int status; /* backend exit status */
int pid; /* process id of dead backend */ int pid; /* process id of dead backend */
@ -1083,11 +1069,7 @@ ExitPostmaster(int status)
} }
static void static void
#if defined(PORTNAME_linux) dumpstatus(SIGNAL_ARGS)
dumpstatus(int i)
#else
dumpstatus()
#endif
{ {
Dlelem *curr = DLGetHead(PortList); Dlelem *curr = DLGetHead(PortList);
@ -1104,7 +1086,7 @@ dumpstatus()
} }
static void static void
checkDataDir() checkDataDir(void)
{ {
char path[MAXPATHLEN]; char path[MAXPATHLEN];
FILE *fp; FILE *fp;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -707,13 +707,13 @@ pg_eval_dest(char *query_string, /* string to execute */
*/ */
void void
handle_warn() handle_warn(SIGNAL_ARGS)
{ {
siglongjmp(Warn_restart, 1); siglongjmp(Warn_restart, 1);
} }
void void
quickdie() quickdie(SIGNAL_ARGS)
{ {
elog(NOTICE, "I have been signalled by the postmaster."); elog(NOTICE, "I have been signalled by the postmaster.");
elog(NOTICE, "Some backend process has died unexpectedly and possibly"); elog(NOTICE, "Some backend process has died unexpectedly and possibly");
@ -731,14 +731,14 @@ quickdie()
} }
void void
die() die(SIGNAL_ARGS)
{ {
ExitPostgres(0); ExitPostgres(0);
} }
/* signal handler for floating point exception */ /* signal handler for floating point exception */
void void
FloatExceptionHandler() FloatExceptionHandler(SIGNAL_ARGS)
{ {
elog(WARN, "floating point exception! the last floating point operation eit\ elog(WARN, "floating point exception! the last floating point operation eit\
her exceeded legal ranges or was a divide by zero"); her exceeded legal ranges or was a divide by zero");
@ -1269,7 +1269,7 @@ PostgresMain(int argc, char *argv[])
*/ */
if (IsUnderPostmaster == false) { if (IsUnderPostmaster == false) {
puts("\nPOSTGRES backend interactive interface"); 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 $");
} }
/* ---------------- /* ----------------

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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" #include "nodes/memnodes.h"
#if defined(PORTNAME_linux) extern void Async_NotifyHandler(SIGNAL_ARGS);
extern void Async_NotifyHandler(int);
#else
extern void Async_NotifyHandler(void);
#endif
extern void Async_Notify(char *relname); extern void Async_Notify(char *relname);
extern void Async_NotifyAtCommit(void); extern void Async_NotifyAtCommit(void);
extern void Async_NotifyAtAbort(void); extern void Async_NotifyAtAbort(void);

View File

@ -9,7 +9,7 @@
# #
# #
# IDENTIFICATION # 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)/../Makefile.global
-include $(MKDIR)/port/postgres.mk.$(PORTNAME) -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) CURDIR:= $(shell pwd)
# This is where we put all the .o's and the generated files. # This is where we put all the .o's and the generated files.