Skip to content

Commit 7a7e024

Browse files
committed
Here is the first batch of files and diffs for the BeOS port. I've run into
problems with some bits of it, but when all the patches are in it'll build and we can fix it from there :) I've got a version that builds and runs and that is the basis for these patches. The first file has the new additional files that are required, template/beos backend/port/dynloader/beos.c backend/port/dynloader/beos.h include/port/beos.h makefiles/Makefile.beos The second is a tarball of diffs against a few files. I've added sys/ipc.h to configure and config.h via configure.in and config.h.in and then started adding the check as this file isn't needed on BeOS and having loads of #ifdef BEOS isn't as obvious as #ifdef HAVE_SYS_IPC_H and isn't as autconf'ish :) Files touched are include/c.h configure.in include/config.h.in include/storage/ipc.h include/utils/int8.h Let me know how these go. I'll await a response before submitting any more. Any problems just get in touch. David Reid
1 parent 89f6443 commit 7a7e024

File tree

9 files changed

+141
-4
lines changed

9 files changed

+141
-4
lines changed

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ fi
660660
## Header files
661661
##
662662
dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
663-
AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.h pwd.h sys/pstat.h sys/select.h sys/socket.h sys/types.h sys/un.h termios.h])
663+
AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/socket.h sys/types.h sys/un.h termios.h])
664664

665665
AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
666666
AC_CHECK_HEADERS([readline/history.h history.h], [break])

src/backend/port/dynloader/beos.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* dynloader.c
4+
* Dynamic Loader for Postgres for BeOS
5+
*
6+
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
7+
* Portions Copyright (c) 1994, Regents of the University of California
8+
*
9+
*
10+
* IDENTIFICATION
11+
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.1 2000/10/02 17:15:53 momjian Exp $
12+
*
13+
*-------------------------------------------------------------------------
14+
*/
15+
16+
#include "postgres.h"
17+
#include <kernel/OS.h>
18+
#include <image.h>
19+
#include <errno.h>
20+
21+
#include "dynloader.h"
22+
23+
extern char pg_pathname[];
24+
25+
void *
26+
beos_dlopen(const char *filename)
27+
{
28+
image_id id = -1;
29+
30+
if ((id = load_add_on(filename)) < 0)
31+
return NULL;
32+
33+
return (void *) id;
34+
}
35+
36+
void
37+
beos_dlclose(void *handle)
38+
{
39+
image_id id = (image_id) handle;
40+
unload_add_on(id);
41+
return;
42+
}
43+
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()
58+
{
59+
return (char *)strerror(errno);
60+
}

src/backend/port/dynloader/beos.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port_protos.h
4+
* port-specific prototypes for BeOS
5+
*
6+
*
7+
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
8+
* Portions Copyright (c) 1994, Regents of the University of California
9+
*
10+
* $Id: beos.h,v 1.1 2000/10/02 17:15:53 momjian Exp $
11+
*
12+
*-------------------------------------------------------------------------
13+
*/
14+
#ifndef PORT_PROTOS_H
15+
#define PORT_PROTOS_H
16+
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+
32+
33+
#endif /* PORT_PROTOS_H */

src/include/c.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: c.h,v 1.82 2000/09/29 13:53:32 petere Exp $
11+
* $Id: c.h,v 1.83 2000/10/02 17:15:55 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -56,6 +56,9 @@
5656
#include <errno.h>
5757
#include <sys/fcntl.h> /* ensure O_BINARY is available */
5858
#endif
59+
#ifdef __BEOS__
60+
#include <SupportDefs.h>
61+
#endif
5962

6063
/* ----------------------------------------------------------------
6164
* Section 1: bool, true, false, TRUE, FALSE, NULL
@@ -66,6 +69,7 @@
6669
* Boolean value, either true or false.
6770
*
6871
*/
72+
#ifndef __BEOS__
6973
#ifndef __cplusplus
7074
#ifndef bool
7175
typedef char bool;
@@ -78,6 +82,7 @@ typedef char bool;
7882
#ifndef false
7983
#define false ((bool) 0)
8084
#endif
85+
#endif /* __BEOS__ */
8186
typedef bool *BoolPtr;
8287

8388
#ifndef TRUE
@@ -165,19 +170,23 @@ typedef char *Pointer;
165170
* used for numerical computations and the
166171
* frontend/backend protocol.
167172
*/
173+
#ifndef __BEOS__
168174
typedef signed char int8; /* == 8 bits */
169175
typedef signed short int16; /* == 16 bits */
170176
typedef signed int int32; /* == 32 bits */
177+
#endif /* __BEOS__ */
171178

172179
/*
173180
* uintN
174181
* Unsigned integer, EXACTLY N BITS IN SIZE,
175182
* used for numerical computations and the
176183
* frontend/backend protocol.
177184
*/
185+
#ifndef __BEOS__
178186
typedef unsigned char uint8; /* == 8 bits */
179187
typedef unsigned short uint16; /* == 16 bits */
180188
typedef unsigned int uint32; /* == 32 bits */
189+
#endif /* __BEOS__ */
181190

182191
/*
183192
* floatN
@@ -259,6 +268,8 @@ typedef int32 int4;
259268
typedef float float4;
260269
typedef double float8;
261270

271+
/* BeOS already has int64 defined, so skip these... */
272+
#ifndef BEOS
262273
#ifdef HAVE_LONG_INT_64
263274
/* Plain "long int" fits, use it */
264275
typedef long int int64;
@@ -272,6 +283,9 @@ typedef long int int64;
272283
#define INT64_IS_BUSTED
273284
#endif
274285
#endif
286+
#else /* Add BeOS support */
287+
#include <SupportDefs.h>
288+
#endif /* BEOS */
275289

276290
/* ----------------------------------------------------------------
277291
* Section 4: datum type + support macros

src/include/config.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.137 2000/09/29 22:00:45 momjian Exp $
11+
* $Id: config.h.in,v 1.138 2000/10/02 17:15:55 momjian Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -342,6 +342,9 @@
342342
/* Set to 1 if you have <readline/readline.h> */
343343
#undef HAVE_READLINE_READLINE_H
344344

345+
/* Define if you have <sys/ipc.h> */
346+
#undef HAVE_SYS_IPC_H
347+
345348
/* Set to 1 if you have <sys/select.h> */
346349
#undef HAVE_SYS_SELECT_H
347350

src/include/port/beos.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <kernel/OS.h>
2+
#define USE_POSIX_TIME
3+
#define HAS_TEST_AND_SET
4+
5+
typedef unsigned char slock_t;
6+
7+
#define AF_UNIX 1
8+
#define IPPROTO_IP 0
9+
10+

src/include/storage/ipc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: ipc.h,v 1.38 2000/01/26 05:58:32 momjian Exp $
10+
* $Id: ipc.h,v 1.39 2000/10/02 17:15:58 momjian Exp $
1111
*
1212
* NOTES
1313
* This file is very architecture-specific. This stuff should actually
@@ -23,7 +23,9 @@
2323
#define IPC_H
2424

2525
#include <sys/types.h>
26+
#ifdef HAVE_SYS_IPC_H
2627
#include <sys/ipc.h> /* For IPC_PRIVATE */
28+
#endif
2729

2830
#include "config.h"
2931

src/makefiles/Makefile.beos

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
MK_NO_LORDER=true
2+
ifdef ELF_SYSTEM
3+
LDFLAGS += -Wl,-E
4+
endif
5+
%.so: %.o
6+
$(LD) -x -Bshareable -o $@ $<

src/template/beos

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
AROPT:crs
2+
SHARED_LIB:-fpic -DPIC
3+
CFLAGS:-O2 -DBEOS
4+
SRCH_INC:
5+
SRCH_LIB:
6+
USE_LOCALE:no
7+
DLSUFFIX:.so
8+
YFLAGS:-d
9+
YACC:bison -y

0 commit comments

Comments
 (0)