mirror of https://github.com/postgres/postgres
Submitted by: Randy Kunkee <kunkee@Starbase.NeoSoft.COM>Release_1_0_3
parent
544e802910
commit
ffae4ebde9
@ -0,0 +1,20 @@ |
|||||||
|
#------------------------------------------------------------------------- |
||||||
|
# |
||||||
|
# Makefile.inc-- |
||||||
|
# Makefile for port/sparc_solaris (SPARC/Solaris 2.x specific stuff) |
||||||
|
# |
||||||
|
# Copyright (c) 1994, Regents of the University of California |
||||||
|
# |
||||||
|
# |
||||||
|
# IDENTIFICATION |
||||||
|
# $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/Makefile.inc,v 1.1 1996/07/20 08:34:32 scrappy Exp $ |
||||||
|
# |
||||||
|
#------------------------------------------------------------------------- |
||||||
|
|
||||||
|
CFLAGS+= -DUSE_POSIX_TIME -DNEED_ISINF -DNEED_RUSAGE -DNO_EMPTY_STMTS |
||||||
|
|
||||||
|
LDADD+= -ll -ldl |
||||||
|
|
||||||
|
SUBSRCS+= port.c |
||||||
|
|
||||||
|
HEADERS+= machine.h port-protos.h rusagestub.h |
@ -0,0 +1,19 @@ |
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* |
||||||
|
* machine.h-- |
||||||
|
*
|
||||||
|
* |
||||||
|
* |
||||||
|
* Copyright (c) 1994, Regents of the University of California |
||||||
|
* |
||||||
|
* $Id: machine.h,v 1.1 1996/07/20 08:34:33 scrappy Exp $ |
||||||
|
* |
||||||
|
*------------------------------------------------------------------------- |
||||||
|
*/ |
||||||
|
#ifndef MACHINE_H |
||||||
|
#define MACHINE_H |
||||||
|
|
||||||
|
#define BLCKSZ 8192 |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,38 @@ |
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* |
||||||
|
* port-protos.h-- |
||||||
|
* port-specific prototypes for SunOS 4 |
||||||
|
* |
||||||
|
* |
||||||
|
* Copyright (c) 1994, Regents of the University of California |
||||||
|
* |
||||||
|
* $Id: port-protos.h,v 1.1 1996/07/20 08:34:33 scrappy Exp $ |
||||||
|
* |
||||||
|
*------------------------------------------------------------------------- |
||||||
|
*/ |
||||||
|
#ifndef PORT_PROTOS_H |
||||||
|
#define PORT_PROTOS_H |
||||||
|
|
||||||
|
#include <dlfcn.h> |
||||||
|
#include "fmgr.h" /* for func_ptr */ |
||||||
|
#include "utils/dynamic_loader.h" |
||||||
|
|
||||||
|
/* dynloader.c */ |
||||||
|
/*
|
||||||
|
* Dynamic Loader on SunOS 4. |
||||||
|
* |
||||||
|
* this dynamic loader uses the system dynamic loading interface for shared
|
||||||
|
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared |
||||||
|
* library as the file to be dynamically loaded. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#define pg_dlopen(f) dlopen(f,1) |
||||||
|
#define pg_dlsym dlsym |
||||||
|
#define pg_dlclose dlclose |
||||||
|
#define pg_dlerror dlerror |
||||||
|
|
||||||
|
/* port.c */ |
||||||
|
extern long random(void); |
||||||
|
extern void srandom(int seed); |
||||||
|
|
||||||
|
#endif /* PORT_PROTOS_H */ |
@ -0,0 +1,66 @@ |
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* |
||||||
|
* port.c-- |
||||||
|
* SunOS5-specific routines |
||||||
|
* |
||||||
|
* Copyright (c) 1994, Regents of the University of California |
||||||
|
* |
||||||
|
* |
||||||
|
* IDENTIFICATION |
||||||
|
* $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/port.c,v 1.1 1996/07/20 08:34:34 scrappy Exp $ |
||||||
|
* |
||||||
|
*------------------------------------------------------------------------- |
||||||
|
*/ |
||||||
|
#include <math.h> /* for pow() prototype */ |
||||||
|
|
||||||
|
#include <errno.h> |
||||||
|
#include "rusagestub.h" |
||||||
|
|
||||||
|
long |
||||||
|
random() |
||||||
|
{ |
||||||
|
return(lrand48()); |
||||||
|
} |
||||||
|
|
||||||
|
void |
||||||
|
srandom(int seed) |
||||||
|
{ |
||||||
|
srand48((long int) seed); |
||||||
|
} |
||||||
|
|
||||||
|
int |
||||||
|
getrusage(int who, struct rusage *rusage) |
||||||
|
{ |
||||||
|
struct tms tms; |
||||||
|
register int tick_rate = CLK_TCK; /* ticks per second */ |
||||||
|
clock_t u, s; |
||||||
|
|
||||||
|
if (rusage == (struct rusage *) NULL) { |
||||||
|
errno = EFAULT; |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
if (times(&tms) < 0) { |
||||||
|
/* errno set by times */ |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
switch (who) { |
||||||
|
case RUSAGE_SELF: |
||||||
|
u = tms.tms_utime; |
||||||
|
s = tms.tms_stime; |
||||||
|
break; |
||||||
|
case RUSAGE_CHILDREN: |
||||||
|
u = tms.tms_cutime; |
||||||
|
s = tms.tms_cstime; |
||||||
|
break; |
||||||
|
default: |
||||||
|
errno = EINVAL; |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
#define TICK_TO_SEC(T, RATE) ((T)/(RATE)) |
||||||
|
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE) |
||||||
|
rusage->ru_utime.tv_sec = TICK_TO_SEC(u, tick_rate); |
||||||
|
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate); |
||||||
|
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate); |
||||||
|
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate); |
||||||
|
return(0); |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* |
||||||
|
* rusagestub.h-- |
||||||
|
* Stubs for getrusage(3). |
||||||
|
* |
||||||
|
* |
||||||
|
* Copyright (c) 1994, Regents of the University of California |
||||||
|
* |
||||||
|
* $Id: rusagestub.h,v 1.1 1996/07/20 08:34:34 scrappy Exp $ |
||||||
|
* |
||||||
|
*------------------------------------------------------------------------- |
||||||
|
*/ |
||||||
|
#ifndef RUSAGESTUB_H |
||||||
|
#define RUSAGESTUB_H |
||||||
|
|
||||||
|
#include <sys/time.h> /* for struct timeval */ |
||||||
|
#include <sys/times.h> /* for struct tms */ |
||||||
|
#include <limits.h> /* for CLK_TCK */ |
||||||
|
|
||||||
|
#define RUSAGE_SELF 0 |
||||||
|
#define RUSAGE_CHILDREN -1 |
||||||
|
|
||||||
|
struct rusage { |
||||||
|
struct timeval ru_utime; /* user time used */ |
||||||
|
struct timeval ru_stime; /* system time used */ |
||||||
|
}; |
||||||
|
|
||||||
|
extern int getrusage(int who, struct rusage *rusage); |
||||||
|
|
||||||
|
#endif /* RUSAGESTUB_H */ |
@ -0,0 +1,57 @@ |
|||||||
|
#------------------------------------------------------------------------- |
||||||
|
# |
||||||
|
# postgres.mk.sparc_solaris-- |
||||||
|
# SUN SPARC/solaris specific rules and variables |
||||||
|
# |
||||||
|
# Copyright (c) 1994-5, Regents of the University of California |
||||||
|
# |
||||||
|
# $Id: postgres.mk.i386_solaris,v 1.1 1996/07/20 08:36:33 scrappy Exp $ |
||||||
|
# |
||||||
|
#------------------------------------------------------------------------- |
||||||
|
ifndef MK_PORT |
||||||
|
MK_PORT= i386_solaris |
||||||
|
|
||||||
|
# cc won't work! |
||||||
|
CC= gcc |
||||||
|
|
||||||
|
# |
||||||
|
# for postgres.mk |
||||||
|
# |
||||||
|
CFLAGS_BE+= -DUSE_POSIX_SIGNALS |
||||||
|
|
||||||
|
# RANLIB is not used on solaris |
||||||
|
RANLIB=touch |
||||||
|
|
||||||
|
INSTALL=/usr/ucb/install |
||||||
|
|
||||||
|
# |
||||||
|
# Random things that must be passed everywhere to enable |
||||||
|
# everything to compile. :-/ |
||||||
|
# |
||||||
|
# The extra -I flag is to scoop up extra BSD-emulating headers. |
||||||
|
CFLAGS_BE+= -DSYSV_DIRENT -I$(POSTGRESDIR)/src/backend/port/sparc_solaris |
||||||
|
LDADD_BE+= -lsocket -lnsl |
||||||
|
|
||||||
|
LD_ADD+= $(LDADD_BE) |
||||||
|
|
||||||
|
# |
||||||
|
# for postgres.user.mk |
||||||
|
# |
||||||
|
ifeq ($(CC), cc) |
||||||
|
CFLAGS_SL= -K PIC |
||||||
|
else |
||||||
|
CFLAGS_SL= -fPIC |
||||||
|
endif |
||||||
|
|
||||||
|
SLSUFF= .so |
||||||
|
|
||||||
|
%.so: %.o |
||||||
|
$(LD) -G -Bdynamic -o $(objdir)/$(@F) $(objdir)/$(<F) |
||||||
|
|
||||||
|
# |
||||||
|
# for postgres.shell.mk |
||||||
|
# |
||||||
|
DASH_N='' |
||||||
|
BACKSLASH_C='\\\\c' |
||||||
|
|
||||||
|
endif |
Loading…
Reference in new issue