Fixes:
authorMarc G. Fournier
Thu, 1 Aug 1996 05:11:33 +0000 (05:11 +0000)
committerMarc G. Fournier
Thu, 1 Aug 1996 05:11:33 +0000 (05:11 +0000)
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
src/backend/storage/proc.h

index 6f8ce2cc99489f51e4b6b8357b36719706b865ba..edba19c3192bd3a6927312c77b71bfbc28708d03 100644 (file)
@@ -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
index 1ec89dedc2d2de1f625f9a6b8afcfe9f04e400c5..a9476fe2a63ac2f9e58c3323b1e0c116d50f7843 100644 (file)
@@ -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);