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

Commit 8d25436

Browse files
committed
mkLinux patches from Tatsuo Ishii.
1 parent 7c5afb8 commit 8d25436

File tree

7 files changed

+97
-10
lines changed

7 files changed

+97
-10
lines changed

src/backend/storage/ipc/s_lock.c

+41-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.14 1997/06/06 01:37:14 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.15 1997/07/29 14:07:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -521,5 +521,45 @@ S_INIT_LOCK(slock_t *lock)
521521

522522
#endif /* NEED_NS32K_TAS_ASM */
523523

524+
#if defined(linux) && defined(PPC)
525+
526+
static int tas_dummy()
527+
{
528+
__asm__("
529+
tas: /* r3 points to the location of p */
530+
lwarx 5,0,3 /* r5 = *p */
531+
cmpwi 5,0 /* r5 == 0 ? */
532+
bne fail /* if not 0, jump to fail */
533+
addi 5,5,1 /* set 1 to r5 */
534+
stwcx. 5,0,3 /* try update p atomically */
535+
beq success /* jump if scceed */
536+
fail: li 3,1 /* set 1 to r3 */
537+
blr
538+
success:
539+
li 3,0 /* set 0 to r3 */
540+
blr
541+
");
542+
}
543+
544+
void
545+
S_LOCK(slock_t *lock)
546+
{
547+
while (tas(lock))
548+
;
549+
}
550+
551+
void
552+
S_UNLOCK(slock_t *lock)
553+
{
554+
*lock = 0;
555+
}
556+
557+
void
558+
S_INIT_LOCK(slock_t *lock)
559+
{
560+
S_UNLOCK(lock);
561+
}
562+
563+
#endif /* defined(linux) && defined(PPC) */
524564

525565
#endif /* HAS_TEST_AND_SET */

src/backend/utils/adt/dt.c

+28-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.29 1997/07/24 20:15:53 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.30 1997/07/29 14:07:54 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -3758,3 +3758,30 @@ printf( "EncodeTimeSpan- result is %s\n", str);
37583758

37593759
return 0;
37603760
} /* EncodeTimeSpan() */
3761+
3762+
3763+
#if defined(linux) && defined(PPC)
3764+
int datetime_is_epoch(double j)
3765+
{
3766+
static union {
3767+
double epoch;
3768+
unsigned char c[8];
3769+
} u;
3770+
3771+
u.c[0] = 0x80; /* sign bit */
3772+
u.c[1] = 0x10; /* DBL_MIN */
3773+
3774+
return(j == u.epoch);
3775+
}
3776+
int datetime_is_current(double j)
3777+
{
3778+
static union {
3779+
double current;
3780+
unsigned char c[8];
3781+
} u;
3782+
3783+
u.c[1] = 0x10; /* DBL_MIN */
3784+
3785+
return(j == u.current);
3786+
}
3787+
#endif

src/include/port/linux.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@
77
# define JMP_BUF
88
# define USE_POSIX_TIME
99
# define USE_POSIX_SIGNALS
10-
# if !defined(PPC)
11-
# define NEED_I386_TAS_ASM
12-
# define HAS_TEST_AND_SET
10+
# define NEED_I386_TAS_ASM
11+
# define HAS_TEST_AND_SET
12+
13+
# if defined(PPC)
14+
typedef unsigned int slock_t;
15+
# else
1316
typedef unsigned char slock_t;
1417
# endif
18+
19+
# if defined(PPC)
20+
# undef NEED_I386_TAS_ASM
21+
# undef HAVE_INT_TIMEZONE
22+
# endif
23+
1524
# if defined(sparc)
1625
# undef NEED_I386_TAS_ASM
1726
# endif

src/include/utils/dt.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: dt.h,v 1.13 1997/07/01 00:25:30 thomas Exp $
11+
* $Id: dt.h,v 1.14 1997/07/29 14:08:21 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -215,10 +215,20 @@ typedef struct {
215215
#define DATETIME_IS_NOEND(j) (j == DT_NOEND)
216216

217217
#define DATETIME_CURRENT(j) {j = DT_CURRENT;}
218+
#if defined(linux) && defined(PPC)
219+
extern int datetime_is_current(double j);
220+
#define DATETIME_IS_CURRENT(j) datetime_is_current(j)
221+
#else
218222
#define DATETIME_IS_CURRENT(j) (j == DT_CURRENT)
223+
#endif
219224

220225
#define DATETIME_EPOCH(j) {j = DT_EPOCH;}
226+
#if defined(linux) && defined(PPC)
227+
extern int datetime_is_epoch(double j);
228+
#define DATETIME_IS_EPOCH(j) datetime_is_epoch(j)
229+
#else
221230
#define DATETIME_IS_EPOCH(j) (j == DT_EPOCH)
231+
#endif
222232

223233
#define DATETIME_IS_RELATIVE(j) (DATETIME_IS_CURRENT(j) || DATETIME_IS_EPOCH(j))
224234
#define DATETIME_NOT_FINITE(j) (DATETIME_IS_INVALID(j) \

src/interfaces/libpq/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.35 1997/04/04 10:42:34 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.36 1997/07/29 14:08:34 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -34,6 +34,7 @@ ifeq ($(PORTNAME), linux)
3434
install-shlib-dep := install-shlib
3535
shlib := libpq.so.1
3636
LDFLAGS_SL = -shared
37+
CFLAGS += $(CFLAGS_SL)
3738
endif
3839
endif
3940
ifeq ($(PORTNAME), BSD44_derived)

src/makefiles/Makefile.linux

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ifdef LINUX_ELF
2-
LDFLAGS+= -rdynamic -Wl,-rpath -Wl,$(DESTDIR)$(LIBDIR)
2+
LDFLAGS+= -export-dynamic -Wl,-rpath -Wl,$(DESTDIR)$(LIBDIR)
33
endif
44
MK_NO_LORDER= true
55

src/test/regress/GNUmakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.8 1997/06/06 01:35:57 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.9 1997/07/29 14:09:11 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

1414
SRCDIR= ../..
1515
include ../../Makefile.global
1616

17-
CFLAGS+= -I$(LIBPQDIR) -I../../include
17+
CFLAGS+= -I$(LIBPQDIR) -I../../include $(CFLAGS_SL)
1818

1919
LDADD+= -L$(LIBPQDIR) -lpq
2020

0 commit comments

Comments
 (0)