Re: Hack to make postgres compile on Dec 4.0f with GCC - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Hack to make postgres compile on Dec 4.0f with GCC
Date
Msg-id 200006091733.NAA19468@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Can someone make a suggestion here?

> Hi.
>
> Here is a patch I hacked together. I didn't understand the TAS thing, and
> it appeared to be the cause of the problem. I hacked the code up by
> commenting out the assembly TAS provided and inserting the semaphore
> macros for the non-gcc alpha version. Perhaps someone with expertise in
> this area could assist in fixing the provided TAS.
>
> Here is the patch:
>
> -Michael
>
> *** include/storage/s_lock.h    Tue Mar 14 23:01:08 2000
> --- include/storage/s_lock.h.bak        Sat Mar 11 19:21:30 2000
> ***************
> *** 79,85 ****
>    */
>
>   #if defined(__alpha__)
> ! /*#define TAS(lock) tas(lock)
>   #define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
>
>   static __inline__ int
> --- 79,85 ----
>    */
>
>   #if defined(__alpha__)
> ! #define TAS(lock) tas(lock)
>   #define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
>
>   static __inline__ int
> ***************
> *** 102,118 ****
>                 4: nop      ": "=m"(*lock), "=r"(_res): :"0");
>
>         return (int) _res;
> ! }*/
> ! /*
> !  * OSF/1 (Alpha AXP)
> !  *
> !  * Note that slock_t on the Alpha AXP is msemaphore instead of char
> !  * (see storage/ipc.h).
> !  */
> ! #define TAS(lock)       (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
> ! #define S_UNLOCK(lock)  msem_unlock((lock), 0)
> ! #define S_INIT_LOCK(lock)       msem_init((lock), MSEM_UNLOCKED)
> ! #define S_LOCK_FREE(lock)       (!(lock)->msem_state)
>
>   #endif         /* __alpha__ */
>
> --- 102,108 ----
>                 4: nop      ": "=m"(*lock), "=r"(_res): :"0");
>
>         return (int) _res;
> ! }
>
>   #endif         /* __alpha__ */
>
>
>


--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Another jdbc2 ResultSet patch
Next
From: Giles Lean
Date:
Subject: Re: BeOS take 2