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

Commita759460

Browse files
committed
New beos files. FAQ cleanup.
1 parent9495294 commita759460

File tree

6 files changed

+628
-3
lines changed

6 files changed

+628
-3
lines changed

‎doc/src/FAQ/FAQ.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ <H4><A NAME="4.11">4.11</A>) What is an R-tree index?</H4><P>
950950
Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, 45-57.<P>
951951

952952
You can also find this paper in Stonebraker's "Readings in Database
953-
Systems"<P>
953+
Systems".<P>
954954

955955
Built-in R-trees can handle polygons and boxes. In theory, R-trees can
956956
be extended to handle higher number of dimensions. In practice,

‎doc/src/sgml/ref/begin.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/begin.sgml,v 1.11 2000/03/27 17:14:42 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/begin.sgml,v 1.12 2000/10/0714:16:01 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -103,7 +103,7 @@ NOTICE: BEGIN: already a transaction in progress
103103
and a commit is implicitly performed at the end of the statement
104104
(if execution was successful, otherwise a rollback is done).
105105
<command>BEGIN</command> initiates a user transaction in chained mode,
106-
i.e. all user statements after <command>BEGIN</command> command will
106+
i.e., all user statements after <command>BEGIN</command> command will
107107
be executed in a single transaction until an explicit
108108
<xref linkend="sql-commit-title" endterm="sql-commit-title">,
109109
<xref linkend="sql-rollback-title" endterm="sql-rollback-title">,

‎src/backend/port/beos/Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for port/beos
5+
#
6+
#-------------------------------------------------------------------------
7+
8+
top_builddir = ../../../..
9+
include ../../../Makefile.global
10+
11+
INCLUDE_OPT =
12+
13+
CFLAGS+=$(INCLUDE_OPT)
14+
15+
OBJS = sem.o shm.o support.o
16+
17+
all: SUBSYS.o
18+
19+
SUBSYS.o:$(OBJS)
20+
$(LD)$(LDREL)$(LDOUT) SUBSYS.o$(OBJS)
21+
22+
dependdep:
23+
$(CC) -MM$(INCLUDE_OPT)*.c>depend
24+
25+
clean:
26+
rm -f SUBSYS.o$(OBJS)
27+
28+
ifeq (depend,$(wildcard depend))
29+
include depend
30+
endif
31+

‎src/backend/port/beos/sem.c

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* sem.c
4+
* BeOS System V Semaphores Emulation
5+
*
6+
* Copyright (c) 1999-2000, Cyril VELTER
7+
*
8+
*-------------------------------------------------------------------------
9+
*/
10+
11+
12+
#include"postgres.h"
13+
#include"stdio.h"
14+
#include"errno.h"
15+
#include"OS.h"
16+
17+
// Controle d'un pool de sémaphores
18+
// On considere que le semId utilisé correspond bien a une area de notre adress space
19+
// Les informations du pool de sémaphore sont stockés dans cette area
20+
intsemctl(intsemId,intsemNum,intflag,unionsemunsemun)
21+
{
22+
23+
// Recherche de l'adresse de base de l'area
24+
int32*Address;
25+
area_infoinfo;
26+
//printf("semctl : semid %d, semnum %d, cmd %d\n",semId,semNum,flag);
27+
if (get_area_info(semId,&info)!=B_OK)
28+
{
29+
//printf("area not found\n");
30+
errno=EINVAL;
31+
return-1;
32+
}
33+
Address=(int32*)info.address;
34+
35+
// semnum peut etre égal à 0
36+
// semun.array contient la valeur de départ du sémaphore
37+
38+
// si flag = set_all il faut définir la valeur du sémaphore sue semun.array
39+
if (flag==SETALL)
40+
{
41+
longi;
42+
//printf("setall %d\n",Address[0]);
43+
for (i=0;i<Address[0];i++)
44+
{
45+
int32cnt;
46+
get_sem_count(Address[i+1],&cnt);
47+
//printf("Set de ALl %d %d = %d\n",Address[i+1],semun.array[i],cnt);
48+
cnt-=semun.array[i];
49+
if (cnt>0)
50+
acquire_sem_etc(Address[i+1],cnt,0,0);
51+
if (cnt<0)
52+
release_sem_etc(Address[i+1],-cnt,0);
53+
}
54+
return1;
55+
}
56+
57+
/* si flag = SET_VAL il faut définir la valeur du sémaphore sur semun.val*/
58+
if (flag==SETVAL)
59+
{
60+
int32cnt;
61+
get_sem_count(Address[semNum+1],&cnt);
62+
//printf("semctl set val id : %d val : %d = %d\n",semId,semun.val,cnt);
63+
cnt-=semun.val;
64+
if (cnt>0)
65+
acquire_sem_etc(Address[semNum+1],cnt,0,0);
66+
if (cnt<0)
67+
release_sem_etc(Address[semNum+1],-cnt,0);
68+
return1;
69+
}
70+
71+
/* si flag=rm_id il faut supprimer le sémaphore*/
72+
if (flag==IPC_RMID)
73+
{
74+
longi;
75+
// Suppression des sémaphores (ils appartienent au kernel maintenant)
76+
thread_infoti;
77+
//printf("remove set\n");
78+
get_thread_info(find_thread(NULL),&ti);
79+
for (i=0;i<Address[0];i++)
80+
{
81+
set_sem_owner(Address[i+1],ti.team);
82+
delete_sem(Address[i+1]);
83+
}
84+
// Il faudrait supprimer en boucle toutes les area portant le même nom
85+
delete_area(semId);
86+
return1;
87+
}
88+
89+
/* si flag = GETNCNT il faut renvoyer le semaphore count*/
90+
if (flag==GETNCNT)
91+
{
92+
//printf("getncnt : impossible sur BeOS\n");
93+
return0;// a faire (peut etre impossible sur Beos)
94+
}
95+
96+
/* si flag = GETVAL il faut renvoyer la valeur du sémaphore*/
97+
if (flag==GETVAL)
98+
{
99+
int32cnt;
100+
get_sem_count(Address[semNum+1],&cnt);
101+
//printf("semctl getval id : %d cnt : %d\n",semId,cnt);
102+
returncnt;
103+
}
104+
//printf("semctl erreur\n");
105+
return0;
106+
}
107+
108+
// L'area dans laquelle est stockée le pool est identifiée par son nom (convention à moi : SYSV_IPC_SEM : "semId)
109+
intsemget(intsemKey,intsemNum,intflags)
110+
{
111+
charNom[50];
112+
area_idparea;
113+
void*Address;
114+
115+
//printf("semget get k: %d n: %d fl:%d\n",semKey,semNum,flags);
116+
// Construction du nom que doit avoir l'area
117+
sprintf(Nom,"SYSV_IPC_SEM : %d",semKey);
118+
119+
// Recherche de l'area
120+
parea=find_area(Nom);
121+
122+
// L'area existe
123+
if (parea!=B_NAME_NOT_FOUND)
124+
{
125+
//printf("area found\n");
126+
// On demande une creatrion d'un pool existant : erreur
127+
if ((flags&IPC_CREAT)&&(flags&IPC_EXCL))
128+
{
129+
//printf("creat asking exist\n");
130+
errno=EEXIST;
131+
return-1;
132+
}
133+
134+
// Clone de l'area et renvoi de son ID
135+
parea=clone_area(Nom,&Address,B_ANY_ADDRESS,B_READ_AREA |B_WRITE_AREA,parea);
136+
returnparea;
137+
}
138+
// L'area n'existe pas
139+
else
140+
{
141+
//printf("set don't exist\n");
142+
// Demande de creation
143+
if (flags&IPC_CREAT)
144+
{
145+
int32*Address;
146+
thread_infoti;
147+
void*Ad;
148+
longi;
149+
150+
//printf("create set\n");
151+
// On ne peut pas creer plus de 500 semaphores dans un pool (limite tout à fait arbitraire de ma part)
152+
if (semNum>500)
153+
{
154+
errno=ENOSPC;
155+
return-1;
156+
}
157+
158+
// Creation de la zone de mémoire partagée
159+
parea=create_area(Nom,&Ad,B_ANY_ADDRESS,4096,B_NO_LOCK,B_READ_AREA |B_WRITE_AREA);
160+
if ((parea==B_BAD_VALUE)|| (parea==B_NO_MEMORY)||(parea==B_ERROR))
161+
{
162+
errno=ENOMEM;
163+
return-1;
164+
}
165+
Address=(int32*)Ad;
166+
Address[0]=semNum;
167+
for (i=1;i<=Address[0];i++)
168+
{
169+
// Creation des sémaphores 1 par 1
170+
Address[i]=create_sem(0,Nom);
171+
172+
if ((Address[i]==B_BAD_VALUE)|| (Address[i]==B_NO_MEMORY)||(Address[i]==B_NO_MORE_SEMS))
173+
{
174+
errno=ENOMEM;
175+
return-1;
176+
}
177+
}
178+
179+
//printf("returned %d\n",parea);
180+
returnparea;
181+
}
182+
// Le pool n'existe pas et pas de demande de création
183+
else
184+
{
185+
//printf("set does not exist no creat requested\n");
186+
errno=ENOENT;
187+
return-1;
188+
}
189+
}
190+
}
191+
192+
// Opération sur le pool de sémaphores
193+
intsemop(intsemId,structsembuf*sops,intnsops)
194+
{
195+
// Recherche de l'adresse du pool
196+
int32*Address;
197+
area_infoinfo;
198+
longi;
199+
200+
//printf("semop id : %d n: %d\n",semId,sops->sem_op);
201+
get_area_info(semId,&info);
202+
Address=(int32*)info.address;
203+
if ((semId==B_BAD_VALUE)||(semId==B_NO_MEMORY)||(semId==B_ERROR))
204+
{
205+
errno=EINVAL;
206+
return-1;
207+
}
208+
209+
// Execution de l'action
210+
for(i=0;i<nsops;i++)
211+
{
212+
213+
//printf("semid %d, n %d\n",Address[sops[i].sem_num+1],sops[i].sem_op);
214+
if (sops[i].sem_op<0)
215+
{
216+
acquire_sem_etc(Address[sops[i].sem_num+1],-sops[i].sem_op,0,0);
217+
}
218+
if (sops[i].sem_op>0)
219+
{
220+
release_sem_etc(Address[sops[i].sem_num+1],sops[i].sem_op,0);
221+
}
222+
}
223+
return0;
224+
}

‎src/backend/port/beos/shm.c

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* shm.c
4+
* BeOS System V Shared Memory Emulation
5+
*
6+
* Copyright (c) 1999-2000, Cyril VELTER
7+
*
8+
*-------------------------------------------------------------------------
9+
*/
10+
11+
#include"postgres.h"
12+
#include"stdio.h"
13+
#include"OS.h"
14+
15+
// Detachement d'une zone de mémoire partagée
16+
// On detruit le clone de l'area dans notre adress-space
17+
intshmdt(char*shmaddr)
18+
{
19+
// Recherche de l'id de l'area présente à cette adresse
20+
area_ids;
21+
s=area_for(shmaddr);
22+
//printf("detach area %d\n",s);
23+
24+
// Suppression de l'area
25+
returndelete_area(s);
26+
}
27+
28+
// Attachement à une zone de mémoire partagée
29+
// L'area doit bien partie de notre adress-space et on retourne directement l'adress
30+
int*shmat(intmemId,intm1,intm2)
31+
{
32+
//printf("shmat %d %d %d\n",memId,m1,m2);
33+
34+
// Lecture de notre team_id
35+
thread_infothinfo;
36+
team_infoteinfo;
37+
area_infoainfo;
38+
39+
get_thread_info(find_thread(NULL),&thinfo);
40+
get_team_info(thinfo.team,&teinfo);
41+
42+
// Lecture du teamid de l'area
43+
if (get_area_info(memId,&ainfo)!=B_OK)
44+
printf("AREA %d Invalide\n",memId);
45+
46+
if (ainfo.team==teinfo.team)
47+
{
48+
//retour de l'adresse
49+
//printf("attach area %d add %d\n",memId,ainfo.address);
50+
return (int*)ainfo.address;
51+
}
52+
else
53+
{
54+
// Clone de l'area
55+
area_idnarea;
56+
narea=clone_area(ainfo.name,&(ainfo.address),B_CLONE_ADDRESS,B_READ_AREA |B_WRITE_AREA,memId);
57+
get_area_info(narea,&ainfo);
58+
//printf("attach area %d in %d add %d\n",memId,narea,ainfo.address);
59+
return (int*)ainfo.address;
60+
}
61+
}
62+
63+
// Utilisé uniquement pour supprimer une zone de mémoire partagée
64+
// On fait la meme chose que le detach mais avec un id direct
65+
intshmctl(intshmid,intflag,structshmid_ds*dummy)
66+
{
67+
//printf("shmctl %d %d \n",shmid,flag);
68+
delete_area(shmid);
69+
return0;
70+
}
71+
72+
// Recupération d'une area en fonction de sa référence
73+
// L'area source est identifiée par son nom (convention à moi : SYSV_IPC_SHM : "memId)
74+
intshmget(intmemKey,intsize,intflag)
75+
{
76+
int32n_size;
77+
charnom[50];
78+
area_idparea;
79+
void*Address;
80+
area_ida;
81+
82+
n_size=((size/4096)+1)*4096;
83+
84+
//printf("shmget %d %d %d %d\n",memKey,size,flag,nsize);
85+
86+
// Determination du nom que doit avoir l'area
87+
sprintf(nom,"SYSV_IPC_SHM : %d",memKey);
88+
89+
90+
// Recherche de cette area
91+
parea=find_area(nom);
92+
93+
// L'area existe
94+
if (parea!=B_NAME_NOT_FOUND)
95+
{
96+
//printf("area found\n");
97+
returnparea;
98+
}
99+
100+
// L'area n'existe pas et on n'en demande pas la création : erreur
101+
if (flag==0)
102+
{
103+
//printf("area %s not found\n",nom);
104+
return-1;
105+
}
106+
107+
// L'area n'existe pas mais on demande sa création
108+
a=create_area(nom,&Address,B_ANY_ADDRESS,n_size,B_NO_LOCK,B_READ_AREA |B_WRITE_AREA);
109+
//printf("area %s : %d created addresse %d\n",nom,a,Address);
110+
returna;
111+
}
112+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp