1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

mkLinux patches from Tatsuo Ishii.

This commit is contained in:
Bruce Momjian
1997-07-29 14:09:11 +00:00
parent 7c5afb87c3
commit 8d25436d70
7 changed files with 97 additions and 10 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.14 1997/06/06 01:37:14 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.15 1997/07/29 14:07:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -521,5 +521,45 @@ S_INIT_LOCK(slock_t *lock)
#endif /* NEED_NS32K_TAS_ASM */
#if defined(linux) && defined(PPC)
static int tas_dummy()
{
__asm__("
tas: /* r3 points to the location of p */
lwarx 5,0,3 /* r5 = *p */
cmpwi 5,0 /* r5 == 0 ? */
bne fail /* if not 0, jump to fail */
addi 5,5,1 /* set 1 to r5 */
stwcx. 5,0,3 /* try update p atomically */
beq success /* jump if scceed */
fail: li 3,1 /* set 1 to r3 */
blr
success:
li 3,0 /* set 0 to r3 */
blr
");
}
void
S_LOCK(slock_t *lock)
{
while (tas(lock))
;
}
void
S_UNLOCK(slock_t *lock)
{
*lock = 0;
}
void
S_INIT_LOCK(slock_t *lock)
{
S_UNLOCK(lock);
}
#endif /* defined(linux) && defined(PPC) */
#endif /* HAS_TEST_AND_SET */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.29 1997/07/24 20:15:53 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.30 1997/07/29 14:07:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3758,3 +3758,30 @@ printf( "EncodeTimeSpan- result is %s\n", str);
return 0;
} /* EncodeTimeSpan() */
#if defined(linux) && defined(PPC)
int datetime_is_epoch(double j)
{
static union {
double epoch;
unsigned char c[8];
} u;
u.c[0] = 0x80; /* sign bit */
u.c[1] = 0x10; /* DBL_MIN */
return(j == u.epoch);
}
int datetime_is_current(double j)
{
static union {
double current;
unsigned char c[8];
} u;
u.c[1] = 0x10; /* DBL_MIN */
return(j == u.current);
}
#endif