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

Commit ffae4eb

Browse files
committed
Brought in NEOSOFT's port to i386_solaris
Submitted by: Randy Kunkee <kunkee@Starbase.NeoSoft.COM>
1 parent 544e802 commit ffae4eb

File tree

12 files changed

+245
-13
lines changed

12 files changed

+245
-13
lines changed

src/Makefile.global

Lines changed: 2 additions & 1 deletion
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.7 1996/07/20 07:57:49 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.8 1996/07/20 08:34:08 scrappy Exp $
1111
#
1212
# NOTES
1313
# This is seen by any Makefiles that include mk/postgres.mk. To
@@ -35,6 +35,7 @@
3535
# The name of the port. Valid choices are:
3636
# alpha - DEC Alpha AXP on OSF/1 2.0
3737
# hpux - HP PA-RISC on HP-UX 9.0
38+
# i386_solaris - i386 Solaris
3839
# sparc_solaris - SUN SPARC on Solaris 2.4
3940
# sparc - SUN SPARC on SunOS 4.1.3
4041
# ultrix4 - DEC MIPS on Ultrix 4.4
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/sparc_solaris (SPARC/Solaris 2.x specific stuff)
5+
#
6+
# Copyright (c) 1994, Regents of the University of California
7+
#
8+
#
9+
# IDENTIFICATION
10+
# $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/Makefile.inc,v 1.1 1996/07/20 08:34:32 scrappy 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
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+
* $Id: machine.h,v 1.1 1996/07/20 08:34:33 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef MACHINE_H
14+
#define MACHINE_H
15+
16+
#define BLCKSZ 8192
17+
18+
#endif
19+
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 SunOS 4
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: port-protos.h,v 1.1 1996/07/20 08:34:33 scrappy 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 SunOS 4.
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,1)
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/i386_solaris/port.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port.c--
4+
* SunOS5-specific routines
5+
*
6+
* Copyright (c) 1994, Regents of the University of California
7+
*
8+
*
9+
* IDENTIFICATION
10+
* $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/port.c,v 1.1 1996/07/20 08:34:34 scrappy 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+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* rusagestub.h--
4+
* Stubs for getrusage(3).
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: rusagestub.h,v 1.1 1996/07/20 08:34:34 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef RUSAGESTUB_H
14+
#define RUSAGESTUB_H
15+
16+
#include <sys/time.h> /* for struct timeval */
17+
#include <sys/times.h> /* for struct tms */
18+
#include <limits.h> /* for CLK_TCK */
19+
20+
#define RUSAGE_SELF 0
21+
#define RUSAGE_CHILDREN -1
22+
23+
struct rusage {
24+
struct timeval ru_utime; /* user time used */
25+
struct timeval ru_stime; /* system time used */
26+
};
27+
28+
extern int getrusage(int who, struct rusage *rusage);
29+
30+
#endif /* RUSAGESTUB_H */

src/backend/storage/ipc.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: ipc.h,v 1.1.1.1 1996/07/09 06:21:52 scrappy Exp $
9+
* $Id: ipc.h,v 1.2 1996/07/20 08:35:24 scrappy Exp $
1010
*
1111
* NOTES
1212
* This file is very architecture-specific. This stuff should actually
@@ -30,14 +30,15 @@
3030
* atomic test-and-set instruction). However, we have only written
3131
* spinlock code for the architectures listed.
3232
*/
33-
#if defined(PORTNAME_aix) || \
33+
#if (defined(PORTNAME_aix) || \
3434
defined(PORTNAME_alpha) || \
3535
defined(PORTNAME_hpux) || \
3636
defined(PORTNAME_irix5) || \
3737
defined(PORTNAME_next) || \
3838
defined(PORTNAME_sparc) || \
3939
defined(PORTNAME_sparc_solaris) || \
40-
(defined(__i386__) && defined(__GNUC__))
40+
(defined(__i386__) && defined(__GNUC__))) && \
41+
!defined(PORTNAME_i386_solaris)
4142
#define HAS_TEST_AND_SET
4243
#endif
4344

src/backend/storage/ipc/ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.1.1.1 1996/07/09 06:21:54 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.2 1996/07/20 08:35:52 scrappy Exp $
1111
*
1212
* NOTES
1313
*
@@ -47,7 +47,7 @@ int UsePrivateMemory = 1;
4747
int UsePrivateMemory = 0;
4848
#endif
4949

50-
#if defined(PORTNAME_bsdi)
50+
#if defined(PORTNAME_bsdi)||defined(PORTNAME_i386_solaris)
5151
/* hacka, hacka, hacka (XXX) */
5252
union semun {
5353
int val; /* value for SETVAL */

src/backend/storage/lmgr/proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.1.1.1 1996/07/09 06:21:57 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.2 1996/07/20 08:35:58 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@
4646
* This is so that we can support more backends. (system-wide semaphore
4747
* sets run out pretty fast.) -ay 4/95
4848
*
49-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.1.1.1 1996/07/09 06:21:57 scrappy Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.2 1996/07/20 08:35:58 scrappy Exp $
5050
*/
5151
#include <sys/time.h>
5252
#ifndef WIN32
@@ -56,7 +56,7 @@
5656
#include <sys/types.h>
5757
#include "libpq/pqsignal.h" /* substitute for <signal.h> */
5858

59-
#if defined(PORTNAME_bsdi)
59+
#if defined(PORTNAME_bsdi)||defined(PORTNAME_i386_solaris)
6060
/* hacka, hacka, hacka (XXX) */
6161
union semun {
6262
int val; /* value for SETVAL */

src/backend/utils/adt/float.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.1.1.1 1996/07/09 06:22:04 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.2 1996/07/20 08:36:17 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1275,7 +1275,7 @@ static int isinf(x)
12751275
}
12761276
#endif /* PORTNAME_alpha */
12771277

1278-
#if defined(PORTNAME_sparc_solaris)
1278+
#if defined(PORTNAME_sparc_solaris)||defined(PORTNAME_i386_solaris)
12791279
#include <ieeefp.h>
12801280
static int
12811281
isinf(d)

src/backend/utils/adt/nabstime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.1.1.1 1996/07/09 06:22:04 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.2 1996/07/20 08:36:19 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -295,7 +295,7 @@ tryabsdate(char *fields[], int nf, struct tm *tm, int *tzp)
295295
defined(PORTNAME_aix) || \
296296
defined(PORTNAME_irix5) || \
297297
defined(WIN32) || \
298-
defined(PORTNAME_sparc_solaris)
298+
defined(PORTNAME_sparc_solaris) || defined(PORTNAME_i386_solaris)
299299
tzset();
300300
#ifndef WIN32
301301
*tzp = timezone / 60; /* this is an X/Open-ism */

src/mk/port/postgres.mk.i386_solaris

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# postgres.mk.sparc_solaris--
4+
# SUN SPARC/solaris specific rules and variables
5+
#
6+
# Copyright (c) 1994-5, Regents of the University of California
7+
#
8+
# $Id: postgres.mk.i386_solaris,v 1.1 1996/07/20 08:36:33 scrappy Exp $
9+
#
10+
#-------------------------------------------------------------------------
11+
ifndef MK_PORT
12+
MK_PORT= i386_solaris
13+
14+
# cc won't work!
15+
CC= gcc
16+
17+
#
18+
# for postgres.mk
19+
#
20+
CFLAGS_BE+= -DUSE_POSIX_SIGNALS
21+
22+
# RANLIB is not used on solaris
23+
RANLIB=touch
24+
25+
INSTALL=/usr/ucb/install
26+
27+
#
28+
# Random things that must be passed everywhere to enable
29+
# everything to compile. :-/
30+
#
31+
# The extra -I flag is to scoop up extra BSD-emulating headers.
32+
CFLAGS_BE+= -DSYSV_DIRENT -I$(POSTGRESDIR)/src/backend/port/sparc_solaris
33+
LDADD_BE+= -lsocket -lnsl
34+
35+
LD_ADD+= $(LDADD_BE)
36+
37+
#
38+
# for postgres.user.mk
39+
#
40+
ifeq ($(CC), cc)
41+
CFLAGS_SL= -K PIC
42+
else
43+
CFLAGS_SL= -fPIC
44+
endif
45+
46+
SLSUFF= .so
47+
48+
%.so: %.o
49+
$(LD) -G -Bdynamic -o $(objdir)/$(@F) $(objdir)/$(<F)
50+
51+
#
52+
# for postgres.shell.mk
53+
#
54+
DASH_N=''
55+
BACKSLASH_C='\\\\c'
56+
57+
endif

0 commit comments

Comments
 (0)