Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd2a386d

Browse files
committed
MOre univel port patches/files from:
"Michael P. Snyder" <msnyder@hawkeye.huntersmoon.com>
1 parent52ab652 commitd2a386d

File tree

7 files changed

+342
-0
lines changed

7 files changed

+342
-0
lines changed

‎src/backend/port/univel/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for port/univel
5+
#
6+
# IDENTIFICATION
7+
# $Header: /cvsroot/pgsql/src/backend/port/univel/Attic/Makefile,v 1.1 1997/03/25 07:54:31 scrappy 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#tas.o
20+
21+
all: SUBSYS.o
22+
23+
SUBSYS.o:$(OBJS)
24+
$(LD) -r -o SUBSYS.o$(OBJS)
25+
26+
dependdep:
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+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for Intel x86/Intel SVR4
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefFPORT_PROTOS_H
14+
#defineFPORT_PROTOS_H
15+
16+
/* port.c */
17+
externlongrandom(void);
18+
externvoidsrandom(intseed);
19+
externintstrcasecmp(char*s1,char*s2);
20+
externintgethostname(char*name,intnamelen);
21+
22+
#endif/* FPORT_PROTOS_H */

‎src/backend/port/univel/port-protos.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for Intel x86/Intel SVR4
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefPORT_PROTOS_H
14+
#definePORT_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 Intel x86/Intel SVR4.
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+
#definepg_dlopen(f)dlopen(f,RTLD_LAZY)
30+
#definepg_dlsymdlsym
31+
#definepg_dlclosedlclose
32+
#definepg_dlerrordlerror
33+
34+
/* port.c */
35+
externlongrandom(void);
36+
externvoidsrandom(intseed);
37+
externintstrcasecmp(char*s1,char*s2);
38+
externintgethostname(char*name,intnamelen);
39+
40+
#endif/* PORT_PROTOS_H */

‎src/backend/port/univel/port.c

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port.c--
4+
* Intel x86/Intel SVR4-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<math.h>/* for pow() prototype */
15+
16+
#include<errno.h>
17+
#include"rusagestub.h"
18+
#include"port-protos.h"
19+
20+
long
21+
random()
22+
{
23+
return(lrand48());
24+
}
25+
26+
void
27+
srandom(intseed)
28+
{
29+
srand48((longint)seed);
30+
}
31+
32+
int
33+
getrusage(intwho,structrusage*rusage)
34+
{
35+
structtmstms;
36+
registerinttick_rate=CLK_TCK;/* ticks per second */
37+
clock_tu,s;
38+
39+
if (rusage== (structrusage*)NULL) {
40+
errno=EFAULT;
41+
return(-1);
42+
}
43+
if (times(&tms)<0) {
44+
/* errno set by times */
45+
return(-1);
46+
}
47+
switch (who) {
48+
caseRUSAGE_SELF:
49+
u=tms.tms_utime;
50+
s=tms.tms_stime;
51+
break;
52+
caseRUSAGE_CHILDREN:
53+
u=tms.tms_cutime;
54+
s=tms.tms_cstime;
55+
break;
56+
default:
57+
errno=EINVAL;
58+
return(-1);
59+
}
60+
#defineTICK_TO_SEC(T,RATE)((T)/(RATE))
61+
#defineTICK_TO_USEC(T,RATE)(((T)%(RATE)*1000000)/RATE)
62+
rusage->ru_utime.tv_sec=TICK_TO_SEC(u,tick_rate);
63+
rusage->ru_utime.tv_usec=TICK_TO_USEC(u,tick_rate);
64+
rusage->ru_stime.tv_sec=TICK_TO_SEC(s,tick_rate);
65+
rusage->ru_stime.tv_usec=TICK_TO_USEC(u,tick_rate);
66+
return(0);
67+
}
68+
69+
/*
70+
* Copyright (c) 1987 Regents of the University of California.
71+
* All rights reserved.
72+
*
73+
* Redistribution and use in source and binary forms are permitted
74+
* provided that this notice is preserved and that due credit is given
75+
* to the University of California at Berkeley. The name of the University
76+
* may not be used to endorse or promote products derived from this
77+
* software without specific written prior permission. This software
78+
* is provided ``as is'' without express or implied warranty.
79+
*/
80+
81+
#if defined(LIBC_SCCS)&& !defined(lint)
82+
staticcharsccsid[]="@(#)strcasecmp.c5.5 (Berkeley) 11/24/87";
83+
#endif/* LIBC_SCCS and not lint */
84+
85+
#include<sys/types.h>
86+
#include<string.h>
87+
88+
/*
89+
* This array is designed for mapping upper and lower case letter
90+
* together for a case independent comparison. The mappings are
91+
p * based upon ascii character sequences.
92+
*/
93+
staticunsignedcharcharmap[]= {
94+
'\000','\001','\002','\003','\004','\005','\006','\007',
95+
'\010','\011','\012','\013','\014','\015','\016','\017',
96+
'\020','\021','\022','\023','\024','\025','\026','\027',
97+
'\030','\031','\032','\033','\034','\035','\036','\037',
98+
'\040','\041','\042','\043','\044','\045','\046','\047',
99+
'\050','\051','\052','\053','\054','\055','\056','\057',
100+
'\060','\061','\062','\063','\064','\065','\066','\067',
101+
'\070','\071','\072','\073','\074','\075','\076','\077',
102+
'\100','\141','\142','\143','\144','\145','\146','\147',
103+
'\150','\151','\152','\153','\154','\155','\156','\157',
104+
'\160','\161','\162','\163','\164','\165','\166','\167',
105+
'\170','\171','\172','\133','\134','\135','\136','\137',
106+
'\140','\141','\142','\143','\144','\145','\146','\147',
107+
'\150','\151','\152','\153','\154','\155','\156','\157',
108+
'\160','\161','\162','\163','\164','\165','\166','\167',
109+
'\170','\171','\172','\173','\174','\175','\176','\177',
110+
'\200','\201','\202','\203','\204','\205','\206','\207',
111+
'\210','\211','\212','\213','\214','\215','\216','\217',
112+
'\220','\221','\222','\223','\224','\225','\226','\227',
113+
'\230','\231','\232','\233','\234','\235','\236','\237',
114+
'\240','\241','\242','\243','\244','\245','\246','\247',
115+
'\250','\251','\252','\253','\254','\255','\256','\257',
116+
'\260','\261','\262','\263','\264','\265','\266','\267',
117+
'\270','\271','\272','\273','\274','\275','\276','\277',
118+
'\300','\341','\342','\343','\344','\345','\346','\347',
119+
'\350','\351','\352','\353','\354','\355','\356','\357',
120+
'\360','\361','\362','\363','\364','\365','\366','\367',
121+
'\370','\371','\372','\333','\334','\335','\336','\337',
122+
'\340','\341','\342','\343','\344','\345','\346','\347',
123+
'\350','\351','\352','\353','\354','\355','\356','\357',
124+
'\360','\361','\362','\363','\364','\365','\366','\367',
125+
'\370','\371','\372','\373','\374','\375','\376','\377',
126+
};
127+
128+
int
129+
strcasecmp(char*s1,char*s2)
130+
{
131+
registerunsignedcharu1,u2;
132+
133+
for (;;) {
134+
u1= (unsignedchar)*s1++;
135+
u2= (unsignedchar)*s2++;
136+
if (charmap[u1]!=charmap[u2]) {
137+
returncharmap[u1]-charmap[u2];
138+
}
139+
if (u1=='\0') {
140+
return0;
141+
}
142+
}
143+
}
144+
145+
#include<sys/utsname.h>
146+
147+
intgethostname(char*name,intnamelen)
148+
{
149+
staticstructutsnamemname;
150+
staticintcalled=0;
151+
152+
if(!called)
153+
{
154+
called++;
155+
uname(&mname);
156+
}
157+
strncpy(name,mname.nodename,(SYS_NMLN<namelen?SYS_NMLN:namelen));
158+
159+
return(0);
160+
}
161+

‎src/backend/port/univel/rusagestub.h

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+
* rusagestub.h,v 1.1.1.1 1994/11/07 05:19:39 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefRUSAGESTUB_H
14+
#defineRUSAGESTUB_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+
#defineRUSAGE_SELF0
21+
#defineRUSAGE_CHILDREN-1
22+
23+
structrusage {
24+
structtimevalru_utime;/* user time used */
25+
structtimevalru_stime;/* system time used */
26+
};
27+
28+
externintgetrusage(intwho,structrusage*rusage);
29+
30+
#endif/* RUSAGESTUB_H */

‎src/backend/port/univel/tas.s

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/=============================================================================
2+
/ tas.s -- test and set lock for i386_solaris
3+
/=============================================================================
4+
5+
.file"tas.s"
6+
.text
7+
.align16
8+
.L1.text:
9+
10+
.globl tas
11+
tas:
12+
pushl%ebp /save prev base pointer
13+
movl%esp,%ebp /new base pointer
14+
pushl%ebx /save prev bx
15+
movl8(%ebp),%ebx /load bx with address oflock
16+
pushl%ebx /save prev bx
17+
movl8(%ebp),%ebx /load bx with address oflock
18+
movl$255,%eax /put somethingin ax
19+
xchgb%al,(%ebx) /swaplock value with"0"
20+
cmpb$0,%al /did we get thelock?
21+
jne .Locked
22+
subl%eax,%eax /yes, we got it -- return0
23+
jmp .Finish
24+
.align4
25+
.Locked:
26+
movl$1,%eax /no, we didn't get it - return1
27+
.Finish:
28+
popl%ebx /restore prev bx
29+
movl%ebp,%esp /restore stack state
30+
popl%ebp
31+
ret /return
32+
.align4
33+
.type tas,@function
34+
.size tas,.-tas
35+

‎src/port/univel.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# defineUSE_POSIX_TIME
2+
# define NO_EMPTY_STMTS
3+
# defineUSE_POSIX_SIGNALS
4+
# defineSYSV_DIRENT
5+
6+
#if0
7+
# defineHAS_TEST_AND_SET
8+
typedefunsignedcharslock_t;
9+
#endif
10+
11+
externlongrandom(void);
12+
externvoidsrandom(intseed);
13+
externintstrcasecmp(char*s1,char*s2);
14+
externintgethostname(char*name,intnamelen);
15+
16+
#ifndefBYTE_ORDER
17+
#defineBYTE_ORDERLITTLE_ENDIAN
18+
#endif
19+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp