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

Commitc801ca0

Browse files
committed
Finish adding in svr4 port to v2.0
1 parent926a066 commitc801ca0

File tree

5 files changed

+250
-0
lines changed

5 files changed

+250
-0
lines changed

‎src/backend/port/svr4/Makefile.inc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile.inc--
4+
# Makefile for port/svr4 (Intel x86/Intel SVR4 specific stuff)
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/Makefile.inc,v 1.3 1995/03/21 06:51:21 andrew Exp
11+
#
12+
#-------------------------------------------------------------------------
13+
14+
CFLAGS+= -DUSE_POSIX_TIME -DNEED_ISINF -DNEED_RUSAGE -DNO_EMPTY_STMTS
15+
16+
LDADD+= -ll -ldl
17+
18+
SUBSRCS+= port.c
19+
20+
HEADERS+= machine.h port-protos.h rusagestub.h

‎src/backend/port/svr4/machine.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* machine.h--
4+
*
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* machine.h,v 1.1.1.1 1994/11/07 05:19:38 andrew Exp
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefMACHINE_H
14+
#defineMACHINE_H
15+
16+
#defineBLCKSZ8192
17+
18+
#endif
19+

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
38+
#endif/* PORT_PROTOS_H */

‎src/backend/port/svr4/port.c

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

‎src/backend/port/svr4/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 */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp