Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42a3c46

Browse files
committed
Oops, missed adding a file
From: Ryan Kirkpatrick <rkirkpat@nag.cs.colorado.edu>
1 parent 8a0967a commit 42a3c46

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

src/backend/storage/buffer/s_lock.c

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* s_lock.c--
4+
* buffer manager interface routines
5+
*
6+
* Copyright (c) 1994, Regents of the University of California
7+
*
8+
*
9+
* IDENTIFICATION
10+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.1 1997/12/30 04:03:01 scrappy Exp $
11+
*
12+
*-------------------------------------------------------------------------
13+
*/
14+
/*
15+
* S_LOCK() -- Implements the S_LOCK function for the Linux/Alpha platform.
16+
* This function is usually an inlined macro for all other platforms,
17+
* but must be a seperate function for the Linux/Alpha platform, due
18+
* to the assembly code involved.
19+
*/
20+
21+
#if defined(__alpha__) && defined(linux)
22+
23+
#include <sys/types.h>
24+
#include <sys/file.h>
25+
#include <stdio.h>
26+
#include <string.h>
27+
#include <math.h>
28+
#include <signal.h>
29+
30+
#include "postgres.h"
31+
32+
/* declarations split between these three files */
33+
#include "storage/buf.h"
34+
#include "storage/buf_internals.h"
35+
#include "storage/bufmgr.h"
36+
37+
#include "storage/fd.h"
38+
#include "storage/ipc.h"
39+
#include "storage/s_lock.h"
40+
41+
void S_LOCK(slock_t* lock)
42+
{
43+
do
44+
{
45+
slock_t _res;
46+
do
47+
{
48+
__asm__(" ldq $0, %0 \n\
49+
bne $0, already_set \n\
50+
ldq_l $0, %0 \n\
51+
bne $0, already_set \n\
52+
or $31, 1, $0 \n\
53+
stq_c $0, %0 \n\
54+
beq $0, stqc_fail \n\
55+
success: bis $31, $31, %1 \n\
56+
mb \n\
57+
jmp $31, end \n\
58+
stqc_fail: or $31, 1, $0 \n\
59+
already_set: bis $0, $0, %1 \n\
60+
end: nop ": "=m"(*lock), "=r"(_res): :"0");
61+
} while (_res != 0);
62+
} while (0);
63+
}
64+
65+
#endif

0 commit comments

Comments
 (0)