1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Postgres95 1.01 Distribution - Virgin Sources

This commit is contained in:
Marc G. Fournier
1996-07-09 06:22:35 +00:00
commit d31084e9d1
868 changed files with 242656 additions and 0 deletions

View File

@ -0,0 +1,68 @@
#-------------------------------------------------------------------------
#
# Makefile.inc--
# Makefile for port/hpux (HP-UX specific stuff)
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
#
#-------------------------------------------------------------------------
#
# HP-UX needs:
# -W l,-E export symbols for linking with the shared libraries
# dynamic loader
# -W p,-H400000 expand cpp #define table size so the Nodes files don't
# break it
#
# -W p,-H400000
ifeq ($(CC), cc)
CFLAGS+= -W l,-E
LDFLAGS+= -W l,-E
LDADD+= -ll -ldld
else
ifeq ($(CC), gcc)
LDADD+= -ll /usr/lib/libdld.sl
endif
endif
CFLAGS+= -DUSE_POSIX_TIME
#
# cbrt(3m) and rint(3m) are missing from 8.07.
# cbrt(3m) and rint(3m) are broken in 9.01.
# cbrt(3m) seems to be missing on 9.00 even though it is documented.
#
CFLAGS+= -DNEED_RINT -DNEED_CBRT
#
# The #pragma trick required on 8.07 no longer works -- the #pragma
# is thoroughly broken. However, the +u flag has been extended to
# handle alignment requirement arguments (defaulting to 2) for things
# other than struct references, so the #pragma is no longer needed.
#
#
# (1) The YACC grammar is too big..
# (HP-UX 9.0x, x<2, added basic block limits for +O2; 9.0x, x>=2, changed
# the syntax to something else.)
#
# (2) The 9.00 optimizer chokes on some of our source.
#
#.if (${HPUX_MAJOR} == "09")
#. if !defined(CDEBUG)
#. if (${HPUX_MINOR} == "00" || ${HPUX_MINOR} == "01")
#CFLAGS+= +Obb600
#CFLAGS+= -DWEAK_C_OPTIMIZER
#. else
#CFLAGS+= +Onolimit
#. endif
#. endif
#.endif
HEADERS+= fixade.h machine.h port-protos.h
SUBSRCS+= dynloader.c port.c tas.s

View File

@ -0,0 +1,57 @@
/*-------------------------------------------------------------------------
*
* dynloader.c--
* dynamic loader for HP-UX using the shared library mechanism
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/dynloader.c,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
* shl_* routines from the bundled HP-UX debugger.
*
*-------------------------------------------------------------------------
*/
/* System includes */
#include <stdio.h>
#include <a.out.h>
#include <dl.h>
#include "c.h"
#include "fmgr.h"
#include "utils/dynamic_loader.h"
#include "port-protos.h"
void *
pg_dlopen(char *filename)
{
shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
return((void *) handle);
}
func_ptr
pg_dlsym(void *handle, char *funcname)
{
func_ptr f;
if (shl_findsym((shl_t *) &handle, funcname, TYPE_PROCEDURE, &f) == -1) {
f = (func_ptr) NULL;
}
return(f);
}
void
pg_dlclose(void *handle)
{
shl_unload((shl_t) handle);
}
char *
pg_dlerror()
{
static char errmsg[]= "shl_load failed";
return errmsg;
}

View File

@ -0,0 +1,63 @@
/*-------------------------------------------------------------------------
*
* fixade.h--
* compiler tricks to make things work while POSTGRES does non-native
* dereferences on PA-RISC.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: fixade.h,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
*
* NOTES
* This must be included in EVERY source file.
*
*-------------------------------------------------------------------------
*/
#ifndef FIXADE_H
#define FIXADE_H
#if !defined(NOFIXADE)
#if defined(HP_S500_ALIGN)
/* ----------------
* This cheesy hack turns ON unaligned-access fixup on H-P PA-RISC;
* the resulting object files contain code that explicitly handles
* realignment on reference, so it slows memory access down by a
* considerable factor. It must be used in conjunction with the +u
* flag to cc. The #pragma is included in c.h to be safe since EVERY
* source file that performs unaligned access must contain the #pragma.
* ----------------
*/
#pragma HP_ALIGN HPUX_NATURAL_S500
#if defined(BROKEN_STRUCT_INIT)
/* ----------------
* This is so bogus. The HP-UX 9.01 compiler has totally broken
* struct initialization code. It actually length-checks ALL
* array initializations within structs against the FIRST one that
* it sees (when #pragma HP_ALIGN HPUX_NATURAL_S500 is defined)..
* we have to throw in this unused structure before struct varlena
* is defined.
*
* XXX guess you don't need the #pragma anymore after all :-)
* since no one looks at this except me i think i'll just leave
* this here for now..
* ----------------
*/
struct HP_WAY_BOGUS {
char hpwb_bogus[8192];
};
struct HP_TOO_BOGUS {
int hptb_bogus[8192];
};
#endif /* BROKEN_STRUCT_INIT */
#endif /* HP_S500_ALIGN */
#if defined(WEAK_C_OPTIMIZER)
#pragma OPT_LEVEL 1
#endif /* WEAK_C_OPTIMIZER */
#endif /* !NOFIXADE */
#endif /* FIXADE_H */

View File

@ -0,0 +1,18 @@
/*-------------------------------------------------------------------------
*
* machine.h--
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: machine.h,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef MACHINE_H
#define MACHINE_H
#define BLCKSZ 8192
#endif

View File

@ -0,0 +1,34 @@
/*-------------------------------------------------------------------------
*
* port-protos.h--
* port-specific prototypes for HP-UX
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: port-protos.h,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include <sys/resource.h> /* for struct rusage */
#include <dl.h> /* for shl_t */
#include "utils/dynamic_loader.h"
/* dynloader.c */
/* pg_dl{open,close,sym} prototypes are in utils/dynamic_loader.h */
/* port.c */
extern int init_address_fixup(void);
extern double rint(double x);
extern double cbrt(double x);
extern long random(void);
extern void srandom(int seed);
extern int getrusage(int who, struct rusage *ru);
#endif /* PORT_PROTOS_H */

View File

@ -0,0 +1,47 @@
/*-------------------------------------------------------------------------
*
* port.c--
* port-specific routines for HP-UX
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/port.c,v 1.1.1.1 1996/07/09 06:21:43 scrappy Exp $
*
* NOTES
* For the most part, this file gets around some non-POSIX calls
* in POSTGRES.
*
*-------------------------------------------------------------------------
*/
#include <unistd.h> /* for rand()/srand() prototypes */
#include <math.h> /* for pow() prototype */
#include <sys/syscall.h> /* for syscall #defines */
#include "c.h"
void
init_address_fixup()
{
/*
* On PA-RISC, unaligned access fixup is handled by the compiler,
* not by the kernel.
*/
}
long
random()
{
return(lrand48());
}
void srandom(int seed)
{
srand48((long int) seed);
}
getrusage(int who, struct rusage *ru)
{
return(syscall(SYS_GETRUSAGE, who, ru));
}

View File

@ -0,0 +1,36 @@
/*
* To generate tas.s using this template:
* 1. cc +O2 -S -c tas.c
* 2. edit tas.s:
* - replace the LDW with LDCWX
* For details about the LDCWX instruction, see the "Precision
* Architecture and Instruction Reference Manual" (09740-90014 of June
* 1987), p. 5-38.
*/
int
tas(lock)
int *lock; /* LDCWX is a word instruction */
{
/*
* LDCWX requires that we align the "semaphore" to a 16-byte
* boundary. The actual datum is a single word (4 bytes).
*/
lock = ((long) lock + 15) & ~15;
/*
* The LDCWX instruction atomically clears the target word and
* returns the previous value. Hence, if the instruction returns
* 0, someone else has already acquired the lock before we tested
* it (i.e., we have failed).
*
* Notice that this means that we actually clear the word to set
* the lock and set the word to clear the lock. This is the
* opposite behavior from the SPARC LDSTUB instruction. For some
* reason everything that H-P does is rather baroque...
*/
if (*lock) { /* this generates the LDW */
return(0); /* success */
}
return(1); /* failure */
}

View File

@ -0,0 +1,28 @@
.SPACE $TEXT$,SORT=8
.SUBSPA $CODE$,QUAD=0,ALIGN=4,ACCESS=44,CODE_ONLY,SORT=24
tas
.PROC
.CALLINFO CALLER,FRAME=0,ENTRY_SR=3
.ENTRY
LDO 15(%r26),%r31 ;offset 0x0
DEPI 0,31,4,%r31 ;offset 0x4
LDCWX 0(0,%r31),%r23 ;offset 0x8
COMICLR,= 0,%r23,%r0 ;offset 0xc
DEP,TR %r0,31,32,%r28 ;offset 0x10
$00000001
LDI 1,%r28 ;offset 0x14
$L0
.EXIT
BV,N %r0(%r2) ;offset 0x18
.PROCEND ;in=26;out=28;
.SPACE $TEXT$
.SUBSPA $CODE$
.SPACE $PRIVATE$,SORT=16
.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=16
.SPACE $TEXT$
.SUBSPA $CODE$
.EXPORT tas,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR
.END