]> granicus.if.org Git - postgresql/commitdiff
Add SCO files.
authorBruce Momjian <bruce@momjian.us>
Mon, 28 Jul 1997 01:34:24 +0000 (01:34 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 28 Jul 1997 01:34:24 +0000 (01:34 +0000)
src/backend/port/sco/Makefile [new file with mode: 0644]
src/backend/port/sco/port-protos.h [new file with mode: 0644]
src/backend/port/sco/port.c [new file with mode: 0644]
src/backend/port/sco/rusagestub.h [new file with mode: 0644]
src/include/port/sco.h [new file with mode: 0644]
src/makefiles/Makefile.sco [new file with mode: 0644]
src/template/sco [new file with mode: 0644]

diff --git a/src/backend/port/sco/Makefile b/src/backend/port/sco/Makefile
new file mode 100644 (file)
index 0000000..b559dff
--- /dev/null
@@ -0,0 +1,35 @@
+#-------------------------------------------------------------------------
+#
+# 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-protos.h b/src/backend/port/sco/port-protos.h
new file mode 100644 (file)
index 0000000..17e3b02
--- /dev/null
@@ -0,0 +1,36 @@
+/*-------------------------------------------------------------------------
+ *
+ * port-protos.h--
+ *    port-specific prototypes for SCO 3.2v5.2
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: port-protos.h,v 1.1 1997/07/28 01:33:55 momjian 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 SCO 3.2v5.0.2
+ *
+ * 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 */
+
+#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/sco/port.c b/src/backend/port/sco/port.c
new file mode 100644 (file)
index 0000000..3f1b84d
--- /dev/null
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ *
+ * 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 <unistd.h>
+#include <math.h>              /* for pow() prototype */
+
+#include <errno.h>
+#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/sco/rusagestub.h b/src/backend/port/sco/rusagestub.h
new file mode 100644 (file)
index 0000000..d2393eb
--- /dev/null
@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ *
+ * rusagestub.h--
+ *    Stubs for getrusage(3).
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * rusagestub.h,v 1.1.1.1 1994/11/07 05:19:39 andrew 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 */
diff --git a/src/include/port/sco.h b/src/include/port/sco.h
new file mode 100644 (file)
index 0000000..0792d7d
--- /dev/null
@@ -0,0 +1,6 @@
+#include <limits.h>    /* For _POSIX_PATH_MAX */
+
+#define        MAXPATHLEN      _POSIX_PATH_MAX
+#define        SIGURG          SIGUSR1
+
+#define        NOFILE          NOFILES_MIN
diff --git a/src/makefiles/Makefile.sco b/src/makefiles/Makefile.sco
new file mode 100644 (file)
index 0000000..de636b3
--- /dev/null
@@ -0,0 +1,4 @@
+%.so: %.o
+       $(LD) -G -Bdynamic -o $@ $<
+%.so: %.o
+       $(LD) -G -Bdynamic -o $@ $<
diff --git a/src/template/sco b/src/template/sco
new file mode 100644 (file)
index 0000000..d47869a
--- /dev/null
@@ -0,0 +1,12 @@
+AROPT:cq
+CFLAGS:-I$(SRCDIR)/backend/port/sco
+SHARED_LIB:-K PIC
+ALL:
+SRCH_INC:
+SRCH_LIB:
+USE_LOCALE:no
+DLSUFFIX:.so
+YFLAGS:-d
+YACC:yacc
+LEX:lex
+CC:cc -b elf