]> granicus.if.org Git - postgresql/commitdiff
Here is the first batch of files and diffs for the BeOS port. I've run into
authorBruce Momjian <bruce@momjian.us>
Mon, 2 Oct 2000 17:16:01 +0000 (17:16 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 2 Oct 2000 17:16:01 +0000 (17:16 +0000)
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

configure.in
src/backend/port/dynloader/beos.c [new file with mode: 0644]
src/backend/port/dynloader/beos.h [new file with mode: 0644]
src/include/c.h
src/include/config.h.in
src/include/port/beos.h [new file with mode: 0644]
src/include/storage/ipc.h
src/makefiles/Makefile.beos [new file with mode: 0644]
src/template/beos [new file with mode: 0644]

index 51230d9e22062318af60b053be56074be94fee5c..798f6728a62bd24c056a389b67f35f2c7b91c5f7 100644 (file)
@@ -660,7 +660,7 @@ fi
 ## Header files
 ##
 dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
-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])
+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])
 
 AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
 AC_CHECK_HEADERS([readline/history.h history.h], [break])
diff --git a/src/backend/port/dynloader/beos.c b/src/backend/port/dynloader/beos.c
new file mode 100644 (file)
index 0000000..c2a6b78
--- /dev/null
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+ *
+ * dynloader.c
+ *       Dynamic Loader for Postgres for BeOS
+ *
+ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *       $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.1 2000/10/02 17:15:53 momjian Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include <kernel/OS.h>
+#include <image.h>
+#include <errno.h>
+
+#include "dynloader.h"
+
+extern char pg_pathname[];
+
+void *
+beos_dlopen(const char *filename)
+{
+    image_id id = -1;
+
+       if ((id = load_add_on(filename)) < 0)
+               return NULL;
+
+       return (void *) id;
+}
+
+void 
+beos_dlclose(void *handle)
+{
+    image_id id = (image_id) handle;
+    unload_add_on(id);
+    return;
+}
+
+void *
+beos_dlsym(void *handle, const char *name)
+{
+    image_id id = (image_id)handle;
+    void *addr;
+    
+    if (get_image_symbol(id, name, B_SYMBOL_TYPE_ANY, &addr) != B_OK)
+        return NULL;
+    
+    return addr;
+} 
+        
+char *
+beos_dlerror()
+{
+    return (char *)strerror(errno);
+}
diff --git a/src/backend/port/dynloader/beos.h b/src/backend/port/dynloader/beos.h
new file mode 100644 (file)
index 0000000..3765ff0
--- /dev/null
@@ -0,0 +1,33 @@
+/*-------------------------------------------------------------------------
+ *
+ * port_protos.h
+ *       port-specific prototypes for BeOS
+ *
+ *
+ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: beos.h,v 1.1 2000/10/02 17:15:53 momjian Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PORT_PROTOS_H
+#define PORT_PROTOS_H
+
+#include "postgres.h"
+
+#include "fmgr.h"
+#include "utils/dynamic_loader.h"
+
+char      *beos_dlerror(void);
+void      *beos_dlopen(const char *filename);
+void      *beos_dlsym(void *handle, const char *name);
+void           beos_dlclose(void *handle);
+
+#define                   pg_dlopen(f)    beos_dlopen(f)
+#define                   pg_dlsym                beos_dlsym
+#define                   pg_dlclose      beos_dlclose
+#define                   pg_dlerror      beos_dlerror
+
+
+#endif  /* PORT_PROTOS_H */
index a11106df8c872750c95a260d3d63f14922a2283d..fcef4a0ff301f621ffc4935de5b2ad14307a430c 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.82 2000/09/29 13:53:32 petere Exp $
+ * $Id: c.h,v 1.83 2000/10/02 17:15:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -56,6 +56,9 @@
 #include <errno.h>
 #include <sys/fcntl.h>         /* ensure O_BINARY is available */
 #endif
+#ifdef __BEOS__
+#include <SupportDefs.h>
+#endif
 
 /* ----------------------------------------------------------------
  *                             Section 1:      bool, true, false, TRUE, FALSE, NULL
@@ -66,6 +69,7 @@
  *             Boolean value, either true or false.
  *
  */
+#ifndef __BEOS__
 #ifndef __cplusplus
 #ifndef bool
 typedef char bool;
@@ -78,6 +82,7 @@ typedef char bool;
 #ifndef false
 #define false  ((bool) 0)
 #endif
+#endif /* __BEOS__ */
 typedef bool *BoolPtr;
 
 #ifndef TRUE
@@ -165,9 +170,11 @@ typedef char *Pointer;
  *             used for numerical computations and the
  *             frontend/backend protocol.
  */
+#ifndef __BEOS__
 typedef signed char int8;              /* == 8 bits */
 typedef signed short int16;            /* == 16 bits */
 typedef signed int int32;              /* == 32 bits */
+#endif /* __BEOS__ */
 
 /*
  * uintN
@@ -175,9 +182,11 @@ typedef signed int int32;          /* == 32 bits */
  *             used for numerical computations and the
  *             frontend/backend protocol.
  */
+#ifndef __BEOS__
 typedef unsigned char uint8;   /* == 8 bits */
 typedef unsigned short uint16; /* == 16 bits */
 typedef unsigned int uint32;   /* == 32 bits */
+#endif /* __BEOS__ */
 
 /*
  * floatN
@@ -259,6 +268,8 @@ typedef int32 int4;
 typedef float float4;
 typedef double float8;
 
+/* BeOS already has int64 defined, so skip these... */
+#ifndef BEOS
 #ifdef HAVE_LONG_INT_64
 /* Plain "long int" fits, use it */
 typedef long int int64;
@@ -272,6 +283,9 @@ typedef long int int64;
 #define INT64_IS_BUSTED
 #endif
 #endif
+#else /* Add BeOS support */
+#include <SupportDefs.h>
+#endif /* BEOS */
 
 /* ----------------------------------------------------------------
  *                             Section 4:      datum type + support macros
index c363bceb4ca1ab69001a6ba7b8837e4dad1cf77a..86b9623995e0fbca5d552080f0545dc28f402ac7 100644 (file)
@@ -8,7 +8,7 @@
  * or in config.h afterwards.  Of course, if you edit config.h, then your
  * changes will be overwritten the next time you run configure.
  *
- * $Id: config.h.in,v 1.137 2000/09/29 22:00:45 momjian Exp $
+ * $Id: config.h.in,v 1.138 2000/10/02 17:15:55 momjian Exp $
  */
 
 #ifndef CONFIG_H
 /* Set to 1 if you have <readline/readline.h> */
 #undef HAVE_READLINE_READLINE_H
 
+/* Define if you have <sys/ipc.h> */
+#undef HAVE_SYS_IPC_H
+
 /* Set to 1 if  you have <sys/select.h> */
 #undef HAVE_SYS_SELECT_H
 
diff --git a/src/include/port/beos.h b/src/include/port/beos.h
new file mode 100644 (file)
index 0000000..c7b33ef
--- /dev/null
@@ -0,0 +1,10 @@
+#include <kernel/OS.h>
+#define USE_POSIX_TIME
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define AF_UNIX     1
+#define IPPROTO_IP  0
+
+
index 7b015130281f0cefe1d9a8213932209c649648ad..a3abfea03771b5c1d525227c79364abc340c7c2c 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: ipc.h,v 1.38 2000/01/26 05:58:32 momjian Exp $
+ * $Id: ipc.h,v 1.39 2000/10/02 17:15:58 momjian Exp $
  *
  * NOTES
  *       This file is very architecture-specific.      This stuff should actually
@@ -23,7 +23,9 @@
 #define IPC_H
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_IPC_H
 #include <sys/ipc.h>                   /* For IPC_PRIVATE */
+#endif
 
 #include "config.h"
 
diff --git a/src/makefiles/Makefile.beos b/src/makefiles/Makefile.beos
new file mode 100644 (file)
index 0000000..d0ca050
--- /dev/null
@@ -0,0 +1,6 @@
+MK_NO_LORDER=true
+ifdef ELF_SYSTEM
+LDFLAGS += -Wl,-E
+endif
+%.so: %.o
+       $(LD) -x -Bshareable -o $@ $<
diff --git a/src/template/beos b/src/template/beos
new file mode 100644 (file)
index 0000000..0a62b51
--- /dev/null
@@ -0,0 +1,9 @@
+AROPT:crs
+SHARED_LIB:-fpic -DPIC
+CFLAGS:-O2 -DBEOS
+SRCH_INC:
+SRCH_LIB:
+USE_LOCALE:no
+DLSUFFIX:.so
+YFLAGS:-d
+YACC:bison -y