Skip to content

Commit 164ef6f

Browse files
committed
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 <maillist@candle.pha.pa.us>
1 parent 4d837e3 commit 164ef6f

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

src/backend/storage/lmgr/proc.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4 1996/07/31 02:19:09 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.5 1996/08/01 05:11:33 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@
4646
* This is so that we can support more backends. (system-wide semaphore
4747
* sets run out pretty fast.) -ay 4/95
4848
*
49-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4 1996/07/31 02:19:09 scrappy Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.5 1996/08/01 05:11:33 scrappy Exp $
5050
*/
5151
#include <sys/time.h>
5252
#ifndef WIN32
@@ -95,11 +95,6 @@ PROC *MyProc = NULL;
9595
static void ProcKill(int exitStatus, int pid);
9696
static void ProcGetNewSemKeyAndNum(IPCKey *key, int *semNum);
9797
static void ProcFreeSem(IpcSemaphoreKey semKey, int semNum);
98-
#if defined(PORTNAME_linux)
99-
extern void HandleDeadLock(int);
100-
#else
101-
extern int HandleDeadLock(void);
102-
#endif
10398
/*
10499
* InitProcGlobal -
105100
* initializes the global process table. We put it here so that
@@ -628,13 +623,8 @@ ProcAddLock(SHM_QUEUE *elem)
628623
* up my semaphore.
629624
* --------------------
630625
*/
631-
#if defined(PORTNAME_linux)
632-
void
633-
HandleDeadLock(int i)
634-
#else
635-
int
636-
HandleDeadLock()
637-
#endif
626+
void
627+
HandleDeadLock(int sig)
638628
{
639629
LOCK *lock;
640630
int size;
@@ -654,7 +644,7 @@ HandleDeadLock()
654644
if (IpcSemaphoreGetCount(MyProc->sem.semId, MyProc->sem.semNum) ==
655645
IpcSemaphoreDefaultStartValue) {
656646
UnlockLockTable();
657-
return 1;
647+
return;
658648
}
659649

660650
/*
@@ -671,7 +661,7 @@ HandleDeadLock()
671661
if (MyProc->links.prev == INVALID_OFFSET ||
672662
MyProc->links.next == INVALID_OFFSET) {
673663
UnlockLockTable();
674-
return(1);
664+
return;
675665
}
676666

677667
lock = MyProc->waitLock;
@@ -708,7 +698,7 @@ HandleDeadLock()
708698
UnlockLockTable();
709699

710700
elog(NOTICE, "Timeout -- possible deadlock");
711-
return 0;
701+
return;
712702
}
713703

714704
void

src/backend/storage/proc.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: proc.h,v 1.1.1.1 1996/07/09 06:21:53 scrappy Exp $
9+
* $Id: proc.h,v 1.2 1996/08/01 05:10:16 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -116,11 +116,7 @@ extern PROC *ProcWakeup(PROC *proc, int errType);
116116
extern int ProcGetId(void);
117117
extern int ProcLockWakeup(PROC_QUEUE *queue, char * ltable, char * lock);
118118
extern void ProcAddLock(SHM_QUEUE *elem);
119-
#if defined(PORTNAME_linux)
120-
extern int HandleDeadLock(int);
121-
#else
122-
extern int HandleDeadLock(void);
123-
#endif
119+
extern void HandleDeadLock(int sig);
124120
extern void ProcReleaseSpins(PROC *proc);
125121
extern void ProcFreeAllSemaphores(void);
126122

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy