Skip to content

Commit 58ed123

Browse files
committed
Fix for netbsd locking, from Henry B. Hotz.
1 parent e2617c8 commit 58ed123

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

src/include/port/BSD44_derived.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
#define USE_POSIX_TIME
2+
23
#if defined(i386)
34
#define NEED_I386_TAS_ASM
5+
#define HAS_TEST_AND_SET
46
#endif
7+
58
#if defined(sparc)
69
#define NEED_SPARC_TAS_ASM
10+
#define HAS_TEST_AND_SET
711
#endif
12+
813
#if defined(ns32k)
914
#define NEED_NS32k_TAS_ASM
15+
#define HAS_TEST_AND_SET
1016
#endif
17+
18+
#if defined(__m68k__)
1119
#define HAS_TEST_AND_SET
20+
#endif
21+
1222
#if defined(__mips__)
13-
/* # undef HAS_TEST_AND_SET */
23+
/* # undef HAS_TEST_AND_SET */
1424
#endif
1525
typedef unsigned char slock_t;

src/include/storage/s_lock.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.10 1997/10/03 15:27:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.11 1997/10/30 05:24:19 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -24,6 +24,10 @@
2424
* ;
2525
* }
2626
*
27+
* In addition to modifying this file you will need to modify
28+
* the appropriate ...src/include/port/...h file to define
29+
* HAS_TEST_AND_SET for the appropriate circumstances.
30+
*
2731
* If this is not done, POSTGRES will default to using System V
2832
* semaphores (and take a large performance hit -- around 40% of
2933
* its time on a DS5000/240 is spent in semop(3)...).
@@ -228,6 +232,31 @@ tas_dummy()
228232

229233
#endif /* sun3 */
230234

235+
/*
236+
* M68000 ports under NetBSD.
237+
*
238+
* This version should also work on a sun3, but I can't test it.
239+
* Conversely the sun3 version should work under NetBSD/m68k, but
240+
* it doesn't.
241+
*/
242+
#if defined(__NetBSD__) && defined(__m68k__)
243+
244+
static void S_LOCK(char *lock)
245+
{
246+
asm("
247+
movel a6@(8),a0
248+
LOOP:
249+
tas a0@
250+
bmi LOOP
251+
");
252+
}
253+
254+
#define S_UNLOCK(lock) (*(lock) = 0)
255+
256+
#define S_INIT_LOCK(lock) S_UNLOCK(lock)
257+
258+
#endif /* M68000 && NetBSD */
259+
231260
/*
232261
* sparc machines
233262
*/

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