Skip to content

Commit 7ea8403

Browse files
committed
The beos port in the source tree doesn't even compile. and even
after that dynamic loading isn't working and shared memory handling is broken. Attached with this message, there is a Zip file which contain : * beos.diff = patch file generated with difforig * beos = folder with beos support files which need to be moved in / src/backend/port * expected = foler with three file for message and precision difference in regression test * regression.diff = rule problem (need to kill the backend manualy) * dynloader = dynloader files (they are also in the pacth files, but there is so much modification that I have join full files) Everything works except a problem in 'rules' Is there some problems with rules in the current tree ? It used to works with last week tree. Cyril VELTER
1 parent a759460 commit 7ea8403

File tree

21 files changed

+1229
-398
lines changed

21 files changed

+1229
-398
lines changed

configure.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ nextstep*) template=nextstep ;;
8282
sysv4*) template=svr4 ;;
8383
sysv5uw*) template=unixware ;;
8484
ultrix*) template=ultrix4 ;;
85+
beos*) template=beos ;;
8586
esac
8687

8788
if test x"$template" = x"" ; then

src/Makefile.shlib

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.23 2000/09/17 13:02:29 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.24 2000/10/07 14:39:06 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -198,6 +198,11 @@ ifeq ($(PORTNAME), win)
198198
shlib := $(NAME)$(DLSUFFIX)
199199
endif
200200

201+
ifeq ($(PORTNAME), beos)
202+
install-shlib-dep := install-shlib
203+
shlib := lib$(NAME)$(DLSUFFIX)
204+
LDFLAGS_SL := -nostart -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
205+
endif
201206

202207
# Note that in what follows, shlib is empty when not building a shared
203208
# library.
@@ -225,6 +230,7 @@ endif
225230
endif # not win
226231

227232
ifdef shlib
233+
ifneq ($(PORTNAME), beos)
228234
ifneq ($(PORTNAME), win)
229235
ifneq ($(PORTNAME), aix)
230236

@@ -263,6 +269,15 @@ $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
263269
$(MAKE) -C $(top_builddir)/src/utils dllinit.o
264270

265271
endif # PORTNAME == win
272+
273+
else # PORTNAME == beos
274+
275+
# BEOS case
276+
$(shlib): $(OBJS)
277+
ln -fs $(top_srcdir)/src/backend/postgres _APP_
278+
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
279+
280+
endif # PORTNAME == beos
266281
endif # shlib
267282

268283

src/backend/main/main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.31 2000/10/03 03:11:15 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.32 2000/10/07 14:39:07 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -98,6 +98,12 @@ if (!geteuid())
9898
}
9999
#endif /* __BEOS__ */
100100

101+
#ifdef __BEOS__
102+
/* Specific beos actions on startup */
103+
beos_startup(argc,argv);
104+
#endif
105+
106+
101107
if (len >= 10 && !strcmp(argv[0] + len - 10, "postmaster"))
102108
exit(PostmasterMain(argc, argv));
103109

src/backend/port/Makefile.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# be converted to Method 2.
1414
#
1515
# IDENTIFICATION
16-
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.24 2000/08/31 16:10:16 petere Exp $
16+
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.25 2000/10/07 14:39:10 momjian Exp $
1717
#
1818
#-------------------------------------------------------------------------
1919

@@ -27,6 +27,9 @@ OBJS+= @STRTOL@ @STRTOUL@ @SNPRINTF@
2727
ifeq ($(PORTNAME), qnx4)
2828
OBJS += getrusage.o qnx4/SUBSYS.o
2929
endif
30+
ifeq ($(PORTNAME), beos)
31+
OBJS += beos/SUBSYS.o
32+
endif
3033
all: SUBSYS.o
3134

3235
SUBSYS.o: $(OBJS)
@@ -37,6 +40,9 @@ qnx4/SUBSYS.o: qnx4.dir
3740
qnx4.dir:
3841
$(MAKE) -C qnx4 all
3942

43+
beos/SUBSYS.o:
44+
$(MAKE) -C beos all
45+
4046
tas.o: tas.s
4147
$(CC) $(CFLAGS) -c tas.s
4248

src/backend/port/dynloader/beos.c

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,65 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.2 2000/10/03 03:11:15 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.3 2000/10/07 14:39:11 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

1616
#include "postgres.h"
17-
#include <kernel/OS.h>
18-
#include <image.h>
19-
#include <errno.h>
17+
#include "utils/dynamic_loader.h"
18+
#include "utils/elog.h"
2019

21-
#include "dynloader.h"
2220

23-
extern char pg_pathname[];
24-
25-
void *
26-
beos_dlopen(const char *filename)
21+
void *
22+
pg_dlopen(char *filename)
2723
{
28-
image_id id = -1;
24+
image_id* im;
25+
26+
/* Handle memory allocation to store the Id of the shared object*/
27+
im=(image_id*)(malloc(sizeof(image_id)));
28+
29+
/* Add-on loading */
30+
*im=beos_dl_open(filename);
31+
32+
return im;
33+
}
2934

30-
if ((id = load_add_on(filename)) < 0)
31-
return NULL;
3235

33-
return (void *) id;
36+
char *
37+
pg_dlerror()
38+
{
39+
static char errmsg[] = "Load Add-On failed";
40+
return errmsg;
3441
}
3542

36-
void
37-
beos_dlclose(void *handle)
43+
PGFunction
44+
pg_dlsym(void *handle, char *funcname)
3845
{
39-
image_id id = (image_id) handle;
40-
unload_add_on(id);
41-
return;
46+
PGFunction fpt;
47+
48+
/* Checking that "Handle" is valid */
49+
if ((handle) && ((*(int*)(handle))>=0))
50+
{
51+
/* Loading symbol */
52+
if(get_image_symbol(*((int*)(handle)),funcname,B_SYMBOL_TYPE_TEXT,(void**)&fpt)==B_OK);
53+
{
54+
return fpt;
55+
}
56+
elog(NOTICE, "loading symbol '%s' failed ",funcname);
57+
}
58+
elog(NOTICE, "add-on not loaded correctly");
59+
return NULL;
4260
}
4361

44-
void *
45-
beos_dlsym(void *handle, const char *name)
46-
{
47-
image_id id = (image_id)handle;
48-
void *addr;
49-
50-
if (get_image_symbol(id, name, B_SYMBOL_TYPE_ANY, &addr) != B_OK)
51-
return NULL;
52-
53-
return addr;
54-
}
55-
56-
char *
57-
beos_dlerror()
62+
void
63+
pg_dlclose(void *handle)
5864
{
59-
return (char *)strerror(errno);
60-
}
65+
/* Checking that "Handle" is valid */
66+
if ((handle) && ((*(int*)(handle))>=0))
67+
{
68+
if (beos_dl_close(*(image_id*)handle)!=B_OK)
69+
elog(NOTICE, "error while unloading add-on");
70+
free(handle);
71+
}
72+
}

src/backend/port/dynloader/beos.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,12 @@
77
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: beos.h,v 1.2 2000/10/03 03:11:15 momjian Exp $
10+
* $Id: beos.h,v 1.3 2000/10/07 14:39:11 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414
#ifndef PORT_PROTOS_H
1515
#define PORT_PROTOS_H
1616

17-
#include "postgres.h"
18-
19-
#include "fmgr.h"
20-
#include "utils/dynamic_loader.h"
21-
22-
char *beos_dlerror(void);
23-
void *beos_dlopen(const char *filename);
24-
void *beos_dlsym(void *handle, const char *name);
25-
void beos_dlclose(void *handle);
26-
27-
#define pg_dlopen(f) beos_dlopen(f)
28-
#define pg_dlsym beos_dlsym
29-
#define pg_dlclose beos_dlclose
30-
#define pg_dlerror beos_dlerror
31-
3217

3318
#endif /* PORT_PROTOS_H */

0 commit comments

Comments
 (0)