Commit 7ea8403c authored by Bruce Momjian's avatar Bruce Momjian

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
parent a7594601
......@@ -82,6 +82,7 @@ nextstep*) template=nextstep ;;
sysv4*) template=svr4 ;;
sysv5uw*) template=unixware ;;
ultrix*) template=ultrix4 ;;
beos*) template=beos ;;
esac
if test x"$template" = x"" ; then
......
......@@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.23 2000/09/17 13:02:29 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.24 2000/10/07 14:39:06 momjian Exp $
#
#-------------------------------------------------------------------------
......@@ -198,6 +198,11 @@ ifeq ($(PORTNAME), win)
shlib := $(NAME)$(DLSUFFIX)
endif
ifeq ($(PORTNAME), beos)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX)
LDFLAGS_SL := -nostart -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
endif
# Note that in what follows, shlib is empty when not building a shared
# library.
......@@ -225,6 +230,7 @@ endif
endif # not win
ifdef shlib
ifneq ($(PORTNAME), beos)
ifneq ($(PORTNAME), win)
ifneq ($(PORTNAME), aix)
......@@ -263,6 +269,15 @@ $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
$(MAKE) -C $(top_builddir)/src/utils dllinit.o
endif # PORTNAME == win
else # PORTNAME == beos
# BEOS case
$(shlib): $(OBJS)
ln -fs $(top_srcdir)/src/backend/postgres _APP_
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
endif # PORTNAME == beos
endif # shlib
......
......@@ -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));
......
......@@ -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
......
......@@ -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;
}
void
beos_dlclose(void *handle)
PGFunction
pg_dlsym(void *handle, char *funcname)
{
image_id id = (image_id) handle;
unload_add_on(id);
return;
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_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()
void
pg_dlclose(void *handle)
{
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);
}
}
\ No newline at end of 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 */
......@@ -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
......
......@@ -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;
......
......@@ -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");
}
/*
......
......@@ -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)
......
......@@ -6,7 +6,7 @@
*
* Copyright (C) 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.15 2000/05/29 21:26:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.16 2000/10/07 14:39:15 momjian Exp $
*/
#include "postgres.h"
......@@ -89,6 +89,11 @@ main(int argc, char *argv[])
else if (nameflag)
puts(pw->pw_name);
else
#ifdef __BEOS__
if (pw->pw_uid==0)
printf("1\n");
else
#endif
printf("%d\n", (int) pw->pw_uid);
return 0;
......
......@@ -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.140 2000/10/03 19:50:21 petere Exp $
* $Id: config.h.in,v 1.141 2000/10/07 14:39:16 momjian Exp $
*/
#ifndef CONFIG_H
......@@ -227,7 +227,7 @@
* Define this is your operating system kernel supports AF_UNIX family
* sockets.
*/
#if !defined(__CYGWIN__) && !defined(__QNX__)
#if !defined(__CYGWIN__) && !defined(__QNX__) && !defined(__BEOS__)
# define HAVE_UNIX_SOCKETS 1
#endif
......
......@@ -6,4 +6,68 @@ typedef unsigned char slock_t;
#define AF_UNIX 1 /* no domain sockets on BeOS */
#ifdef __cplusplus
extern "C" {
#endif
#include "kernel/image.h"
#undef HAVE_UNION_SEMUN
#define HAVE_UNION_SEMUN 1
#undef HAVE_SYS_SEM_H
#undef HAVE_SYS_SHM_H
union semun
{
int val;
struct semid_ds *buf;
unsigned short *array;
};
/* SYS V emulation */
#define IPC_RMID 256
#define IPC_CREAT 512
#define IPC_EXCL 1024
#define IPC_PRIVATE 234564
#define EACCESS 2048
#define EIDRM 4096
#define SETALL 8192
#define GETNCNT 16384
#define GETVAL 65536
#define SETVAL 131072
struct sembuf
{
int sem_flg;
int sem_op;
int sem_num;
};
int semctl(int semId,int semNum,int flag,union semun);
int semget(int semKey, int semNum, int flags);
int semop(int semId, struct sembuf *sops, int flag);
struct shmid_ds
{
int dummy;
};
int shmdt(char* shmaddr);
int* shmat(int memId,int m1,int m2);
int shmctl(int shmid,int flag, struct shmid_ds* dummy);
int shmget(int memKey,int size,int flag);
/* Support functions */
/* Specific beos action made on postgres/postmaster startup */
void beos_startup(int argc,char** argv);
/* Load a shared library */
image_id beos_dl_open(char * filename);
/* UnLoad a shared library */
status_t beos_dl_close(image_id im);
/* Specific beos action made on backend startup */
void beos_backend_startup(char* binary);
#ifdef __cplusplus
}
#endif
\ No newline at end of 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.41 2000/10/03 03:11:24 momjian Exp $
* $Id: ipc.h,v 1.42 2000/10/07 14:39:17 momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
......@@ -27,11 +27,6 @@
#include <sys/types.h>
#ifdef HAVE_SYS_IPC_H
#include <sys/ipc.h> /* For IPC_PRIVATE */
#else
/* BeOS doesn't have IPC_PRIVATE so we'll use the value that is set by
* FreeBSD (1)
*/
#define IPC_PRIVATE 1
#endif /* HAVE_SYS_IPC_H */
#include "config.h"
......
MK_NO_LORDER=true
ifdef ELF_SYSTEM
LDFLAGS += -Wl,-E
CPPFLAGS+= -I$(top_srcdir)/src/backend/port/beos
endif
%.so: %.o
$(LD) -x -Bshareable -o $@ $<
ln -fs $(top_srcdir)/src/backend/postgres _APP_
$(CC) -nostart -Xlinker -soname=$@ -o $@ _APP_ $<
AROPT:crs
SHARED_LIB:-fpic -DPIC
CFLAGS:-O2
SRCH_INC:
SRCH_LIB:
USE_LOCALE:no
DLSUFFIX:.so
YFLAGS:-d
YACC:bison -y
AROPT=crs
SHARED_LIB='-fpic -DPIC'
CFLAGS='-O2'
LDFLAGS='-lbind'
SRCH_INC='/boot/apps/GeekGadgets/include'
SRCH_LIB='/boot/apps/GeekGadgets/lib'
USE_LOCALE=no
DLSUFFIX=.so
YFLAGS=-d
YACC='bison -y'
This diff is collapsed.
--
-- INT2
-- NOTE: int2 operators never check for over/underflow!
-- Some of these answers are consequently numerically incorrect.
--
CREATE TABLE INT2_TBL(f1 int2);
INSERT INTO INT2_TBL(f1) VALUES ('0');
INSERT INTO INT2_TBL(f1) VALUES ('1234');
INSERT INTO INT2_TBL(f1) VALUES ('-1234');
INSERT INTO INT2_TBL(f1) VALUES ('34.5');
ERROR: pg_atoi: error in "34.5": can't parse ".5"
-- largest and smallest values
INSERT INTO INT2_TBL(f1) VALUES ('32767');
INSERT INTO INT2_TBL(f1) VALUES ('-32767');
-- bad input values -- should give warnings
INSERT INTO INT2_TBL(f1) VALUES ('100000');
ERROR: pg_atoi: error reading "100000": Range Error
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
SELECT '' AS five, INT2_TBL.*;
five | f1
------+--------
| 0
| 1234
| -1234
| 32767
| -32767
(5 rows)
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0';
four | f1
------+--------
| 1234
| -1234
| 32767
| -32767
(4 rows)
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0';
four | f1
------+--------
| 1234
| -1234
| 32767
| -32767
(4 rows)
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0';
two | f1
-----+--------
| -1234
| -32767
(2 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0';
two | f1
-----+--------
| -1234
| -32767
(2 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0';
three | f1
-------+--------
| 0
| -1234
| -32767
(3 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0';
three | f1
-------+--------
| 0
| -1234
| -32767
(3 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0';
two | f1
-----+-------
| 1234
| 32767
(2 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0';
two | f1
-----+-------
| 1234
| 32767
(2 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0';
three | f1
-------+-------
| 0
| 1234
| 32767
(3 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0';
three | f1
-------+-------
| 0
| 1234
| 32767
(3 rows)
-- positive odds
SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
one | f1
-----+-------
| 32767
(1 row)
-- any evens
SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
three | f1
-------+-------
| 0
| 1234
| -1234
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+-------
| 0 | 0
| 1234 | 2468
| -1234 | -2468
| 32767 | -2
| -32767 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 2468
| -1234 | -2468
| 32767 | 65534
| -32767 | -65534
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 2
| 1234 | 1236
| -1234 | -1232
| 32767 | -32767
| -32767 | -32765
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 2
| 1234 | 1236
| -1234 | -1232
| 32767 | 32769
| -32767 | -32765
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+-------
| 0 | -2
| 1234 | 1232
| -1234 | -1236
| 32767 | 32765
| -32767 | 32767
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | -2
| 1234 | 1232
| -1234 | -1236
| 32767 | 32765
| -32767 | -32769
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 617
| -1234 | -617
| 32767 | 16383
| -32767 | -16383
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 617
| -1234 | -617
| 32767 | 16383
| -32767 | -16383
(5 rows)
--
-- INT4
-- WARNING: int4 operators never check for over/underflow!
-- Some of these answers are consequently numerically incorrect.
--
CREATE TABLE INT4_TBL(f1 int4);
INSERT INTO INT4_TBL(f1) VALUES ('0');
INSERT INTO INT4_TBL(f1) VALUES ('123456');
INSERT INTO INT4_TBL(f1) VALUES ('-123456');
INSERT INTO INT4_TBL(f1) VALUES ('34.5');
ERROR: pg_atoi: error in "34.5": can't parse ".5"
-- largest and smallest values
INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
-- bad input values -- should give warnings
INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
ERROR: pg_atoi: error reading "1000000000000": Range Error
INSERT INTO INT4_TBL(f1) VALUES ('asdf');
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
SELECT '' AS five, INT4_TBL.*;
five | f1
------+-------------
| 0
| 123456
| -123456
| 2147483647
| -2147483647
(5 rows)
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0';
four | f1
------+-------------
| 123456
| -123456
| 2147483647
| -2147483647
(4 rows)
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0';
four | f1
------+-------------
| 123456
| -123456
| 2147483647
| -2147483647
(4 rows)
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0';
two | f1
-----+-------------
| -123456
| -2147483647
(2 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0';
two | f1
-----+-------------
| -123456
| -2147483647
(2 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0';
three | f1
-------+-------------
| 0
| -123456
| -2147483647
(3 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0';
three | f1
-------+-------------
| 0
| -123456
| -2147483647
(3 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0';
two | f1
-----+------------
| 123456
| 2147483647
(2 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0';
two | f1
-----+------------
| 123456
| 2147483647
(2 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0';
three | f1
-------+------------
| 0
| 123456
| 2147483647
(3 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0';
three | f1
-------+------------
| 0
| 123456
| 2147483647
(3 rows)
-- positive odds
SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
one | f1
-----+------------
| 2147483647
(1 row)
-- any evens
SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
three | f1
-------+---------
| 0
| 123456
| -123456
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+---------
| 0 | 0
| 123456 | 246912
| -123456 | -246912
| 2147483647 | -2
| -2147483647 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+---------
| 0 | 0
| 123456 | 246912
| -123456 | -246912
| 2147483647 | -2
| -2147483647 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
| 2147483647 | -2147483647
| -2147483647 | -2147483645
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
| 2147483647 | -2147483647
| -2147483647 | -2147483645
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+------------
| 0 | -2
| 123456 | 123454
| -123456 | -123458
| 2147483647 | 2147483645
| -2147483647 | 2147483647
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+------------
| 0 | -2
| 123456 | 123454
| -123456 | -123458
| 2147483647 | 2147483645
| -2147483647 | 2147483647
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 0
| 123456 | 61728
| -123456 | -61728
| 2147483647 | 1073741823
| -2147483647 | -1073741823
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 0
| 123456 | 61728
| -123456 | -61728
| 2147483647 | 1073741823
| -2147483647 | -1073741823
(5 rows)
--
-- more complex expressions
--
-- variations on unary minus parsing
SELECT -2+3 AS one;
one
-----
1
(1 row)
SELECT 4-2 AS two;
two
-----
2
(1 row)
SELECT 2- -1 AS three;
three
-------
3
(1 row)
SELECT 2 - -2 AS four;
four
------
4
(1 row)
SELECT int2 '2' * int2 '2' = int2 '16' / int2 '4' AS true;
true
------
t
(1 row)
SELECT int4 '2' * int2 '2' = int2 '16' / int4 '4' AS true;
true
------
t
(1 row)
SELECT int2 '2' * int4 '2' = int4 '16' / int2 '4' AS true;
true
------
t
(1 row)
SELECT int4 '1000' < int4 '999' AS false;
false
-------
f
(1 row)
SELECT 4! AS twenty_four;
twenty_four
-------------
24
(1 row)
SELECT !!3 AS six;
six
-----
6
(1 row)
SELECT 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS ten;
ten
-----
10
(1 row)
SELECT 2 + 2 / 2 AS three;
three
-------
3
(1 row)
SELECT (2 + 2) / 2 AS two;
two
-----
2
(1 row)
This diff is collapsed.
#!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.53 2000/09/29 17:17:37 petere Exp $
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.54 2000/10/07 14:39:20 momjian Exp $
#
if [ $# -eq 0 ]; then
echo "Syntax: $0 <hostname> [extra-tests]"
......@@ -11,7 +11,7 @@ shift
extratests="$*"
case $hostname in
i*86-pc-cygwin* | i386-*-qnx*)
i*86-pc-cygwin* | i386-*-qnx* | beos)
HOSTLOC="-h localhost"
;;
*)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment