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

Commit7d03946

Browse files
committed
Commit BEOS patch to 7.1.X.
1 parent7df68bd commit7d03946

File tree

3 files changed

+53
-20
lines changed

3 files changed

+53
-20
lines changed

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

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,22 @@ beos_dl_open(char *filename)
115115
}
116116
}
117117

118+
void
119+
beos_dl_sym(image_idim,char*symname,void**fptr)
120+
{
121+
/* Send command '3' (get symbol) to the support server */
122+
write_port(beos_dl_port_in,3,symname,strlen(symname)+1);
123+
write_port(beos_dl_port_in,im,NULL,0);
124+
125+
/* Read sym address */
126+
read_port(beos_dl_port_out, (int32*)(fptr),NULL,0);
127+
128+
if (fptr==NULL)
129+
{
130+
elog(NOTICE,"loading symbol '%s' failed ",symname);
131+
}
132+
}
133+
118134
status_t
119135
beos_dl_close(image_idim)
120136
{
@@ -164,12 +180,13 @@ beos_startup(int argc, char **argv)
164180
* server
165181
*/
166182
read_port(port_in,&opcode,datas,4000);
167-
183+
168184
switch (opcode)
169185
{
170186
image_idaddon;
171187
image_infoinfo_im;
172188
area_infoinfo_ar;
189+
void*fpt;
173190

174191
/* Load Add-On */
175192
case1:
@@ -208,6 +225,33 @@ beos_startup(int argc, char **argv)
208225
write_port(port_out,unload_add_on(*((int*) (datas))),NULL,0);
209226
break;
210227
/* Cleanup and exit */
228+
case3:
229+
230+
/* read image Id on the input port */
231+
read_port(port_in,&addon,NULL,0);
232+
233+
/* Loading symbol */
234+
fpt=NULL;
235+
236+
237+
if (get_image_symbol(addon,datas,B_SYMBOL_TYPE_TEXT,&fpt)==B_OK);
238+
{
239+
240+
/*
241+
* Sometime the loader return B_OK for an inexistant function
242+
* with an invalid address !!! Check that the return address
243+
* is in the image range
244+
*/
245+
246+
get_image_info(addon,&info_im);
247+
if ((fpt<info_im.text)||(fpt >= (info_im.text+info_im.text_size)))
248+
fpt=NULL;
249+
}
250+
251+
/* Send back fptr of data segment */
252+
write_port(port_out, (int32)(fpt),NULL,0);
253+
break;
254+
211255
default:
212256
/* Free system resources */
213257
delete_port(port_in);

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.7 2001/03/22 03:59:42 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.7.2.1 2001/08/07 18:36:52 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -49,23 +49,8 @@ pg_dlsym(void *handle, char *funcname)
4949
/* Checking that "Handle" is valid */
5050
if ((handle)&& ((*(int*) (handle)) >=0))
5151
{
52-
/* Loading symbol */
53-
if (get_image_symbol(*((int*) (handle)),funcname,B_SYMBOL_TYPE_TEXT, (void**)&fpt)==B_OK);
54-
{
55-
56-
/*
57-
* Sometime the loader return B_OK for an inexistant function
58-
* with an invalid address !!! Check that the return address
59-
* is in the image range
60-
*/
61-
image_infoinfo;
62-
63-
get_image_info(*((int*) (handle)),&info);
64-
if ((fpt<info.text)||(fpt >= (info.text+info.text_size)))
65-
returnNULL;
66-
returnfpt;
67-
}
68-
elog(NOTICE,"loading symbol '%s' failed ",funcname);
52+
beos_dl_sym(*((int*) (handle)),funcname,(void**)&fpt);
53+
returnfpt;
6954
}
7055
elog(NOTICE,"add-on not loaded correctly");
7156
returnNULL;

‎src/include/port/beos.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include<kernel/OS.h>
2-
#include"kernel/image.h"
2+
#include<kernel/image.h>
3+
#include<sys/ioctl.h>
34

45
#defineHAS_TEST_AND_SET
56

@@ -69,6 +70,9 @@ voidbeos_startup(int argc, char **argv);
6970
/* Load a shared library */
7071
image_idbeos_dl_open(char*filename);
7172

73+
/* Find symbol */
74+
voidbeos_dl_sym(image_idim,char*symname,void**fptr);
75+
7276
/* UnLoad a shared library */
7377
status_tbeos_dl_close(image_idim);
7478

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp