Skip to content

Commit efafd15

Browse files
committed
Added a SVR4 port
--- below my signature, there are a coupls of diffs and files in a shell archive, which were needed to build postgres95 1.02 on Siemens Nixdorfs MIPS based SINIX systems. Except for the compiler switches "-W0" and "-LD-Blargedynsym" these diffs should also apply for other SVR4 based systems. The changes in "Makefile.global" and "genbki.sh" can probably be ignored (I needed gawk, to make the script run). There is one bugfix thou. In "src/backend/parser/sysfunc.c" the function in this file didn't honor the EUROPEAN_DATES ifdef. --- Submitted by: Frank Ridderbusch <ridderbusch.pad@sni.de>
1 parent ce8790b commit efafd15

File tree

13 files changed

+332
-30
lines changed

13 files changed

+332
-30
lines changed

src/Makefile.global

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.19 1996/07/31 18:55:49 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.19.2.1 1996/08/19 13:46:05 scrappy Exp $
1111
#
1212
# NOTES
1313
# This is seen by any Makefiles that include mk/postgres.mk. To
@@ -59,15 +59,15 @@
5959
# until after this file is processed!
6060
# make sure that you have no whitespaces after the PORTNAME setting
6161
# or the makefiles can get confused
62-
PORTNAME= BSD44_derived
62+
PORTNAME= svr4
6363

6464
# SRCDIR specifies where the source files are.
65-
SRCDIR= /home/staff/scrappy/cvs/postgres95/src
65+
SRCDIR= /home/tools/postgres95-1.02/src
6666

6767
# For convenience, POSTGRESDIR is where DATADIR, BINDIR, and LIBDIR
6868
# and other target destinations are rooted. Of course, each of these is
6969
# changable separately.
70-
POSTGRESDIR= /home/staff/scrappy/cvs/postgres95
70+
POSTGRESDIR= /home/tools/postgres95-1.02
7171

7272
# POSTGRESLOGIN is the login name of the user who gets special
7373
# privileges within the database. By default it is "postgres", but
@@ -130,15 +130,15 @@ CFLAGS+= -DNAMEDATALEN=$(NAMEDATALEN) -DOIDNAMELEN=$(OIDNAMELEN)
130130
# Comment out CDEBUG to turn off debugging and sanity-checking.
131131
#
132132
# XXX on MIPS, use -g3 if you want to compile with -O
133-
#CDEBUG= -g
133+
CDEBUG= -O
134134

135135
# Comment out ENFORCE_ALIGNMENT if you do NOT want unaligned access to
136136
# multi-byte types to generate a bus error.
137137
ENFORCE_ALIGNMENT= true
138138

139139
# turn this on if you prefer European style dates instead of American
140140
# style dates
141-
# EUROPEAN_DATES = 1
141+
EUROPEAN_DATES = 1
142142

143143
# Comment out PROFILE to disable profiling.
144144
#
@@ -154,13 +154,13 @@ ENFORCE_ALIGNMENT= true
154154
# and READLINE_LIBDIR to reflect the location of the readline and history
155155
# headers and libraries.
156156
#
157-
#USE_READLINE= true
157+
USE_READLINE= true
158158

159159
# directories for the readline and history libraries.
160-
READLINE_INCDIR= /usr/local/include
161-
HISTORY_INCDIR= /usr/local/include
162-
READLINE_LIBDIR= /usr/local/lib
163-
HISTORY_LIBDIR= /usr/local/lib
160+
READLINE_INCDIR= /home/tools/include
161+
HISTORY_INCDIR= /home/tools/include -I/home/tools/include/readline
162+
READLINE_LIBDIR= /home/tools/lib
163+
HISTORY_LIBDIR= /home/tools/lib
164164

165165
# If you do not plan to use Host based authentication,
166166
# comment out the following line
@@ -208,19 +208,19 @@ endif
208208
# location of Tcl/Tk headers and libraries
209209
#
210210
# Uncomment this to build the tcl utilities.
211-
#USE_TCL= true
211+
USE_TCL= true
212212
# customize these to your site's needs
213213
#
214-
TCL_INCDIR= /usr/local/include
215-
TCL_LIBDIR= /usr/local/lib
214+
TCL_INCDIR= /home/tools/include
215+
TCL_LIBDIR= /home/tools/lib
216216
TCL_LIB = -ltcl7.5
217-
TK_INCDIR= /usr/local/include
218-
TK_LIBDIR= /usr/local/lib
217+
TK_INCDIR= /home/tools/include
218+
TK_LIBDIR= /home/tools/lib
219219
TK_LIB = -ltk4.1
220220

221-
X11_INCDIR = /usr/X11R6.1/include
222-
X11_LIBDIR = /usr/X11R6.1/lib
223-
X11_LIB = -lX11
221+
X11_INCDIR = /usr/include
222+
X11_LIBDIR = /usr/lib
223+
X11_LIB = -lX11 -lsocket -lnsl
224224

225225
#
226226
# include port specific rules and variables. For instance:

src/backend/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.2 1996/07/31 17:19:49 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.2.2.1 1996/08/19 13:46:19 scrappy Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -118,6 +118,11 @@ ifeq ($(PORTNAME), linux)
118118
LDADD+= -lc
119119
endif
120120

121+
# the following is special for Reliant UNIX SVR4 (formerly SINIX)
122+
ifeq ($(PORTNAME), svr4)
123+
LDFLAGS+= -LD-Blargedynsym
124+
endif
125+
121126
postgres: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS)
122127
$(CC) $(LDFLAGS) -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD)
123128

src/backend/catalog/genbki.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
#
1212
# IDENTIFICATION
13-
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.1.1.1 1996/07/09 06:21:15 scrappy Exp $
13+
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.1.1.1.2.1 1996/08/19 13:46:26 scrappy Exp $
1414
#
1515
# NOTES
1616
# non-essential whitespace is removed from the generated file.
@@ -62,7 +62,7 @@ sed -e 's/\/\*.*\*\///g' \
6262
-e 's/\ NameData/\ name/g' \
6363
-e 's/(NameData/(name/g' \
6464
-e 's/(Oid/(oid/g' | \
65-
awk '
65+
gawk '
6666
# ----------------
6767
# now use awk to process remaining .h file..
6868
#

src/backend/parser/sysfunc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ char *Sysfunc_system_date(void)
3030

3131
time(&cur_time_secs);
3232
cur_time_expanded = localtime(&cur_time_secs);
33+
#if defined(EUROPEAN_DATES) || defined(EUROPEAN_STYLE)
34+
sprintf(buf, "%02.2d-%02.2d-%04.4d", cur_time_expanded->tm_mday,
35+
cur_time_expanded->tm_mon+1, cur_time_expanded->tm_year+1900);
36+
#else
3337
sprintf(buf, "%02.2d-%02.2d-%04.4d", cur_time_expanded->tm_mon+1,
3438
cur_time_expanded->tm_mday, cur_time_expanded->tm_year+1900);
39+
#endif
3540
return &buf[0];
3641
}
3742

src/backend/port/svr4/Makefile.inc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile.inc--
4+
# Makefile for port/svr4 (Intel x86/Intel SVR4 specific stuff)
5+
#
6+
# Copyright (c) 1994, Regents of the University of California
7+
#
8+
#
9+
# IDENTIFICATION
10+
# /usr/local/devel/pglite/cvs/src/backend/port/svr4/Makefile.inc,v 1.3 1995/03/21 06:51:21 andrew Exp
11+
#
12+
#-------------------------------------------------------------------------
13+
14+
CFLAGS+= -DUSE_POSIX_TIME -DNEED_ISINF -DNEED_RUSAGE -DNO_EMPTY_STMTS
15+
16+
LDADD+= -ll -ldl
17+
18+
SUBSRCS+= port.c
19+
20+
HEADERS+= machine.h port-protos.h rusagestub.h

src/backend/port/svr4/machine.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* machine.h--
4+
*
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* machine.h,v 1.1.1.1 1994/11/07 05:19:38 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef MACHINE_H
14+
#define MACHINE_H
15+
16+
#define BLCKSZ 8192
17+
18+
#endif
19+

src/backend/port/svr4/port-protos.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for Intel x86/Intel SVR4
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef PORT_PROTOS_H
14+
#define PORT_PROTOS_H
15+
16+
#include <dlfcn.h>
17+
#include "fmgr.h" /* for func_ptr */
18+
#include "utils/dynamic_loader.h"
19+
20+
/* dynloader.c */
21+
/*
22+
* Dynamic Loader on Intel x86/Intel SVR4.
23+
*
24+
* this dynamic loader uses the system dynamic loading interface for shared
25+
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
26+
* library as the file to be dynamically loaded.
27+
*
28+
*/
29+
#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
30+
#define pg_dlsym dlsym
31+
#define pg_dlclose dlclose
32+
#define pg_dlerror dlerror
33+
34+
/* port.c */
35+
extern long random(void);
36+
extern void srandom(int seed);
37+
38+
#endif /* PORT_PROTOS_H */

src/backend/port/svr4/port.c

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port.c--
4+
* Intel x86/Intel SVR4-specific routines
5+
*
6+
* Copyright (c) 1994, Regents of the University of California
7+
*
8+
*
9+
* IDENTIFICATION
10+
* /usr/local/devel/pglite/cvs/src/backend/port/svr4/port.c,v 1.2 1995/03/17 06:40:19 andrew Exp
11+
*
12+
*-------------------------------------------------------------------------
13+
*/
14+
#include <math.h> /* for pow() prototype */
15+
16+
#include <errno.h>
17+
#include "rusagestub.h"
18+
19+
long
20+
random()
21+
{
22+
return(lrand48());
23+
}
24+
25+
void
26+
srandom(int seed)
27+
{
28+
srand48((long int) seed);
29+
}
30+
31+
int
32+
getrusage(int who, struct rusage *rusage)
33+
{
34+
struct tms tms;
35+
register int tick_rate = CLK_TCK; /* ticks per second */
36+
clock_t u, s;
37+
38+
if (rusage == (struct rusage *) NULL) {
39+
errno = EFAULT;
40+
return(-1);
41+
}
42+
if (times(&tms) < 0) {
43+
/* errno set by times */
44+
return(-1);
45+
}
46+
switch (who) {
47+
case RUSAGE_SELF:
48+
u = tms.tms_utime;
49+
s = tms.tms_stime;
50+
break;
51+
case RUSAGE_CHILDREN:
52+
u = tms.tms_cutime;
53+
s = tms.tms_cstime;
54+
break;
55+
default:
56+
errno = EINVAL;
57+
return(-1);
58+
}
59+
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
60+
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
61+
rusage->ru_utime.tv_sec = TICK_TO_SEC(u, tick_rate);
62+
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate);
63+
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate);
64+
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
65+
return(0);
66+
}
67+
68+
/*
69+
* Copyright (c) 1987 Regents of the University of California.
70+
* All rights reserved.
71+
*
72+
* Redistribution and use in source and binary forms are permitted
73+
* provided that this notice is preserved and that due credit is given
74+
* to the University of California at Berkeley. The name of the University
75+
* may not be used to endorse or promote products derived from this
76+
* software without specific written prior permission. This software
77+
* is provided ``as is'' without express or implied warranty.
78+
*/
79+
80+
#if defined(LIBC_SCCS) && !defined(lint)
81+
static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
82+
#endif /* LIBC_SCCS and not lint */
83+
84+
#include <sys/types.h>
85+
#include <string.h>
86+
87+
/*
88+
* This array is designed for mapping upper and lower case letter
89+
* together for a case independent comparison. The mappings are
90+
p * based upon ascii character sequences.
91+
*/
92+
static unsigned char charmap[] = {
93+
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
94+
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
95+
'\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
96+
'\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
97+
'\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
98+
'\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
99+
'\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
100+
'\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
101+
'\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
102+
'\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
103+
'\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
104+
'\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
105+
'\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
106+
'\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
107+
'\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
108+
'\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
109+
'\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
110+
'\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
111+
'\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
112+
'\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
113+
'\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
114+
'\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
115+
'\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
116+
'\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
117+
'\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
118+
'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
119+
'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
120+
'\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
121+
'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
122+
'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
123+
'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
124+
'\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
125+
};
126+
127+
int
128+
strcasecmp(char *s1, char *s2)
129+
{
130+
register unsigned char u1, u2;
131+
132+
for (;;) {
133+
u1 = (unsigned char) *s1++;
134+
u2 = (unsigned char) *s2++;
135+
if (charmap[u1] != charmap[u2]) {
136+
return charmap[u1] - charmap[u2];
137+
}
138+
if (u1 == '\0') {
139+
return 0;
140+
}
141+
}
142+
}
143+

0 commit comments

Comments
 (0)