From 164ef6ff2b4f4c8ee203003193178d2e2cb2ff68 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Thu, 1 Aug 1996 05:11:33 +0000 Subject: [PATCH] Fixes: Originally, I thought the problem was caused by a function that gets called as a normal function where we want to return a value, and as a signal handler where we need to have it accept a parameter (the signal number) and it returns nothing, I was going to case the function name in the signal call as (void (*)(int)). Looking at all the source, it turns out this function only gets used as a signal handler, so I set an int parameter and return void. I have removed the Linux defines because they are not needed. BSD let this sloppiness slide. Linux gave a compile error. Submitted by: Bruce Momjian --- src/backend/storage/lmgr/proc.c | 24 +++++++----------------- src/backend/storage/proc.h | 8 ++------ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 6f8ce2cc99..edba19c319 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4 1996/07/31 02:19:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.5 1996/08/01 05:11:33 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ * This is so that we can support more backends. (system-wide semaphore * sets run out pretty fast.) -ay 4/95 * - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4 1996/07/31 02:19:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.5 1996/08/01 05:11:33 scrappy Exp $ */ #include #ifndef WIN32 @@ -95,11 +95,6 @@ PROC *MyProc = NULL; static void ProcKill(int exitStatus, int pid); static void ProcGetNewSemKeyAndNum(IPCKey *key, int *semNum); static void ProcFreeSem(IpcSemaphoreKey semKey, int semNum); -#if defined(PORTNAME_linux) -extern void HandleDeadLock(int); -#else -extern int HandleDeadLock(void); -#endif /* * InitProcGlobal - * initializes the global process table. We put it here so that @@ -628,13 +623,8 @@ ProcAddLock(SHM_QUEUE *elem) * up my semaphore. * -------------------- */ -#if defined(PORTNAME_linux) -void -HandleDeadLock(int i) -#else -int -HandleDeadLock() -#endif +void +HandleDeadLock(int sig) { LOCK *lock; int size; @@ -654,7 +644,7 @@ HandleDeadLock() if (IpcSemaphoreGetCount(MyProc->sem.semId, MyProc->sem.semNum) == IpcSemaphoreDefaultStartValue) { UnlockLockTable(); - return 1; + return; } /* @@ -671,7 +661,7 @@ HandleDeadLock() if (MyProc->links.prev == INVALID_OFFSET || MyProc->links.next == INVALID_OFFSET) { UnlockLockTable(); - return(1); + return; } lock = MyProc->waitLock; @@ -708,7 +698,7 @@ HandleDeadLock() UnlockLockTable(); elog(NOTICE, "Timeout -- possible deadlock"); - return 0; + return; } void diff --git a/src/backend/storage/proc.h b/src/backend/storage/proc.h index 1ec89dedc2..a9476fe2a6 100644 --- a/src/backend/storage/proc.h +++ b/src/backend/storage/proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.1.1.1 1996/07/09 06:21:53 scrappy Exp $ + * $Id: proc.h,v 1.2 1996/08/01 05:10:16 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -116,11 +116,7 @@ extern PROC *ProcWakeup(PROC *proc, int errType); extern int ProcGetId(void); extern int ProcLockWakeup(PROC_QUEUE *queue, char * ltable, char * lock); extern void ProcAddLock(SHM_QUEUE *elem); -#if defined(PORTNAME_linux) -extern int HandleDeadLock(int); -#else -extern int HandleDeadLock(void); -#endif +extern void HandleDeadLock(int sig); extern void ProcReleaseSpins(PROC *proc); extern void ProcFreeAllSemaphores(void);