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

Commit 8338f90

Browse files
committed
Add SCO files.
1 parent 79e78f0 commit 8338f90

File tree

7 files changed

+180
-0
lines changed

7 files changed

+180
-0
lines changed

src/backend/port/sco/Makefile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for port/sco
5+
#
6+
# IDENTIFICATION
7+
# $Header: /cvsroot/pgsql/src/backend/port/sco/Attic/Makefile,v 1.1 1997/07/28 01:33:54 momjian Exp $
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
SRCDIR = ../../..
12+
include ../../../Makefile.global
13+
14+
INCLUDE_OPT = -I../.. \
15+
-I../../../include
16+
17+
CFLAGS+=$(INCLUDE_OPT)
18+
19+
OBJS = port.o
20+
21+
all: SUBSYS.o
22+
23+
SUBSYS.o: $(OBJS)
24+
$(LD) -r -o SUBSYS.o $(OBJS)
25+
26+
depend dep:
27+
$(CC) -MM $(INCLUDE_OPT) *.c >depend
28+
29+
clean:
30+
rm -f SUBSYS.o $(OBJS)
31+
32+
ifeq (depend,$(wildcard depend))
33+
include depend
34+
endif
35+

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

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for SCO 3.2v5.2
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: port-protos.h,v 1.1 1997/07/28 01:33:55 momjian 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 SCO 3.2v5.0.2
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+
36+
#endif /* PORT_PROTOS_H */

src/backend/port/sco/port.c

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port.c--
4+
* SCO 3.2v5.0.2 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 <unistd.h>
15+
#include <math.h> /* for pow() prototype */
16+
17+
#include <errno.h>
18+
#include "rusagestub.h"
19+
20+
21+
int
22+
getrusage(int who, struct rusage *rusage)
23+
{
24+
struct tms tms;
25+
register int tick_rate = CLK_TCK; /* ticks per second */
26+
clock_t u, s;
27+
28+
if (rusage == (struct rusage *) NULL) {
29+
errno = EFAULT;
30+
return(-1);
31+
}
32+
if (times(&tms) < 0) {
33+
/* errno set by times */
34+
return(-1);
35+
}
36+
switch (who) {
37+
case RUSAGE_SELF:
38+
u = tms.tms_utime;
39+
s = tms.tms_stime;
40+
break;
41+
case RUSAGE_CHILDREN:
42+
u = tms.tms_cutime;
43+
s = tms.tms_cstime;
44+
break;
45+
default:
46+
errno = EINVAL;
47+
return(-1);
48+
}
49+
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
50+
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
51+
rusage->ru_utime.tv_sec = TICK_TO_SEC(u, tick_rate);
52+
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate);
53+
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate);
54+
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
55+
return(0);
56+
}
57+

src/backend/port/sco/rusagestub.h

+30
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+
* rusagestub.h,v 1.1.1.1 1994/11/07 05:19:39 andrew 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/include/port/sco.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <limits.h> /* For _POSIX_PATH_MAX */
2+
3+
#define MAXPATHLEN _POSIX_PATH_MAX
4+
#define SIGURG SIGUSR1
5+
6+
#define NOFILE NOFILES_MIN

src/makefiles/Makefile.sco

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
%.so: %.o
2+
$(LD) -G -Bdynamic -o $@ $<
3+
%.so: %.o
4+
$(LD) -G -Bdynamic -o $@ $<

src/template/sco

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
AROPT:cq
2+
CFLAGS:-I$(SRCDIR)/backend/port/sco
3+
SHARED_LIB:-K PIC
4+
ALL:
5+
SRCH_INC:
6+
SRCH_LIB:
7+
USE_LOCALE:no
8+
DLSUFFIX:.so
9+
YFLAGS:-d
10+
YACC:yacc
11+
LEX:lex
12+
CC:cc -b elf

0 commit comments

Comments
 (0)