From 3aae0f5300f36ceca30b88378a7678ed4f902e50 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Fri, 19 Dec 1997 02:46:25 +0000 Subject: [PATCH] More cleanups...several ports are major redundancies of other ports --- src/backend/port/Makefile.in | 5 +- src/backend/port/getrusage.c | 12 +++ src/backend/port/hpux/port.c | 19 +---- src/backend/port/i386_solaris/port.c | 70 ---------------- src/backend/port/{sco => }/rusagestub.h | 0 src/backend/port/sco/Makefile | 35 -------- src/backend/port/sco/port.c | 60 -------------- src/backend/port/sparc_solaris/Makefile | 4 +- src/backend/port/sparc_solaris/port.c | 83 ------------------- src/backend/port/srandom.c | 2 +- .../port/{svr4/port.c => strcasecmp.c} | 71 ---------------- src/backend/port/svr4/Makefile | 35 -------- 12 files changed, 19 insertions(+), 377 deletions(-) delete mode 100644 src/backend/port/i386_solaris/port.c rename src/backend/port/{sco => }/rusagestub.h (100%) delete mode 100644 src/backend/port/sco/Makefile delete mode 100644 src/backend/port/sco/port.c delete mode 100644 src/backend/port/sparc_solaris/port.c rename src/backend/port/{svr4/port.c => strcasecmp.c} (69%) delete mode 100644 src/backend/port/svr4/Makefile diff --git a/src/backend/port/Makefile.in b/src/backend/port/Makefile.in index a941616460..95a3a65883 100644 --- a/src/backend/port/Makefile.in +++ b/src/backend/port/Makefile.in @@ -19,14 +19,15 @@ # be converted to Method 2. # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.5 1997/12/19 02:06:24 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.6 1997/12/19 02:45:38 scrappy Exp $ # #------------------------------------------------------------------------- SRCDIR=../.. include ../../Makefile.global -OBJS = @PORTNAME@/SUBSYS.o @INET_ATON@ @STRERROR@ +OBJS = @PORTNAME@/SUBSYS.o @INET_ATON@ @STRERROR@ @RANDOM@ @SRANDOM@ +OBJS+= @GETHOSTNAME@ @GETRUSAGE@ @STRCASECMP@ all: submake SUBSYS.o diff --git a/src/backend/port/getrusage.c b/src/backend/port/getrusage.c index a560d4afa3..ce17043875 100644 --- a/src/backend/port/getrusage.c +++ b/src/backend/port/getrusage.c @@ -4,6 +4,11 @@ #include "rusagestub.h" #include "port-protos.h" +#ifdef 0 /* this is from univel port ... how does compiler define? */ + /* same for i386_solaris port ... how does compiler define? */ + /* same for sco port ... how does compiler define? */ + /* same for sparc_solaris port ... how does compiler define? */ + /* same for svr4 port ... how does compiler define? */ int getrusage(int who, struct rusage * rusage) { @@ -44,4 +49,11 @@ getrusage(int who, struct rusage * rusage) rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate); return (0); } +#endif +#ifdef 0 /* this is for hpux port ... how does compiler define? */ +getrusage(int who, struct rusage * ru) +{ + return (syscall(SYS_GETRUSAGE, who, ru)); +} +#endif diff --git a/src/backend/port/hpux/port.c b/src/backend/port/hpux/port.c index 8f37cd4448..1c82a09999 100644 --- a/src/backend/port/hpux/port.c +++ b/src/backend/port/hpux/port.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/port.c,v 1.3 1997/09/07 04:45:52 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/port.c,v 1.4 1997/12/19 02:45:44 scrappy Exp $ * * NOTES * For the most part, this file gets around some non-POSIX calls @@ -30,20 +30,3 @@ init_address_fixup() * by the kernel. */ } - -long -random() -{ - return (lrand48()); -} - -void -srandom(unsigned seed) -{ - srand48((long int) seed); -} - -getrusage(int who, struct rusage * ru) -{ - return (syscall(SYS_GETRUSAGE, who, ru)); -} diff --git a/src/backend/port/i386_solaris/port.c b/src/backend/port/i386_solaris/port.c deleted file mode 100644 index 71e8d9b95d..0000000000 --- a/src/backend/port/i386_solaris/port.c +++ /dev/null @@ -1,70 +0,0 @@ -/*------------------------------------------------------------------------- - * - * 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.3 1997/09/08 02:26:28 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -#include /* for pow() prototype */ - -#include -#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); -} diff --git a/src/backend/port/sco/rusagestub.h b/src/backend/port/rusagestub.h similarity index 100% rename from src/backend/port/sco/rusagestub.h rename to src/backend/port/rusagestub.h diff --git a/src/backend/port/sco/Makefile b/src/backend/port/sco/Makefile deleted file mode 100644 index b559dff984..0000000000 --- a/src/backend/port/sco/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile-- -# Makefile for port/sco -# -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/port/sco/Attic/Makefile,v 1.1 1997/07/28 01:33:54 momjian Exp $ -# -#------------------------------------------------------------------------- - -SRCDIR = ../../.. -include ../../../Makefile.global - -INCLUDE_OPT = -I../.. \ - -I../../../include - -CFLAGS+=$(INCLUDE_OPT) - -OBJS = port.o - -all: SUBSYS.o - -SUBSYS.o: $(OBJS) - $(LD) -r -o SUBSYS.o $(OBJS) - -depend dep: - $(CC) -MM $(INCLUDE_OPT) *.c >depend - -clean: - rm -f SUBSYS.o $(OBJS) - -ifeq (depend,$(wildcard depend)) -include depend -endif - diff --git a/src/backend/port/sco/port.c b/src/backend/port/sco/port.c deleted file mode 100644 index d7acc97a75..0000000000 --- a/src/backend/port/sco/port.c +++ /dev/null @@ -1,60 +0,0 @@ -/*------------------------------------------------------------------------- - * - * port.c-- - * SCO 3.2v5.0.2 specific routines - * - * Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * /usr/local/devel/pglite/cvs/src/backend/port/svr4/port.c,v 1.2 1995/03/17 06:40:19 andrew Exp - * - *------------------------------------------------------------------------- - */ -#include -#include /* for pow() prototype */ - -#include -#include "rusagestub.h" - - -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); -} diff --git a/src/backend/port/sparc_solaris/Makefile b/src/backend/port/sparc_solaris/Makefile index a0e8c7ba25..5463500cef 100644 --- a/src/backend/port/sparc_solaris/Makefile +++ b/src/backend/port/sparc_solaris/Makefile @@ -4,7 +4,7 @@ # Makefile for port/sparc_solaris # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/Makefile,v 1.3 1996/11/10 00:38:38 bryanh Exp $ +# $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/Makefile,v 1.4 1997/12/19 02:46:16 scrappy Exp $ # #------------------------------------------------------------------------- @@ -17,7 +17,7 @@ INCLUDE_OPT = -I.. \ CFLAGS+=$(INCLUDE_OPT) -OBJS = port.o tas.o +OBJS = tas.o all: SUBSYS.o diff --git a/src/backend/port/sparc_solaris/port.c b/src/backend/port/sparc_solaris/port.c deleted file mode 100644 index d578c69e52..0000000000 --- a/src/backend/port/sparc_solaris/port.c +++ /dev/null @@ -1,83 +0,0 @@ -/*------------------------------------------------------------------------- - * - * port.c-- - * SunOS5-specific routines - * - * Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/port.c,v 1.7 1997/09/18 16:09:15 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#include /* for pow() prototype */ -#include - -#include - -#include "postgres.h" -#include "port-protos.h" -#ifndef HAVE_GETRUSAGE -#include "rusagestub.h" -#endif /* HAVE_GETRUSAGE */ - -#ifndef HAVE_RANDOM -long -random() -{ - return (lrand48()); -} -#endif - -#ifndef HAVE_RANDOM -void -srandom(int seed) -{ - srand48((long int) seed); -} -#endif - -#ifndef HAVE_GETRUSAGE -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); -} - -#endif /* HAVE_GETRUSAGE */ diff --git a/src/backend/port/srandom.c b/src/backend/port/srandom.c index 71977bde8e..1a464f2124 100644 --- a/src/backend/port/srandom.c +++ b/src/backend/port/srandom.c @@ -5,7 +5,7 @@ #include "port-protos.h" void -srandom(int seed) +srandom(unsigned int seed) { srand48((long int) seed); } diff --git a/src/backend/port/svr4/port.c b/src/backend/port/strcasecmp.c similarity index 69% rename from src/backend/port/svr4/port.c rename to src/backend/port/strcasecmp.c index 92acee71ec..bb83dcc7ea 100644 --- a/src/backend/port/svr4/port.c +++ b/src/backend/port/strcasecmp.c @@ -1,74 +1,3 @@ -/*------------------------------------------------------------------------- - * - * port.c-- - * Intel x86/Intel SVR4-specific routines - * - * Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * /usr/local/devel/pglite/cvs/src/backend/port/svr4/port.c,v 1.2 1995/03/17 06:40:19 andrew Exp - * - *------------------------------------------------------------------------- - */ -#include /* for pow() prototype */ - -#include -#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); -} - /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. diff --git a/src/backend/port/svr4/Makefile b/src/backend/port/svr4/Makefile deleted file mode 100644 index a120021e9c..0000000000 --- a/src/backend/port/svr4/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile-- -# Makefile for port/svr4 -# -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/port/svr4/Attic/Makefile,v 1.2 1996/11/09 06:20:26 momjian Exp $ -# -#------------------------------------------------------------------------- - -SRCDIR = ../../.. -include ../../../Makefile.global - -INCLUDE_OPT = -I../.. \ - -I../../../include - -CFLAGS+=$(INCLUDE_OPT) - -OBJS = port.o - -all: SUBSYS.o - -SUBSYS.o: $(OBJS) - $(LD) -r -o SUBSYS.o $(OBJS) - -depend dep: - $(CC) -MM $(INCLUDE_OPT) *.c >depend - -clean: - rm -f SUBSYS.o $(OBJS) - -ifeq (depend,$(wildcard depend)) -include depend -endif - -- 2.40.0