From 55aab6a43453efbc5e10e8381343d474c2d70298 Mon Sep 17 00:00:00 2001
From: "Marc G. Fournier" <scrappy@hub.org>
Date: Tue, 16 Jul 1996 07:13:58 +0000
Subject: [PATCH] fix: BSDi 2.1 requires a port seperate from BSDi 2.0{.1}

submitted by: Bruce Momjian (root@candle.pha.pa.us)
---
 src/Makefile.global                     |  3 +-
 src/backend/bootstrap/bootstrap.c       |  4 +--
 src/backend/optimizer/path/costsize.c   |  4 +--
 src/backend/port/bsdi_2_1/Makefile.inc  | 14 +++++++++
 src/backend/port/bsdi_2_1/machine.h     | 18 +++++++++++
 src/backend/port/bsdi_2_1/port-protos.h | 28 +++++++++++++++++
 src/backend/port/bsdi_2_1/port.c        | 13 ++++++++
 src/backend/postmaster/postmaster.c     |  4 +--
 src/backend/storage/ipc/s_lock.c        |  7 +++--
 src/backend/utils/Gen_fmgrtab.sh        | 10 +++----
 src/backend/utils/adt/misc.c            |  4 +--
 src/backend/utils/adt/numutils.c        |  4 +--
 src/backend/utils/error/elog.c          |  4 +--
 src/backend/utils/error/exc.c           |  4 +--
 src/mk/port/postgres.mk.bsdi_2_1        | 40 +++++++++++++++++++++++++
 15 files changed, 138 insertions(+), 23 deletions(-)
 create mode 100644 src/backend/port/bsdi_2_1/Makefile.inc
 create mode 100644 src/backend/port/bsdi_2_1/machine.h
 create mode 100644 src/backend/port/bsdi_2_1/port-protos.h
 create mode 100644 src/backend/port/bsdi_2_1/port.c
 create mode 100644 src/mk/port/postgres.mk.bsdi_2_1

diff --git a/src/Makefile.global b/src/Makefile.global
index c4d5a3f5987..b1992db310c 100644
--- a/src/Makefile.global
+++ b/src/Makefile.global
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.3 1996/07/15 19:10:32 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.4 1996/07/16 07:12:10 scrappy Exp $
 #
 # NOTES
 #    This is seen by any Makefiles that include mk/postgres.mk. To
@@ -43,6 +43,7 @@
 #				"LINUX_ELF=1" in src/mk/port/postgres.mk.linux)
 #	BSD44_derived	-	OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)
 #       bsdi            -       BSD/OS 2.0 and 2.01
+#       bsdi_2_1        -       BSD/OS 2.1
 #	aix		-	IBM on AIX 3.2.5
 #	irix5		-	SGI MIPS on IRIX 5.3
 #  Some hooks are provided for
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 4ad808c047b..e292ded1d8d 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -7,7 +7,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.2 1996/07/15 19:21:59 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.3 1996/07/16 07:12:27 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -187,7 +187,7 @@ typedef void (*sig_func)();
  *	error handling / abort routines
  * ----------------
  */
-#if !defined(PORTNAME_bsdi)
+#if !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
 void err()
 {
     Warnings++;
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 14bbb5f8e4f..ef6a8ea87c9 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.1.1.1 1996/07/09 06:21:35 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2 1996/07/16 07:12:39 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,7 +17,7 @@
 #include <limits.h>
 #define MAXINT        INT_MAX
 #else
-# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi)
+# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
 # include <machine/limits.h>
 # define MAXINT	INT_MAX
 # else
diff --git a/src/backend/port/bsdi_2_1/Makefile.inc b/src/backend/port/bsdi_2_1/Makefile.inc
new file mode 100644
index 00000000000..a5592e18d4d
--- /dev/null
+++ b/src/backend/port/bsdi_2_1/Makefile.inc
@@ -0,0 +1,14 @@
+#-------------------------------------------------------------------------
+#
+# Makefile.inc--
+#    Makefile for port/bsdi_2_1
+#
+# NOTES
+#    The BSD/OS port is included here by courtesy of Kurt Lidl.
+#
+#    (5) 1994, Kurt Lidl, lidl@pix.com
+#
+#-------------------------------------------------------------------------
+
+CFLAGS+=-DUSE_POSIX_TIME -DNEED_CBRT
+LDADD+= -ldl -lipc
diff --git a/src/backend/port/bsdi_2_1/machine.h b/src/backend/port/bsdi_2_1/machine.h
new file mode 100644
index 00000000000..d53defbfd4c
--- /dev/null
+++ b/src/backend/port/bsdi_2_1/machine.h
@@ -0,0 +1,18 @@
+/*-------------------------------------------------------------------------
+ *
+ * machine.h--
+ *    
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * machine.h,v 1.1.1.1 1994/11/07 05:19:37 andrew Exp
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MACHINE_H
+#define MACHINE_H
+
+#define BLCKSZ	8192
+
+#endif
diff --git a/src/backend/port/bsdi_2_1/port-protos.h b/src/backend/port/bsdi_2_1/port-protos.h
new file mode 100644
index 00000000000..24a61155ee8
--- /dev/null
+++ b/src/backend/port/bsdi_2_1/port-protos.h
@@ -0,0 +1,28 @@
+/*-------------------------------------------------------------------------
+ *
+ * port-protos.h--
+ *    port-specific prototypes for SunOS 4
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * port-protos.h,v 1.2 1995/05/25 22:51:03 andrew Exp
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PORT_PROTOS_H
+#define PORT_PROTOS_H
+
+#include "fmgr.h"			/* for func_ptr */
+#include "utils/dynamic_loader.h"
+
+/* dynloader.c */
+
+#define	pg_dlopen(f)	dlopen(f, 1)
+#define	pg_dlsym	dlsym
+#define	pg_dlclose	dlclose
+#define	pg_dlerror	dlerror
+
+/* port.c */
+
+#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/bsdi_2_1/port.c b/src/backend/port/bsdi_2_1/port.c
new file mode 100644
index 00000000000..8819b1a6481
--- /dev/null
+++ b/src/backend/port/bsdi_2_1/port.c
@@ -0,0 +1,13 @@
+/*-------------------------------------------------------------------------
+ *
+ * port.c--
+ *    Linux-specific routines
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *    /usr/local/devel/pglite/cvs/src/backend/port/linux/port.c,v 1.1.1.1 1994/11/07 05:19:38 andrew Exp
+ *
+ *-------------------------------------------------------------------------
+ */
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index fe09e16e808..c533acb794d 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.1.1.1 1996/07/09 06:21:49 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.2 1996/07/16 07:13:07 scrappy Exp $
  *
  * NOTES
  *
@@ -49,7 +49,7 @@
 #define MAXINT        INT_MAX
 #else
 #include <netdb.h>		/* for MAXHOSTNAMELEN on some */
-# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi)
+# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
 # include <machine/limits.h>
 # define MAXINT		INT_MAX
 # else
diff --git a/src/backend/storage/ipc/s_lock.c b/src/backend/storage/ipc/s_lock.c
index 13dc5aa273f..260120dfcc2 100644
--- a/src/backend/storage/ipc/s_lock.c
+++ b/src/backend/storage/ipc/s_lock.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.2 1996/07/16 06:53:41 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.3 1996/07/16 07:13:16 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -381,7 +381,8 @@ S_INIT_LOCK(unsigned char *addr)
  * Linux and friends
  */
 
-#if defined(PORTNAME_linux) || defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi)
+#if defined(PORTNAME_linux) || defined(PORTNAME_BSD44_derived) ||  defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
+
 
 int
 tas(slock_t *m)
@@ -410,7 +411,7 @@ S_INIT_LOCK(slock_t *lock)
     S_UNLOCK(lock);
 }
 
-#endif /* PORTNAME_linux || PORTNAME_BSD44_derived */
+#endif /* PORTNAME_linux || PORTNAME_BSD44_derived || PORTNAME_bsdi || PORTNAME_bsdi_2_1 */
 
 
 #endif /* HAS_TEST_AND_SET */
diff --git a/src/backend/utils/Gen_fmgrtab.sh b/src/backend/utils/Gen_fmgrtab.sh
index f6af3aa80d4..ed5ed2feeed 100644
--- a/src/backend/utils/Gen_fmgrtab.sh
+++ b/src/backend/utils/Gen_fmgrtab.sh
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
 #
 # NOTES
 #    Passes any -D options on to cpp prior to generating the list
@@ -81,7 +81,7 @@ cat > $HFILE <<FuNkYfMgRsTuFf
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: Gen_fmgrtab.sh,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
+ * $Id: Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
  *
  * NOTES
  *	******************************
@@ -175,7 +175,7 @@ cat > $TABCFILE <<FuNkYfMgRtAbStUfF
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.2 1996/07/16 07:13:25 scrappy Exp $
  *
  * NOTES
  *
@@ -195,12 +195,12 @@ cat > $TABCFILE <<FuNkYfMgRtAbStUfF
 #ifdef WIN32
 #include <limits.h>
 #else
-# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi)
+# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
 # include <machine/limits.h>
 # define MAXINT	INT_MAX
 # else
 # include <values.h>           /* for MAXINT */
-# endif /* PORTNAME_BSD44_derived || PORTNAME_bsdi */
+# endif /* PORTNAME_BSD44_derived || PORTNAME_bsdi || PORTNAME_bsdi_2_1 */
 #endif /* WIN32 */
 
 #include "utils/fmgrtab.h"
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 7ba7cc98f7e..094973257ac 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.1.1.1 1996/07/09 06:22:04 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.2 1996/07/16 07:13:33 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 #include "utils/builtins.h"
 
 #if !defined(PORTNAME_linux) && !defined(PORTNAME_BSD44_derived) && \
-    !defined(PORTNAME_irix5) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_aix)
+    !defined(PORTNAME_irix5) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1) && !defined(PORTNAME_aix)
 extern int random();
 extern int srandom(unsigned);
 #endif
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index d5e07b5f268..93221051f24 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.1.1.1 1996/07/09 06:22:05 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.2 1996/07/16 07:13:35 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -132,7 +132,7 @@ ltoa(int32 l, char *a)
 int
 ftoa(double value, char *ascii, int width, int prec1, char format)
 {
-#if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi)
+#if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
 	char	out[256];
 	char	fmt[256];
 	int	ret;
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index d5bef1ab1ba..bf7d15e5582 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.1.1.1 1996/07/09 06:22:07 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.2 1996/07/16 07:13:47 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,7 +48,7 @@ elog(int lev, char *fmt, ... )
     char		buf[ELOG_MAXLEN], line[ELOG_MAXLEN];
     register char	*bp, *cp;
     extern	int	errno, sys_nerr;
-#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi)
+#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
     extern	char	*sys_errlist[];
 #endif /* !PORTNAME_BSD44_derived */
 #ifndef PG_STANDALONE
diff --git a/src/backend/utils/error/exc.c b/src/backend/utils/error/exc.c
index 35c5db9118f..3e1b8f98b41 100644
--- a/src/backend/utils/error/exc.c
+++ b/src/backend/utils/error/exc.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.1.1.1 1996/07/09 06:22:07 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.2 1996/07/16 07:13:49 scrappy Exp $
  *
  * NOTE
  *    XXX this code needs improvement--check for state violations and
@@ -90,7 +90,7 @@ ExcPrint(Exception *excP,
 {
     extern	int	errno;
     extern	int	sys_nerr;
-#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi)
+#if !defined(PORTNAME_BSD44_derived) && !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
     extern	char	*sys_errlist[];
 #endif /* !PORTNAME_BSD44_derived */
     
diff --git a/src/mk/port/postgres.mk.bsdi_2_1 b/src/mk/port/postgres.mk.bsdi_2_1
new file mode 100644
index 00000000000..42fd94766bf
--- /dev/null
+++ b/src/mk/port/postgres.mk.bsdi_2_1
@@ -0,0 +1,40 @@
+#-------------------------------------------------------------------------
+#
+# postgres.mk.bsdi--
+#    Intel x86/BSDi v2.0 specific rules and variables
+#
+#  for questions about the BSD/OS port, contact Kurt Lidl (lidl@pix.com)
+# 
+# Copyright (c) 1994-5, Regents of the University of California
+#
+# NOTE
+#    you may remove lines that start with ## which are general comments
+#-------------------------------------------------------------------------
+ifndef MK_PORT
+MK_PORT=	bsdi_2_1
+
+# cc is gcc v1.42
+# gcc is gcc v2.6.3
+CC=			gcc
+
+RANLIB=		ranlib
+INSTALL=	install
+LEX=		lex
+AROPT=		cq
+
+# use the regex library
+USE_REGEX = 1
+
+LDADD_BE= -ldl -lcompat
+
+#
+# for postgres.user.mk
+#
+SLSUFF=		.o
+
+#
+# for postgres.mk
+#
+CFLAGS_OPT=	-O -DUSE_POSIX_SIGNALS # -O2
+
+endif
-- 
GitLab