1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

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
This commit is contained in:
Bruce Momjian
2000-10-07 14:39:21 +00:00
parent a759460178
commit 7ea8403c8a
21 changed files with 1231 additions and 400 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.31 2000/10/03 03:11:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.32 2000/10/07 14:39:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,6 +98,12 @@ if (!geteuid())
}
#endif /* __BEOS__ */
#ifdef __BEOS__
/* Specific beos actions on startup */
beos_startup(argc,argv);
#endif
if (len >= 10 && !strcmp(argv[0] + len - 10, "postmaster"))
exit(PostmasterMain(argc, argv));

View File

@@ -13,7 +13,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.24 2000/08/31 16:10:16 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.25 2000/10/07 14:39:10 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -27,6 +27,9 @@ OBJS+= @STRTOL@ @STRTOUL@ @SNPRINTF@
ifeq ($(PORTNAME), qnx4)
OBJS += getrusage.o qnx4/SUBSYS.o
endif
ifeq ($(PORTNAME), beos)
OBJS += beos/SUBSYS.o
endif
all: SUBSYS.o
SUBSYS.o: $(OBJS)
@@ -37,6 +40,9 @@ qnx4/SUBSYS.o: qnx4.dir
qnx4.dir:
$(MAKE) -C qnx4 all
beos/SUBSYS.o:
$(MAKE) -C beos all
tas.o: tas.s
$(CC) $(CFLAGS) -c tas.s

View File

@@ -8,53 +8,65 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.2 2000/10/03 03:11:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.3 2000/10/07 14:39:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <kernel/OS.h>
#include <image.h>
#include <errno.h>
#include "utils/dynamic_loader.h"
#include "utils/elog.h"
#include "dynloader.h"
extern char pg_pathname[];
void *
beos_dlopen(const char *filename)
void *
pg_dlopen(char *filename)
{
image_id id = -1;
image_id* im;
/* Handle memory allocation to store the Id of the shared object*/
im=(image_id*)(malloc(sizeof(image_id)));
/* Add-on loading */
*im=beos_dl_open(filename);
return im;
}
if ((id = load_add_on(filename)) < 0)
return NULL;
return (void *) id;
char *
pg_dlerror()
{
static char errmsg[] = "Load Add-On failed";
return errmsg;
}
PGFunction
pg_dlsym(void *handle, char *funcname)
{
PGFunction fpt;
/* Checking that "Handle" is valid */
if ((handle) && ((*(int*)(handle))>=0))
{
/* Loading symbol */
if(get_image_symbol(*((int*)(handle)),funcname,B_SYMBOL_TYPE_TEXT,(void**)&fpt)==B_OK);
{
return fpt;
}
elog(NOTICE, "loading symbol '%s' failed ",funcname);
}
elog(NOTICE, "add-on not loaded correctly");
return NULL;
}
void
beos_dlclose(void *handle)
pg_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);
}
/* Checking that "Handle" is valid */
if ((handle) && ((*(int*)(handle))>=0))
{
if (beos_dl_close(*(image_id*)handle)!=B_OK)
elog(NOTICE, "error while unloading add-on");
free(handle);
}
}

View File

@@ -7,27 +7,12 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: beos.h,v 1.2 2000/10/03 03:11:15 momjian Exp $
* $Id: beos.h,v 1.3 2000/10/07 14:39:11 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 */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.51 2000/10/03 03:11:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.52 2000/10/07 14:39:12 momjian Exp $
*
* NOTES
*
@@ -243,17 +243,12 @@ on_exit_reset(void)
static void
IPCPrivateSemaphoreKill(int status, int semId)
{
/* BeOS has a native sempahore type... */
#ifndef __BEOS__
union semun semun;
semun.val = 0; /* unused */
if (semctl(semId, 0, IPC_RMID, semun) == -1)
elog(NOTICE, "IPCPrivateSemaphoreKill: semctl(%d, 0, IPC_RMID, ...) failed: %s",
semId, strerror(errno));
#else /* __BEOS__ */
delete_sem(semId);
#endif /* __BEOS__ */
}
@@ -270,18 +265,11 @@ IPCPrivateMemoryKill(int status, int shmId)
}
else
{
#ifndef __BEOS__
if (shmctl(shmId, IPC_RMID, (struct shmid_ds *) NULL) < 0)
{
elog(NOTICE, "IPCPrivateMemoryKill: shmctl(%d, %d, 0) failed: %m",
shmId, IPC_RMID);
}
#else
if (delete_area(shmId) != B_OK)
{
elog(NOTICE, "IPCPrivateMemoryKill: delete_area(%d) failed", shmId);
}
#endif /* __BEOS__ */
}
}
@@ -304,7 +292,6 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
int removeOnExit)
{
int semId;
#ifndef __BEOS__
int i;
int errStatus;
u_short array[IPC_NMAXSEM];
@@ -366,21 +353,6 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
}
#else /* BeOS implementation */
char semname[32];
sprintf (semname, "pgsql_ipc:%ld", semKey);
semId = create_sem(1, semname);
if (semId < 0) {
fprintf(stderr, "IpcSemaphoreCreate: create_sem(1, %s) failed: %s\n",
semname, strerror(errno));
return (-1);
}
if (removeOnExit)
on_shmem_exit(IPCPrivateSemaphoreKill, (caddr_t) semId);
#endif
#ifdef DEBUG_IPC
fprintf(stderr, "IpcSemaphoreCreate returns %d\n", semId);
fflush(stdout);
@@ -424,7 +396,6 @@ void
IpcSemaphoreKill(IpcSemaphoreKey key)
{
int semId;
#ifndef __BEOS__
union semun semun;
semun.val = 0; /* unused */
@@ -433,23 +404,6 @@ IpcSemaphoreKill(IpcSemaphoreKey key)
semId = semget(key, 0, 0);
if (semId != -1)
semctl(semId, 0, IPC_RMID, semun);
#else
/* first find the semId by looking at sempahore names... */
sem_info si;
int32 cookie = 0;
char semname[32];
sprintf(semname, "pgsql_ipc:%ld", key);
semId = -1;
while (get_next_sem_info(0, &cookie, &si) == B_OK) {
if (strcmp(si.name, semname) == 0){
semId = si.sem;
break;
}
}
if (semId != -1)
delete_sem(semId);
#endif
}
/****************************************************************************/
@@ -462,7 +416,6 @@ static int IpcSemaphoreLock_return;
void
IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
{
#ifndef __BEOS__
extern int errno;
int errStatus;
struct sembuf sops;
@@ -495,13 +448,6 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
semId, strerror(errno));
proc_exit(255);
}
#else
if ((IpcSemaphoreLock_return = acquire_sem(semId)) != B_NO_ERROR) {
fprintf(stderr, "IpcSempahoreLock: acquire_sem failed on sem_id %d: %s\n",
semId, strerror(errno));
proc_exit(255);
}
#endif
}
/****************************************************************************/
@@ -514,7 +460,6 @@ static int IpcSemaphoreUnlock_return;
void
IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
{
#ifndef __BEOS__
extern int errno;
int errStatus;
struct sembuf sops;
@@ -548,49 +493,28 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
semId, strerror(errno));
proc_exit(255);
}
#else
if ((IpcSemaphoreUnlock_return = release_sem(semId)) != B_NO_ERROR) {
fprintf(stderr, "IpcSempahoreUnlock: release_sem failed on sem_id %d: %s\n",
semId, strerror(errno));
proc_exit(255);
}
#endif
}
int
IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
{
#ifndef __BEOS__
int semncnt;
union semun dummy; /* for Solaris */
dummy.val = 0; /* unused */
semncnt = semctl(semId, sem, GETNCNT, dummy);
return semncnt;
#else
sem_info si;
get_sem_info(semId, &si);
return si.count;
#endif /* __BEOS__ */
}
int
IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
{
#ifndef __BEOS__
int semval;
union semun dummy; /* for Solaris */
dummy.val = 0; /* unused */
semval = semctl(semId, sem, GETVAL, dummy);
return semval;
#else
sem_info si;
get_sem_info(semId, &si);
return si.count;
#endif /* __BEOS__ */
}
/****************************************************************************/
@@ -611,7 +535,6 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
shmid = PrivateMemoryCreate(memKey, size);
}
else
#ifndef __BEOS__
shmid = shmget(memKey, size, IPC_CREAT | permission);
@@ -649,24 +572,6 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
return IpcMemCreationFailed;
}
#else
{
char *addr;
uint32 pages = ((size - 1) / B_PAGE_SIZE) +1;
char areaname[32];
sprintf (areaname, "pgsql_ipc%ld", memKey);
shmid = create_area(areaname, (void*)&addr, B_ANY_ADDRESS, pages * B_PAGE_SIZE,
B_NO_LOCK, B_READ_AREA|B_WRITE_AREA);
}
if (shmid < 0) {
fprintf(stderr, "IpcMemoryCreate: failed: %s\n",
strerror(errno));
return IpcMemCreationFailed;
}
#endif /* __BEOS__ */
/* if (memKey == PrivateIPCKey) */
on_shmem_exit(IPCPrivateMemoryKill, (Datum) shmid);
@@ -683,7 +588,6 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
{
IpcMemoryId shmid;
#ifndef __BEOS__
shmid = shmget(memKey, size, 0);
if (shmid < 0)
@@ -692,17 +596,6 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
memKey, size, strerror(errno));
return IpcMemIdGetFailed;
}
#else
char areaname[32];
sprintf(areaname, "pgsql_ipc%ld", memKey);
shmid = find_area(areaname);
if (shmid == B_NAME_NOT_FOUND){
fprintf(stderr, "IpcMemoryIdGet: find_area(%s) failed: %s\n",
areaname, strerror(errno));
return IpcMemIdGetFailed;
}
#endif /* __BEOS__ */
return shmid;
}
@@ -715,10 +608,8 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
static void
IpcMemoryDetach(int status, char *shmaddr)
{
#ifndef __BEOS__
if (shmdt(shmaddr) < 0)
elog(NOTICE, "IpcMemoryDetach: shmdt(0x%p) failed: %m", shmaddr);
#endif
}
/****************************************************************************/
@@ -733,7 +624,6 @@ IpcMemoryAttach(IpcMemoryId memId)
{
char *memAddress;
#ifndef __BEOS__
if (UsePrivateMemory)
memAddress = (char *) PrivateMemoryAttach(memId);
else
@@ -746,23 +636,6 @@ IpcMemoryAttach(IpcMemoryId memId)
memId, strerror(errno));
return IpcMemAttachFailed;
}
#else
if (UsePrivateMemory)
memAddress = (char *) PrivateMemoryAttach(memId);
else
{
area_info ai;
get_area_info(memId, &ai);
memAddress = (char *)ai.address;
}
if (memAddress == (char *)-1) {
fprintf(stderr,"IpcMemoryAttach: failed to get area address (%d): %s\n",
memId, strerror(errno));
return IpcMemAttachFailed;
}
#endif /* __BEOS__ */
if (!UsePrivateMemory)
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
@@ -780,7 +653,6 @@ IpcMemoryKill(IpcMemoryKey memKey)
{
IpcMemoryId shmid;
#ifndef __BEOS__
if (!UsePrivateMemory && (shmid = shmget(memKey, 0, 0)) >= 0)
{
if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
@@ -789,15 +661,6 @@ IpcMemoryKill(IpcMemoryKey memKey)
shmid, IPC_RMID);
}
}
#else
char areaname[32];
sprintf(areaname, "pgsql_ipc%ld", memKey);
shmid = find_area(areaname);
if (!UsePrivateMemory && shmid > 0) {
if (delete_area(shmid) != B_OK)
elog(NOTICE, "IpcMemoryKill: deleta_area(%d) failed!", shmid);
}
#endif /* __BEOS__ */
}
#ifdef HAS_TEST_AND_SET

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.83 2000/10/07 14:39:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.83 2000/10/07 14:39:13 momjian Exp $
*/
#include "postgres.h"
@@ -266,10 +266,8 @@ InitProcess(IPCKey key)
* we might be reusing a semaphore that belongs to a dead backend.
* So be careful and reinitialize its value here.
*/
#ifndef __BEOS__
semun.val = IpcSemaphoreDefaultStartValue;
semctl(semId, semNum, SETVAL, semun);
#endif
IpcSemaphoreLock(semId, semNum, IpcExclusiveLock);
MyProc->sem.semId = semId;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.179 2000/10/07 04:00:41 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.180 2000/10/07 14:39:14 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1462,6 +1462,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (IsUnderPostmaster)
{
#ifdef __BEOS__
/* Specific beos backend stratup actions */
beos_backend_startup(argv[0]);
#endif
/* noninteractive case: nothing should be left after switches */
if (errs || argc != optind || DBName == NULL)
{
@@ -1613,7 +1618,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.179 $ $Date: 2000/10/07 04:00:41 $\n");
puts("$Revision: 1.180 $ $Date: 2000/10/07 14:39:14 $\n");
}
/*

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.63 2000/10/03 03:11:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.64 2000/10/07 14:39:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,6 +144,9 @@ elog(int lev, const char *fmt, ...)
sprintf(errorstr_buf, "error %d", errno);
errorstr = errorstr_buf;
}
#else
errorstr = strerror(errno);
#endif /* __BEOS__ */
if (lev == ERROR || lev == FATAL)
{
@@ -182,9 +185,6 @@ elog(int lev, const char *fmt, ...)
prefix = prefix_buf;
break;
}
#else
errorstr = strerror(errno);
#endif /* __BEOS__ */
timestamp_size = 0;
if (Log_timestamp)