mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-04-06 20:31:03 +08:00
From: Jeroen van Vianen <jeroenv@design.nl>
Attached patch will add a version() function to Postges, e.g. template1=> select version(); version ------------------------------------------------------------ PostgreSQL 6.3.2 on i586-pc-linux-gnu, compiled by gcc 2.8.1 (1 row)
This commit is contained in:
parent
bab9818c4b
commit
51a1741cfb
@ -4,7 +4,7 @@
|
||||
# Makefile for storage/buffer
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/storage/buffer/Makefile,v 1.7 1998/04/06 00:24:58 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/storage/buffer/Makefile,v 1.8 1998/04/29 12:37:51 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -24,7 +24,11 @@ depend dep:
|
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
clean:
|
||||
rm -f SUBSYS.o $(OBJS)
|
||||
rm -f SUBSYS.o $(OBJS) tas_test
|
||||
|
||||
tas_test: s_lock.c
|
||||
$(CC) $(CFLAGS) -DTAS_TEST=1 -g s_lock.c -o tas_test
|
||||
./tas_test
|
||||
|
||||
ifeq (depend,$(wildcard depend))
|
||||
include depend
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Makefile for utils/adt
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.12 1998/04/06 00:26:19 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.13 1998/04/29 12:38:01 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -22,7 +22,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o date.o \
|
||||
misc.o nabstime.o name.o not_in.o numutils.o oid.o \
|
||||
oidname.o oidint2.o oidint4.o oracle_compat.o regexp.o regproc.o \
|
||||
selfuncs.o \
|
||||
tid.o varchar.o varlena.o sets.o datetime.o like.o timestamp.o
|
||||
tid.o varchar.o varlena.o sets.o datetime.o like.o timestamp.o version.o
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
|
28
src/backend/utils/adt/version.c
Normal file
28
src/backend/utils/adt/version.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* version.c--
|
||||
* Returns the version string
|
||||
*
|
||||
* IDENTIFICATION
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.1 1998/04/29 12:38:05 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
text* version(void);
|
||||
|
||||
text* version(void)
|
||||
{
|
||||
int n = strlen(PG_VERSION_STR) + VARHDRSZ;
|
||||
text *ret = (text *) palloc(n);
|
||||
|
||||
VARSIZE(ret) = n;
|
||||
strcpy(VARDATA(ret), PG_VERSION_STR);
|
||||
|
||||
return ret;
|
||||
}
|
555
src/configure
vendored
555
src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -300,6 +300,14 @@ else
|
||||
AC_PROG_CC
|
||||
fi
|
||||
|
||||
if test "$CC" = "gcc"
|
||||
then
|
||||
CC_VERSION=`${CC} --version`
|
||||
else
|
||||
CC_VERSION=""
|
||||
fi
|
||||
AC_SUBST(CC_VERSION)
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
echo "- setting CPPFLAGS=$CPPFLAGS"
|
||||
@ -413,7 +421,7 @@ if test "$TRSTRINGS" = "ABCDEF"; then
|
||||
elif test "$TRCLASS" = "ABCDEF"; then
|
||||
TRARGS="'[[:lower:]]' '[[:upper:]]'"
|
||||
else
|
||||
AC_MSG_ERROR("Can\'t find method to covert from upper to lower case with tr")
|
||||
AC_MSG_ERROR("Can\'t find method to convert from upper to lower case with tr")
|
||||
fi
|
||||
AC_SUBST(TRARGS)
|
||||
|
||||
@ -697,4 +705,4 @@ then
|
||||
LDFLAGS="$ice_save_LDFLAGS"
|
||||
fi
|
||||
|
||||
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/lib/Makefile )
|
||||
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/lib/Makefile include/version.h)
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_proc.h,v 1.54 1998/04/27 17:08:41 scrappy Exp $
|
||||
* $Id: pg_proc.h,v 1.55 1998/04/29 12:39:32 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The script catalog/genbki.sh reads this file and generates .bki
|
||||
@ -1922,6 +1922,10 @@ DESCR("sequence next value");
|
||||
DATA(insert OID = 1319 ( currval PGUID 11 f t f 1 f 23 "25" 100 0 0 100 foo bar ));
|
||||
DESCR("sequence current value");
|
||||
|
||||
DATA(insert OID = 1600 ( version PGUID 11 f t t 0 f 25 "" 100 0 0 100 foo bar ));
|
||||
DESCR("PostgreSQL version string");
|
||||
|
||||
|
||||
/*
|
||||
* prototypes for functions pg_proc.c
|
||||
*/
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define JMP_BUF
|
||||
#define USE_POSIX_TIME
|
||||
#define USE_POSIX_SIGNALS
|
||||
#define NEED_I386_TAS_ASM
|
||||
#define HAS_TEST_AND_SET
|
||||
|
||||
#if defined(PPC)
|
||||
@ -16,7 +15,7 @@ typedef unsigned int slock_t;
|
||||
#elif defined(__alpha)
|
||||
typedef long int slock_t;
|
||||
|
||||
#else
|
||||
#else /* i386 probably */
|
||||
typedef unsigned char slock_t;
|
||||
|
||||
#endif
|
||||
|
@ -7,28 +7,49 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.29 1998/04/27 14:45:33 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.30 1998/04/29 12:40:56 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* DESCRIPTION
|
||||
* The following code fragment should be written (in assembly
|
||||
* language) on machines that have a native test-and-set instruction:
|
||||
* The public functions that must be provided are:
|
||||
*
|
||||
* void S_INIT_LOCK(slock_t *lock)
|
||||
*
|
||||
* void S_LOCK(slock_t *lock)
|
||||
*
|
||||
* void S_UNLOCK(slock_t *lock)
|
||||
*
|
||||
* int S_LOCK_FREE(slock_t *lock)
|
||||
* Tests if the lock is free. Returns non-zero if free, 0 if locked.
|
||||
*
|
||||
* The S_LOCK() function (in s_lock.c) implements a primitive but
|
||||
* still useful random backoff to avoid hordes of busywaiting lockers
|
||||
* chewing CPU.
|
||||
*
|
||||
* void
|
||||
* S_LOCK(char_address)
|
||||
* char *char_address;
|
||||
* S_LOCK(slock_t *lock)
|
||||
* {
|
||||
* while (test_and_set(char_address))
|
||||
* ;
|
||||
* while (TAS(lock))
|
||||
* {
|
||||
* // back off the cpu for a semi-random short time
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* If this is not done, POSTGRES will default to using System V
|
||||
* semaphores (and take a large performance hit -- around 40% of
|
||||
* its time on a DS5000/240 is spent in semop(3)...).
|
||||
* This implementation takes advantage of a tas function written
|
||||
* (in assembly language) on machines that have a native test-and-set
|
||||
* instruction. Alternative mutex implementations may also be used.
|
||||
* This function is hidden under the TAS macro to allow substitutions.
|
||||
*
|
||||
* NOTES
|
||||
* #define TAS(lock) tas(lock)
|
||||
* int tas(slock_t *lock) // True if lock already set
|
||||
*
|
||||
* If none of this can be done, POSTGRES will default to using
|
||||
* System V semaphores (and take a large performance hit -- around 40%
|
||||
* of its time on a DS5000/240 is spent in semop(3)...).
|
||||
*
|
||||
* NOTES
|
||||
* AIX has a test-and-set but the recommended interface is the cs(3)
|
||||
* system call. This provides an 8-instruction (plus system call
|
||||
* overhead) uninterruptible compare-and-set operation. True
|
||||
@ -36,6 +57,10 @@
|
||||
* regression test suite by about 25%. I don't have an assembler
|
||||
* manual for POWER in any case.
|
||||
*
|
||||
* There are default implementations for all these macros at the bottom
|
||||
* of this file. Check if your platform can use these or needs to
|
||||
* override them.
|
||||
*
|
||||
*/
|
||||
#ifndef S_LOCK_H
|
||||
#define S_LOCK_H
|
||||
@ -44,22 +69,41 @@
|
||||
|
||||
#if defined(HAS_TEST_AND_SET)
|
||||
|
||||
#if defined(linux)
|
||||
/***************************************************************************
|
||||
* All Linux
|
||||
*/
|
||||
|
||||
#if defined(__alpha__)
|
||||
|
||||
#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
|
||||
|
||||
#endif /* defined(__alpha__) && defined(linux) */
|
||||
|
||||
|
||||
|
||||
|
||||
#else /* defined(linux) */
|
||||
/***************************************************************************
|
||||
* All non Linux
|
||||
*/
|
||||
|
||||
#if defined (nextstep)
|
||||
/*
|
||||
* NEXTSTEP (mach)
|
||||
* slock_t is defined as a struct mutex.
|
||||
*/
|
||||
|
||||
#define S_LOCK(lock) mutex_lock(lock)
|
||||
|
||||
#define S_UNLOCK(lock) mutex_unlock(lock)
|
||||
|
||||
#define S_INIT_LOCK(lock) mutex_init(lock)
|
||||
|
||||
/* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
|
||||
/* For Mach, we have to delve inside the entrails of `struct mutex'. Ick! */
|
||||
#define S_LOCK_FREE(alock) ((alock)->lock == 0)
|
||||
|
||||
#endif /* next */
|
||||
#endif /* nextstep */
|
||||
|
||||
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* version.h--
|
||||
* this file contains the interface to version.c.
|
||||
* Also some parameters.
|
||||
*
|
||||
* $Id: version.h,v 1.8 1998/04/26 04:08:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
void
|
||||
ValidatePgVersion(const char *path, char **reason_p);
|
||||
|
||||
void
|
||||
SetPgVersion(const char *path, char **reason_p);
|
||||
|
||||
#define PG_RELEASE 6
|
||||
#define PG_VERSION 4
|
||||
#define PG_VERFILE "PG_VERSION"
|
||||
|
||||
#endif
|
25
src/include/version.h.in
Normal file
25
src/include/version.h.in
Normal file
@ -0,0 +1,25 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* version.h.in--
|
||||
* this file contains the interface to version.c.
|
||||
* Also some parameters.
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/include/Attic/version.h.in,v 1.1 1998/04/29 12:39:21 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
void ValidatePgVersion(const char *path, char **reason_p);
|
||||
void SetPgVersion(const char *path, char **reason_p);
|
||||
|
||||
#define PG_RELEASE "6"
|
||||
#define PG_VERSION "3"
|
||||
#define PG_SUBVERSION "2"
|
||||
|
||||
#define PG_VERFILE "PG_VERSION"
|
||||
|
||||
#define PG_VERSION_STR "PostgreSQL " ## PG_RELEASE ## "." ## PG_VERSION ## "." ## PG_SUBVERSION ## " on @host@, compiled by @CC@ @CC_VERSION@"
|
||||
|
||||
#endif
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.8 1997/09/08 02:41:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.9 1998/04/29 12:41:29 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* XXX eventually, should be able to handle version identifiers
|
||||
@ -88,12 +88,12 @@ ValidatePgVersion(const char *path, char **reason_p)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (version[2] != '0' + PG_VERSION ||
|
||||
version[0] != '0' + PG_RELEASE)
|
||||
if (version[2] != PG_VERSION[0] ||
|
||||
version[0] != PG_RELEASE[0])
|
||||
{
|
||||
*reason_p = malloc(200);
|
||||
sprintf(*reason_p,
|
||||
"Version number in file '%s' should be %d.%d, "
|
||||
"Version number in file '%s' should be %s.%s, "
|
||||
"not %c.%c.",
|
||||
full_path,
|
||||
PG_RELEASE, PG_VERSION, version[0], version[2]);
|
||||
@ -135,9 +135,9 @@ SetPgVersion(const char *path, char **reason_p)
|
||||
{
|
||||
int rc; /* return code from some function we call */
|
||||
|
||||
version[0] = '0' + PG_RELEASE;
|
||||
version[0] = PG_RELEASE[0];
|
||||
version[1] = '.';
|
||||
version[2] = '0' + PG_VERSION;
|
||||
version[2] = PG_VERSION[0];
|
||||
version[3] = '\n';
|
||||
rc = write(fd, version, 4);
|
||||
if (rc != 4)
|
||||
|
Loading…
x
Reference in New Issue
Block a user