]> git.pld-linux.org Git - packages/db3.git/blob - db3-jbj.patch
- changed URLs to working ones
[packages/db3.git] / db3-jbj.patch
1 --- db-3.1.17/dist/aclocal/mutex.m4.jbj Sat Apr 29 15:03:49 2000
2 +++ db-3.1.17/dist/aclocal/mutex.m4     Sat Sep 30 01:03:03 2000
3 @@ -307,6 +307,42 @@
4  }], [db_cv_mutex="ia64/gcc-assembly"])
5  fi
6  
7 +dnl alphalinux/gcc: Linux
8 +if test "$db_cv_mutex" = no; then
9 +AC_TRY_RUN([main(){
10 +#if defined(__alpha__)
11 +#if defined(__linux__)
12 +       exit(0);
13 +#endif
14 +#endif
15 +       exit(1);
16 +}], [db_cv_mutex="alphalinux/gcc-assembly"])
17 +fi
18 +
19 +dnl sparc32linux/gcc: Linux
20 +if test "$db_cv_mutex" = no; then
21 +AC_TRY_RUN([main(){
22 +#if defined(__sparc__) && !defined(__arch64__)
23 +#if defined(__linux__)
24 +       exit(0);
25 +#endif
26 +#endif
27 +       exit(1);
28 +}], [db_cv_mutex="sparc32linux/gcc-assembly"])
29 +fi
30 +
31 +dnl sparc64linux/gcc: Linux
32 +if test "$db_cv_mutex" = no; then
33 +AC_TRY_RUN([main(){
34 +#if defined(__sparc__) && defined(__arch64__)
35 +#if defined(__linux__)
36 +       exit(0);
37 +#endif
38 +#endif
39 +       exit(1);
40 +}], [db_cv_mutex="sparc64linux/gcc-assembly"])
41 +fi
42 +
43  dnl: uts/cc: UTS
44  if test "$db_cv_mutex" = no; then
45  AC_TRY_RUN([main(){
46 @@ -370,5 +406,11 @@
47                         AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY);;
48  x86/gcc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
49                         AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY);;
50 +alphalinux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
51 +                       AC_DEFINE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY);;
52 +sparc32linux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
53 +                       AC_DEFINE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY);;
54 +sparc64linux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
55 +                       AC_DEFINE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY);;
56  esac
57  ])dnl
58 --- db-3.1.17/dist/acconfig.h.jbj       Tue May 16 11:40:44 2000
59 +++ db-3.1.17/dist/acconfig.h   Sat Sep 30 01:03:03 2000
60 @@ -48,6 +48,9 @@
61  #undef HAVE_MUTEX_WIN16
62  #undef HAVE_MUTEX_WIN32
63  #undef HAVE_MUTEX_X86_GCC_ASSEMBLY
64 +#undef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
65 +#undef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
66 +#undef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
67  
68  /* Define if building RPC client/server. */
69  #undef HAVE_RPC
70 --- db-3.1.17/include/mutex.h.jbj       Sat Sep 30 01:10:35 2000
71 +++ db-3.1.17/include/mutex.h   Sat Sep 30 01:15:44 2000
72 @@ -341,6 +341,29 @@
73  typedef unsigned char tsl_t;
74  #endif
75  
76 +/*********************************************************************
77 + * alphalinux/gcc assembly.
78 + *********************************************************************/
79 +#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
80 +typedef unsigned long int tsl_t;
81 +
82 +#define        MUTEX_ALIGN     8
83 +#endif
84 +
85 +/*********************************************************************
86 + * sparc32linux/gcc assembly.
87 + *********************************************************************/
88 +#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
89 +typedef unsigned char tsl_t;
90 +#endif
91 +
92 +/*********************************************************************
93 + * sparc64linux/gcc assembly.
94 + *********************************************************************/
95 +#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
96 +typedef unsigned char tsl_t;
97 +#endif
98 +
99  /*
100   * Mutex alignment defaults to one byte.
101   *
102 --- db-3.1.17/mutex/sparc32linux.gcc.jbj        Sat Sep 30 01:03:03 2000
103 +++ db-3.1.17/mutex/sparc32linux.gcc    Sat Sep 30 01:03:03 2000
104 @@ -0,0 +1,30 @@
105 +
106 +/*
107 + * The ldstub instruction takes the location specified by its first argument
108 + * (a register containing a memory address) and loads its contents into its
109 + * second argument (a register) and atomically sets the contents the location
110 + * specified by its first argument to a byte of 1s.  (The value in the second
111 + * argument is never read, but only overwritten.)
112 + *
113 + * The stbar is needed for v8, and is implemented as membar #sync on v9,
114 + + so is functional there as well.  For v7, stbar may generate an illegal
115 + + instruction and we have no way to tell what we're running on.  Some
116 + + operating systems notice and skip this instruction in the fault handler.
117 + *
118 + * For gcc/sparc, 0 is clear, 1 is set.
119 + *
120 + * Adapted from glibc-2.1.94 pthreads/sysdeps/sparc/sparc32/pspinlock.c.
121 + */
122 +#define        MUTEX_SET(tsl) ({                                               \
123 +       register tsl_t *__l = (tsl);                                    \
124 +       register tsl_t __r;                                             \
125 +       __asm__ volatile                                                \
126 +           ("ldstub [%1], %0"                                          \
127 +           : "=r" (__r)                                                \
128 +           : "r" (__l)                                                 \
129 +           : "memory");                                                \
130 +       !__r;                                                           \
131 +})
132 +
133 +#define        MUTEX_UNSET(tsl)        (*(tsl) = 0)
134 +#define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
135 --- db-3.1.17/mutex/mut_tas.c.jbj       Wed May 31 17:38:14 2000
136 +++ db-3.1.17/mutex/mut_tas.c   Sat Sep 30 01:03:03 2000
137 @@ -43,6 +43,15 @@
138  #ifdef HAVE_MUTEX_X86_GCC_ASSEMBLY
139  #include "x86.gcc"
140  #endif
141 +#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
142 +#include "alphalinux.gcc"
143 +#endif
144 +#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
145 +#include "sparc32linux.gcc"
146 +#endif
147 +#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
148 +#include "sparc64linux.gcc"
149 +#endif
150  
151  #ifdef DIAGNOSTIC
152  #undef MSG1
153 --- db-3.1.17/mutex/sparc64linux.gcc.jbj        Sat Sep 30 01:03:03 2000
154 +++ db-3.1.17/mutex/sparc64linux.gcc    Sat Sep 30 01:03:03 2000
155 @@ -0,0 +1,33 @@
156 +
157 +/*
158 + * $Id$
159 + *
160 + * The ldstub instruction takes the location specified by its first argument
161 + * (a register containing a memory address) and loads its contents into its
162 + * second argument (a register) and atomically sets the contents the location
163 + * specified by its first argument to a byte of 1s.  (The value in the second
164 + * argument is never read, but only overwritten.)
165 + *
166 + * The stbar is needed for v8, and is implemented as membar #sync on v9,
167 + + so is functional there as well.  For v7, stbar may generate an illegal
168 + + instruction and we have no way to tell what we're running on.  Some
169 + + operating systems notice and skip this instruction in the fault handler.
170 + *
171 + * For gcc/sparc, 0 is clear, 1 is set.
172 + *
173 + * Adapted from glibc-2.1.94 pthreads/sysdeps/sparc/sparc64/pspinlock.c.
174 + */
175 +#define        MUTEX_SET(tsl) ({                                               \
176 +       register tsl_t *__l = (tsl);                                    \
177 +       register tsl_t __r;                                             \
178 +       __asm__ volatile                                                \
179 +           ("ldstub [%1], %0\n"                                        \
180 +           "membar #StoreLoad | #StoreStore"                           \
181 +           : "=r" (__r)                                                \
182 +           : "r" (__l)                                                 \
183 +           : "memory");                                                \
184 +       !__r;                                                           \
185 +})
186 +
187 +#define        MUTEX_UNSET(tsl)        (*(tsl) = 0)
188 +#define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
189 --- db-3.1.17/mutex/alphalinux.gcc.jbj  Sat Sep 30 01:03:03 2000
190 +++ db-3.1.17/mutex/alphalinux.gcc      Sat Sep 30 01:03:03 2000
191 @@ -0,0 +1,46 @@
192 + * For gcc/alpha.
193 + *
194 + * Should return 0 if could not acquire the lock, 1 if lock was acquired
195 + * properly.
196 + */
197 +#ifdef __GNUC__
198 +static inline int
199 +MUTEX_SET(tsl_t *tsl) {
200 +       register tsl_t *__l = tsl;
201 +       unsigned long int __r;
202 +       unsigned long int temp;
203 +       __asm__ volatile(
204 +               ("1:    ldl_l   %0,%1\n"
205 +               "       and     %0,%3,%2\n"
206 +               "       bne     %2,2f\n"
207 +               "       xor     %0,%3,%0\n"
208 +               "       stl_c   %0,%1\n"
209 +               "       beq     %0,3f\n"
210 +               "       mb\n"
211 +               "2:\n"
212 +               ".subsection 2\n"
213 +               "3:     br      1b\n"
214 +               ".previous"
215 +               : "=&r" (temp), "=m" (*__l), "=&r" (__r)
216 +               : "Ir" (1UL), "m" (*__l));
217 +       return __r;
218 +}
219 +
220 +/*
221 + * Unset mutex. Judging by Alpha Architecture Handbook, the mb instruction
222 + * might be necessary before unlocking
223 + */
224 +static inline int
225 +MUTEX_UNSET(tsl_t *tsl) {
226 +       asm volatile("  mb\n");
227 +       return *tsl = 0;
228 +}
229 +#endif
230 +
231 +#ifdef __DECC
232 +#include <alpha/builtins.h>
233 +#define        MUTEX_SET(tsl)          (__LOCK_LONG_RETRY((tsl), 1) != 0)
234 +#define        MUTEX_UNSET(tsl)        (*(tsl) = 0)
235 +#endif
236 +
237 +#define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
This page took 0.073216 seconds and 3 git commands to generate.