Commit a1675649 authored by Bruce Momjian's avatar Bruce Momjian

Remove QNX port.

parent 349f40b2
...@@ -1511,7 +1511,6 @@ case $host_os in ...@@ -1511,7 +1511,6 @@ case $host_os in
nextstep*) template=nextstep ;; nextstep*) template=nextstep ;;
openbsd*) template=openbsd ;; openbsd*) template=openbsd ;;
osf*) template=osf ;; osf*) template=osf ;;
qnx*) template=qnx4 ;;
sco*) template=sco ;; sco*) template=sco ;;
solaris*) template=solaris ;; solaris*) template=solaris ;;
sunos*) template=sunos4 ;; sunos*) template=sunos4 ;;
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.439 2005/12/17 00:35:50 momjian Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.440 2006/01/05 01:56:28 momjian Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -64,7 +64,6 @@ case $host_os in ...@@ -64,7 +64,6 @@ case $host_os in
nextstep*) template=nextstep ;; nextstep*) template=nextstep ;;
openbsd*) template=openbsd ;; openbsd*) template=openbsd ;;
osf*) template=osf ;; osf*) template=osf ;;
qnx*) template=qnx4 ;;
sco*) template=sco ;; sco*) template=sco ;;
solaris*) template=solaris ;; solaris*) template=solaris ;;
sunos*) template=sunos4 ;; sunos*) template=sunos4 ;;
......
PostgreSQL on QNX 4
--------------------
last updated: $Date: 2004/03/23 01:23:47 $
current maintainer: Bernd Tegge (tegge@repas-aeg.de)
original author: Andreas Kardos (kardos@repas-aeg.de)
This port is an important step because PostgreSQL is still the only free
relational database with full SQL and ODBC support available for QNX 4.
The only commercial databases available are Empress RDBMS and Velocis
Database Server (not supported for Digital Unix).
The most effort required the emulation of System V semaphore sets,
shared memory and IPC and of some IEEE floating-point functionality.
It is recommended to use the GNU C compiler instead of the Watcom compiler
because the Watcom compiler doesn't support a int8 datatype (long or
long long int) and it does not have a C++ frontend. The only advantage
using Watcom C would be support of Tk and pgaccess.
QNX 4 does not offer native support of shared libraries. Therefore the related
functionality cannot be used. Shared library support could probably be
implemented in future.
QNX 4 does not support UNIX domain sockets. Clients must use TCP/IP
sockets. Therefore, do not set "listen_addresses" to empty in your
postgresql.conf file. In fact, it's advisable to explicitly set
"listen_addresses" in an environment using native QNX networking.
Otherwise the postmaster might not use the IP-Address you think it does :-)
Prerequisites:
--------------
The following prerequisites have been used:
QNX standard:
QNX 4.25, Watcom C 10.6, GNU make
Available from http://www.teaser.fr/~jcmichot/
flex-2.5.4a.tar.gz (flex)
egcs-112-qnx4-r20.tar[.gz] (GNU C)
Available from ftp://ftp.visi.com/users/hawkeyd/qnx/
bison-1.2.5.tar.gz
Available from http://quics.qnx.com/cgi-bin/dir_find.cgi?/usr/free/
perl 5.004_04
from ftp://ftp.freesoftware.com/pub/infozip/zlib/
zlib 1.1.3
tcl8.0.3.tar.Z (Tcl)
In order to achieve meaningful results for the regression tests, you need
a different shell. The standard QNX shell is quite broken with regard to
scripting (even QSSL suggested to use pdksh or bash). Both are available
in source and binaries at
http://quics.qnx.com/cgi-bin/dir_find.cgi?/usr/free/
flex can be built without any problems using the Watcom or GNU C compilers.
The current version of bison (1.2.8 at the time of this writing) does not
build cleanly on QNX4 with gcc installed, but you can download src and
binary of a previous version from the above mentioned ftp site.
download source
GNU C can be installed by
/etc/install -u egcs112-qnx4-r20.tar[.gz]
Although Tcl can be built after some slight code changes using the Watcom
compiler, the GNU C compiler should be used instead. Otherwise it would be
impossible to link postgres built with GNU C together with libtcl8.0.a built
with the Watcom compiler. However, if you are going to build a Watcom version
you must build the tcl and tk libraries with Watcom too.
To make unix/tclUnixTest.c compilable uncomment
#include <sys/resource.h>
in it or
touch /usr/include/sys/resource.h
In unix/Makefile.in replace
( echo cd $(TOP_DIR)/tests\; source all ) | ./tcltest
by
( echo cd ../tests\; source all ) | ./tcltest
After that Tcl can be built and tested as stated in README.
Tk cannot be built with GNU C due to the lack of a stack version of the
X11 library. With the Watcom compiler Tk could be built but this is not useful
because of the link problems mentioned above.
Therefore the Tk interface and the pgaccess tool cannot be supported for a GNU C
version of PostgreSQL on QNX 4.
PostgreSQL:
-----------
On QNX 4 some headers are not in the directories expected. To avoid
modifications of the code the following links should be made:
ln -s /usr/local/bin/perl /usr/local/bin/perl5
ln -s /usr/include/errno.h /usr/include/sys/errno.h
ln -s /usr/include/ioctl.h /usr/include/sys/ioctl.h
ln -s /usr/src/pgsql/src/backend/port/qnx4/ipc.h /usr/include/sys/ipc.h
ln -s /usr/src/pgsql/src/backend/port/qnx4/sem.h /usr/include/sys/sem.h
ln -s /usr/src/pgsql/src/backend/port/qnx4/shm.h /usr/include/sys/shm.h
For ecgs-2.91.60 the file
/usr/local/lib/gcc-lib/i386-pc-qnx4/egcs-2.91.66/include/g++/stl_alloc.h
had to be patched (extern "C++" { ... } // extern "C++").
See attached patch.
If all prerequisites are available postgres can be built and installed by
cd pgsql/src
./configure --with-tcl --without-tk --with-perl
gmake > make.log 2>&1
gmake install > make.install.log 2>&1
su
cd interfaces/perl5
gmake install
exit
All other steps can be carried out as stated in the INSTALL file.
Make problems:
--------------
Sometimes the Watcom library manager wlib crashes with SIGSEGV on some
object files. This is a general problem and not PostgreSQL related.
Currently bootstrap.o causes such a crash. The workaround is not to include
the object file into the SUBSYS.o but link it directly. For further information
see backend/Makefile and backend/bootstrap/Makefile.
libpgsql.a currently cannot be generated because of the same problem. But this
doesn't matter since shared libraries are not supported.
(The Makefiles are already changed to ignore this, you don't have to
do anything)
Regression tests:
-----------------
please don't use the QNX shell for the parallel regression tests. Download
bash from quics.qnx.com and run 'make SHELL=/usr/local/bin/bash check'
instead.
The majority of regression tests succeeded. The following tests failed:
geometry:
Some slight deviation in the last digit and "0" instead of "-0".
Can be ignored.
timestamp, tinterval, abstime, horology:
Differences for years before the UNIX epoch. The QNX library probably treats
time_t as unsigned -> dates before 1970 get moved into the far future.
Can be ignored.
create_function_1, create_function_2, create_type, create_operator,
create_view, select_views, triggers, misc, plpgsql:
Error messages due to the lack of shared library support.
rules, select_views:
looks like it fails because it depends on tables created by previously
failing tests.
alter_table:
An expected failure message contains one blank more than expected.
Possibly a faulty output file.
int8, subselect, union
fails for Watcom version because of lacking int8 support.
The current state of this port should be sufficient for lot of applications.
Have fun!
Andreas Kardos
2000-04-04
Bernd Tegge
tegge@repas-aeg.de
2001-12-10
---------------------------------------------------------------------------
*** ./stl_alloc.h.orig Sat Feb 28 05:17:28 1998
--- ./stl_alloc.h Tue Nov 23 04:14:09 1999
***************
*** 120,125 ****
--- 120,126 ----
#pragma set woff 1174
#endif
+ extern "C++" {
// Malloc-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
***************
*** 682,687 ****
--- 683,689 ----
# endif
#endif /* ! __USE_MALLOC */
+ } // extern "C++"
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
Patch required to build with gcc:
*** /usr/src/postgresql-7.2b3/src/backend/port/qnx4/sem.h Thu Nov 8 21:37:52 2001
--- src/backend/port/qnx4/sem.h Mon Dec 10 13:22:18 2001
***************
*** 55,60 ****
--- 55,71 ----
ushort_t sem_num; /* semaphore # */
short sem_op; /* semaphore operation */
short sem_flg; /* operation flags */
+ };
+
+ /*
+ * command union for semctl.
+ */
+
+ union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
+ unsigned short int *array; /* array for GETALL, SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
};
extern int semctl(int semid, int semnum, int cmd, /* ... */ union semun arg);
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.250 2005/12/04 03:52:29 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.251 2006/01/05 01:56:28 momjian Exp $ -->
<chapter id="installation"> <chapter id="installation">
<title><![%standalone-include[<productname>PostgreSQL</>]]> <title><![%standalone-include[<productname>PostgreSQL</>]]>
...@@ -2037,22 +2037,6 @@ kill `cat /usr/local/pgsql/data/postmaster.pid` ...@@ -2037,22 +2037,6 @@ kill `cat /usr/local/pgsql/data/postmaster.pid`
<entry>Tom I. Helbekkmo (<email>tih@kpnQwest.no</email>), 2001-03-30</entry> <entry>Tom I. Helbekkmo (<email>tih@kpnQwest.no</email>), 2001-03-30</entry>
<entry>1.5</entry> <entry>1.5</entry>
</row> </row>
<row>
<entry><systemitem class="osname">QNX 4 RTOS</></entry>
<entry><systemitem>x86</></entry>
<entry>7.2</entry>
<entry>Bernd Tegge (<email>tegge@repas-aeg.de</email>), 2001-12-10
</entry>
<entry>needs updates to semaphore code;
see also <filename>doc/FAQ_QNX4</filename></entry>
</row>
<row>
<entry><systemitem class="osname">QNX RTOS v6</></entry>
<entry><systemitem>x86</></entry>
<entry>7.2</entry>
<entry>Igor Kovalenko (<email>Igor.Kovalenko@motorola.com</email>), 2001-11-20</entry>
<entry>patches available in archives, but too late for 7.2</entry>
</row>
<row> <row>
<entry><systemitem class="osname">SCO OpenServer</></entry> <entry><systemitem class="osname">SCO OpenServer</></entry>
<entry><systemitem>x86</></entry> <entry><systemitem>x86</></entry>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.359 2005/12/23 23:28:35 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.360 2006/01/05 01:56:28 momjian Exp $
--> -->
<chapter Id="runtime"> <chapter Id="runtime">
...@@ -480,10 +480,9 @@ psql: could not connect to server: No such file or directory ...@@ -480,10 +480,9 @@ psql: could not connect to server: No such file or directory
relevant for <productname>PostgreSQL</>). Almost all modern relevant for <productname>PostgreSQL</>). Almost all modern
operating systems provide these features, but not all of them have operating systems provide these features, but not all of them have
them turned on or sufficiently sized by default, especially systems them turned on or sufficiently sized by default, especially systems
with BSD heritage. (For the <systemitem class="osname">Windows</>, with BSD heritage. (For the <systemitem class="osname">Windows</> and
<systemitem class="osname">QNX</> and <systemitem class="osname">BeOS</> <systemitem class="osname">BeOS</> ports, <productname>PostgreSQL</>
ports, <productname>PostgreSQL</> provides its own replacement provides its own replacement implementation of these facilities.)
implementation of these facilities.)
</para> </para>
<para> <para>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/backend/Makefile,v 1.113 2005/12/09 21:19:34 petere Exp $ # $PostgreSQL: pgsql/src/backend/Makefile,v 1.114 2006/01/05 01:56:29 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -27,14 +27,6 @@ LIBS := $(filter-out -lpgport, $(LIBS)) ...@@ -27,14 +27,6 @@ LIBS := $(filter-out -lpgport, $(LIBS))
# The backend doesn't need everything that's in LIBS, however # The backend doesn't need everything that's in LIBS, however
LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS)) LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
ifeq ($(PORTNAME), qnx4)
# This file crashes qnx4's wlink and is therefore not in
# bootstrap/SUBSYS.o on that platform. (Wotta hack ... is it still
# necessary?) [ Yes, until the Watcom compiler goes open source it's
# effectively unsupported ]
OBJS += bootstrap/bootstrap.o
endif
########################################################################## ##########################################################################
all: submake-libpgport postgres $(POSTGRES_IMP) all: submake-libpgport postgres $(POSTGRES_IMP)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for the bootstrap module # Makefile for the bootstrap module
# #
# $PostgreSQL: pgsql/src/backend/bootstrap/Makefile,v 1.32 2003/11/29 19:51:40 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/bootstrap/Makefile,v 1.33 2006/01/05 01:56:29 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -12,16 +12,9 @@ include $(top_builddir)/src/Makefile.global ...@@ -12,16 +12,9 @@ include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
# qnx4's wlink currently crashes with bootstrap.o
ifneq ($(PORTNAME), qnx4)
OBJS= bootparse.o bootstrap.o OBJS= bootparse.o bootstrap.o
else
OBJS= bootparse.o
endif
# make sure bootstrap.o is built even on qnx4 all: SUBSYS.o
all: SUBSYS.o bootstrap.o
SUBSYS.o: $(OBJS) SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^ $(LD) $(LDREL) $(LDOUT) $@ $^
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# be converted to Method 2. # be converted to Method 2.
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.20 2003/11/29 19:51:54 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.21 2006/01/05 01:56:29 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -25,9 +25,6 @@ OBJS+=dynloader.o pg_sema.o pg_shmem.o ...@@ -25,9 +25,6 @@ OBJS+=dynloader.o pg_sema.o pg_shmem.o
OBJS+=$(TAS) OBJS+=$(TAS)
ifeq ($(PORTNAME), qnx4)
OBJS+=qnx4/SUBSYS.o
endif
ifeq ($(PORTNAME), beos) ifeq ($(PORTNAME), beos)
OBJS+=beos/SUBSYS.o OBJS+=beos/SUBSYS.o
endif endif
...@@ -43,11 +40,6 @@ all: SUBSYS.o ...@@ -43,11 +40,6 @@ all: SUBSYS.o
SUBSYS.o: $(OBJS) SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^ $(LD) $(LDREL) $(LDOUT) $@ $^
qnx4/SUBSYS.o: qnx4.dir
qnx4.dir:
$(MAKE) -C qnx4 all
beos/SUBSYS.o: beos.dir beos/SUBSYS.o: beos.dir
beos.dir: beos.dir:
...@@ -74,6 +66,5 @@ distclean clean: ...@@ -74,6 +66,5 @@ distclean clean:
rm -f SUBSYS.o $(OBJS) ipc_test ipc_test.o rm -f SUBSYS.o $(OBJS) ipc_test ipc_test.o
$(MAKE) -C beos clean $(MAKE) -C beos clean
$(MAKE) -C darwin clean $(MAKE) -C darwin clean
$(MAKE) -C qnx4 clean
$(MAKE) -C win32 clean $(MAKE) -C win32 clean
/*-------------------------------------------------------------------------
*
* dynloader.c
* dynamic loader for QNX4 using the shared library mechanism
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/dynloader/qnx4.c,v 1.6 2004/01/07 18:56:27 neilc Exp $
*
* NOTES
*
*-------------------------------------------------------------------------
*/
/* System includes */
#include "postgres.h"
/*
#include <a.out.h>
#include <dl.h>
*/
#include "utils/dynamic_loader.h"
#include "dynloader.h"
void *
pg_dlopen(char *filename)
{
return NULL;
}
PGFunction
pg_dlsym(void *handle, char *funcname)
{
return NULL;
}
void
pg_dlclose(void *handle)
{
}
char *
pg_dlerror()
{
static char errmsg[] = "Failed to load shared library due to lack of shared library support.";
return errmsg;
}
/*-------------------------------------------------------------------------
*
* dynloader.h
* dynamic loader for QNX4 using the shared library mechanism
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/dynloader/qnx4.h,v 1.4 2003/11/29 19:51:54 pgsql Exp $
*
* NOTES
*
*-------------------------------------------------------------------------
*/
#include "fmgr.h"
void *pg_dlopen(char *filename);
PGFunction pg_dlsym(void *handle, char *funcname);
void pg_dlclose(void *handle);
char *pg_dlerror();
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for port/qnx4
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/port/qnx4/Makefile,v 1.6 2003/11/29 19:51:54 pgsql Exp $
#
#-------------------------------------------------------------------------
subdir = src/backend/port/qnx4
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
OBJS = isnan.o sem.o shm.o
all: SUBSYS.o tstsem tstshm
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
tstsem: tstsem.o sem.o
$(CC) -o tstsem sem.o tstsem.o
tstshm: tstshm.o shm.o
$(CC) -o tstshm shm.o tstshm.o
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
rm -f SUBSYS.o $(OBJS) tstsem tstsem.o tstshm tstshm.o
ifeq (depend,$(wildcard depend))
include depend
endif
/*-------------------------------------------------------------------------
*
* ipc.h
* System V IPC Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/ipc.h,v 1.7 2003/11/29 19:51:54 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _SYS_IPC_H
#define _SYS_IPC_H
/* Common IPC definitions. */
/* Mode bits. */
#define IPC_CREAT 0001000 /* create entry if key doesn't exist */
#define IPC_EXCL 0002000 /* fail if key exists */
#define IPC_NOWAIT 0004000 /* error if request must wait */
/* Keys. */
#define IPC_PRIVATE (key_t)0 /* private key */
/* Control Commands. */
#define IPC_RMID 0 /* remove identifier */
#define IPC_STAT 1 /* get shm status */
#endif /* _SYS_IPC_H */
/*-------------------------------------------------------------------------
*
* isnan.c
* isnan() implementation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/isnan.c,v 1.5 2004/03/15 03:29:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "c.h"
#include <math.h>
#ifndef __nan_bytes
#define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif /* __nan_bytes */
static unsigned char __nan[8] = __nan_bytes;
int
isnan(double dsrc)
{
return memcmp(&dsrc, __nan, sizeof(double)) == 0;
}
/*-------------------------------------------------------------------------
*
* sem.c
* System V Semaphore Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/sem.c,v 1.13 2005/10/15 02:49:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <errno.h>
#include <semaphore.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/sem.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "miscadmin.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#define SEMMAX (PROC_NSEMS_PER_SET+1)
#define OPMAX 8
#define MODE 0700
#define SHM_INFO_NAME "PgSysV_Sem_Info"
struct pending_ops
{
int op[OPMAX]; /* array of pending operations */
int idx; /* index of first free array member */
};
struct sem_set_info
{
key_t key;
int nsems;
sem_t sem[SEMMAX]; /* array of POSIX semaphores */
struct sem semV[SEMMAX]; /* array of System V semaphore structures */
struct pending_ops pendingOps[SEMMAX]; /* array of pending operations */
};
struct sem_info
{
sem_t sem;
int nsets;
/* there are actually nsets of these: */
struct sem_set_info set[1]; /* VARIABLE LENGTH ARRAY */
};
static struct sem_info *SemInfo = (struct sem_info *) - 1;
/* ----------------------------------------------------------------
* semclean - remove the shared memory file on exit
* only called by the process which created the shm file
* ----------------------------------------------------------------
*/
static void
semclean(void)
{
remove("/dev/shmem/" SHM_INFO_NAME);
}
int
semctl(int semid, int semnum, int cmd, /* ... */ union semun arg)
{
int r = 0;
sem_wait(&SemInfo->sem);
if (semid < 0 || semid >= SemInfo->nsets ||
semnum < 0 || semnum >= SemInfo->set[semid].nsems)
{
sem_post(&SemInfo->sem);
errno = EINVAL;
return -1;
}
switch (cmd)
{
case GETNCNT:
r = SemInfo->set[semid].semV[semnum].semncnt;
break;
case GETPID:
r = SemInfo->set[semid].semV[semnum].sempid;
break;
case GETVAL:
r = SemInfo->set[semid].semV[semnum].semval;
break;
case GETALL:
for (semnum = 0; semnum < SemInfo->set[semid].nsems; semnum++)
arg.array[semnum] = SemInfo->set[semid].semV[semnum].semval;
break;
case SETVAL:
SemInfo->set[semid].semV[semnum].semval = arg.val;
break;
case SETALL:
for (semnum = 0; semnum < SemInfo->set[semid].nsems; semnum++)
SemInfo->set[semid].semV[semnum].semval = arg.array[semnum];
break;
case GETZCNT:
r = SemInfo->set[semid].semV[semnum].semzcnt;
break;
case IPC_RMID:
for (semnum = 0; semnum < SemInfo->set[semid].nsems; semnum++)
{
if (sem_destroy(&SemInfo->set[semid].sem[semnum]) == -1)
r = -1;
}
SemInfo->set[semid].key = -1;
SemInfo->set[semid].nsems = 0;
break;
default:
sem_post(&SemInfo->sem);
errno = EINVAL;
return -1;
}
sem_post(&SemInfo->sem);
return r;
}
int
semget(key_t key, int nsems, int semflg)
{
int fd,
semid,
semnum,
nsets;
int exist = 0;
Size sem_info_size;
struct stat statbuf;
if (nsems < 0 || nsems > SEMMAX)
{
errno = EINVAL;
return -1;
}
/* open and map shared memory */
if (SemInfo == (struct sem_info *) - 1)
{
/* test if the shared memory already exists */
fd = shm_open(SHM_INFO_NAME, O_RDWR | O_CREAT | O_EXCL, MODE);
if (fd == -1 && errno == EEXIST)
{
exist = 1;
fd = shm_open(SHM_INFO_NAME, O_RDWR | O_CREAT, MODE);
}
if (fd == -1)
return fd;
/* The size may only be set once. Ignore errors. */
nsets = PROC_SEM_MAP_ENTRIES(MaxBackends);
sem_info_size = sizeof(struct sem_info) + (nsets - 1) * sizeof(struct sem_set_info);
ltrunc(fd, sem_info_size, SEEK_SET);
if (fstat(fd, &statbuf)) /* would be strange : the only doc'ed */
{ /* error is EBADF */
close(fd);
return -1;
}
/*
* size is rounded by proc to the next __PAGESIZE
*/
if (statbuf.st_size !=
(((sem_info_size / __PAGESIZE) + 1) * __PAGESIZE))
{
fprintf(stderr,
"Found a pre-existing shared memory block for the semaphore memory\n"
"of a different size (%ld instead %ld). Make sure that all executables\n"
"are from the same release or remove the file \"/dev/shmem/%s\"\n"
"left by a previous version.\n",
(long) statbuf.st_size,
(long) sem_info_size,
SHM_INFO_NAME);
errno = EACCES;
return -1;
}
SemInfo = mmap(NULL, sem_info_size,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (SemInfo == MAP_FAILED)
return -1;
if (!exist)
{
/* initialize shared memory */
memset(SemInfo, 0, sem_info_size);
SemInfo->nsets = nsets;
for (semid = 0; semid < nsets; semid++)
SemInfo->set[semid].key = -1;
/* create semaphore for locking */
sem_init(&SemInfo->sem, 1, 1);
on_proc_exit(semclean, 0);
}
}
sem_wait(&SemInfo->sem);
nsets = SemInfo->nsets;
if (key != IPC_PRIVATE)
{
/* search existing element */
semid = 0;
while (semid < nsets && SemInfo->set[semid].key != key)
semid++;
if (!(semflg & IPC_CREAT) && semid >= nsets)
{
sem_post(&SemInfo->sem);
errno = ENOENT;
return -1;
}
else if (semid < nsets)
{
if (semflg & IPC_CREAT && semflg & IPC_EXCL)
{
sem_post(&SemInfo->sem);
errno = EEXIST;
return -1;
}
else
{
if (nsems != 0 && SemInfo->set[semid].nsems < nsems)
{
sem_post(&SemInfo->sem);
errno = EINVAL;
return -1;
}
sem_post(&SemInfo->sem);
return semid;
}
}
}
/* search first free element */
semid = 0;
while (semid < nsets && SemInfo->set[semid].key != -1)
semid++;
if (semid >= nsets)
{
sem_post(&SemInfo->sem);
errno = ENOSPC;
return -1;
}
for (semnum = 0; semnum < nsems; semnum++)
{
sem_init(&SemInfo->set[semid].sem[semnum], 1, 0);
/* Currently sem_init always returns -1. */
#ifdef NOT_USED
if (sem_init(&SemInfo->set[semid].sem[semnum], 1, 0) == -1)
{
int semnum1;
for (semnum1 = 0; semnum1 < semnum; semnum1++)
sem_destroy(&SemInfo->set[semid].sem[semnum1]);
sem_post(&SemInfo->sem);
return -1;
}
#endif
}
SemInfo->set[semid].key = key;
SemInfo->set[semid].nsems = nsems;
sem_post(&SemInfo->sem);
return semid;
}
int
semop(int semid, struct sembuf * sops, size_t nsops)
{
int i,
r = 0,
r1,
errno1 = 0,
op;
sem_wait(&SemInfo->sem);
if (semid < 0 || semid >= SemInfo->nsets)
{
sem_post(&SemInfo->sem);
errno = EINVAL;
return -1;
}
for (i = 0; i < nsops; i++)
{
if ( /* sops[i].sem_num < 0 || */ sops[i].sem_num >= SemInfo->set[semid].nsems)
{
sem_post(&SemInfo->sem);
errno = EFBIG;
return -1;
}
}
for (i = 0; i < nsops; i++)
{
if (sops[i].sem_op < 0)
{
if (SemInfo->set[semid].semV[sops[i].sem_num].semval < -sops[i].sem_op)
{
if (sops[i].sem_flg & IPC_NOWAIT)
{
sem_post(&SemInfo->sem);
errno = EAGAIN;
return -1;
}
SemInfo->set[semid].semV[sops[i].sem_num].semncnt++;
if (SemInfo->set[semid].pendingOps[sops[i].sem_num].idx >= OPMAX)
{
/* pending operations array overflow */
sem_post(&SemInfo->sem);
errno = ERANGE;
return -1;
}
SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx++] = sops[i].sem_op;
/* suspend */
sem_post(&SemInfo->sem); /* avoid deadlock */
r1 = sem_wait(&SemInfo->set[semid].sem[sops[i].sem_num]);
sem_wait(&SemInfo->sem);
if (r1)
{
errno1 = errno;
r = r1;
/* remove pending operation */
SemInfo->set[semid].pendingOps[sops[i].sem_num].op[--SemInfo->set[semid].pendingOps[sops[i].sem_num].idx] = 0;
}
else
SemInfo->set[semid].semV[sops[i].sem_num].semval -= -sops[i].sem_op;
SemInfo->set[semid].semV[sops[i].sem_num].semncnt--;
}
else
SemInfo->set[semid].semV[sops[i].sem_num].semval -= -sops[i].sem_op;
}
else if (sops[i].sem_op > 0)
{
SemInfo->set[semid].semV[sops[i].sem_num].semval += sops[i].sem_op;
op = sops[i].sem_op;
while (op > 0 && SemInfo->set[semid].pendingOps[sops[i].sem_num].idx > 0)
{ /* operations pending */
if (SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx - 1] + op >= 0)
{
/* unsuspend processes */
if (sem_post(&SemInfo->set[semid].sem[sops[i].sem_num]))
{
errno1 = errno;
r = -1;
}
/* adjust pending operations */
op += SemInfo->set[semid].pendingOps[sops[i].sem_num].op[--SemInfo->set[semid].pendingOps[sops[i].sem_num].idx];
SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx] = 0;
}
else
{
/* adjust pending operations */
SemInfo->set[semid].pendingOps[sops[i].sem_num].op[SemInfo->set[semid].pendingOps[sops[i].sem_num].idx - 1] += op;
op = 0;
}
}
}
else
/* sops[i].sem_op == 0 */
{
/* not supported */
sem_post(&SemInfo->sem);
errno = ENOSYS;
return -1;
}
SemInfo->set[semid].semV[sops[i].sem_num].sempid = getpid();
}
sem_post(&SemInfo->sem);
errno = errno1;
return r;
}
/*-------------------------------------------------------------------------
*
* sem.h
* System V Semaphore Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/sem.h,v 1.8 2003/11/29 19:51:54 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _SYS_SEM_H
#define _SYS_SEM_H
#include <sys/ipc.h>
#ifdef __cplusplus
extern "C"
{
#endif
/*
* Semctl Command Definitions.
*/
#define GETNCNT 3 /* get semncnt */
#define GETPID 4 /* get sempid */
#define GETVAL 5 /* get semval */
#define GETALL 6 /* get all semval's */
#define GETZCNT 7 /* get semzcnt */
#define SETVAL 8 /* set semval */
#define SETALL 9 /* set all semval's */
/*
* There is one semaphore structure for each semaphore in the system.
*/
struct sem
{
ushort_t semval; /* semaphore text map address */
pid_t sempid; /* pid of last operation */
ushort_t semncnt; /* # awaiting semval > cval */
ushort_t semzcnt; /* # awaiting semval = 0 */
};
/*
* User semaphore template for semop system calls.
*/
struct sembuf
{
ushort_t sem_num; /* semaphore # */
short sem_op; /* semaphore operation */
short sem_flg; /* operation flags */
};
extern int semctl(int semid, int semnum, int cmd, /* ... */ union semun arg);
extern int semget(key_t key, int nsems, int semflg);
extern int semop(int semid, struct sembuf * sops, size_t nsops);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SEM_H */
/*-------------------------------------------------------------------------
*
* shm.c
* System V Shared Memory Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/shm.c,v 1.10 2005/10/15 02:49:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/stat.h>
#define MODE 0777
#define SHMMAX 1024
struct shm_info
{
int shmid;
key_t key;
size_t size;
void *addr;
};
static struct shm_info *ShmInfo;
static int shm_putinfo(struct shm_info * info);
static int shm_updinfo(int i, struct shm_info * info);
static int shm_getinfo(int shmid, struct shm_info * info);
static int shm_getinfobyaddr(const void *addr, struct shm_info * info);
static char *
keytoname(key_t key, char *name)
{
sprintf(name, "PgShm%x", key);
return name;
}
static int
shm_putinfo(struct shm_info * info)
{
int i;
if (ShmInfo == NULL)
{
ShmInfo = calloc(SHMMAX, sizeof(struct shm_info));
if (ShmInfo == NULL)
return -1;
/* initialize ShmInfo */
for (i = 0; i < SHMMAX; i++)
ShmInfo[i].shmid = -1;
}
/* search first free element */
i = 0;
while (i < SHMMAX && ShmInfo[i].shmid != -1)
i++;
if (i >= SHMMAX)
{
errno = ENOSPC;
return -1;
}
memcpy(&ShmInfo[i], info, sizeof(struct shm_info));
return i;
}
static int
shm_updinfo(int i, struct shm_info * info)
{
if (i >= SHMMAX)
return -1;
if (ShmInfo == NULL)
return -1;
memcpy(&ShmInfo[i], info, sizeof(struct shm_info));
return i;
}
static int
shm_getinfo(int shmid, struct shm_info * info)
{
int i;
if (ShmInfo == NULL)
return -1;
/* search element */
i = 0;
while (i < SHMMAX && ShmInfo[i].shmid != shmid)
i++;
if (i >= SHMMAX)
return -1;
memcpy(info, &ShmInfo[i], sizeof(struct shm_info));
return i;
}
static int
shm_getinfobyaddr(const void *addr, struct shm_info * info)
{
int i;
if (ShmInfo == (struct shm_info *) - 1)
return -1;
/* search element */
i = 0;
while (i < SHMMAX && ShmInfo[i].addr != addr)
i++;
if (i >= SHMMAX)
return -1;
memcpy(info, &ShmInfo[i], sizeof(struct shm_info));
return i;
}
void *
shmat(int shmid, const void *shmaddr, int shmflg)
{
struct shm_info info;
int i;
i = shm_getinfo(shmid, &info);
if (i == -1)
{
errno = EACCES;
return (void *) -1;
}
info.addr = mmap((void *) shmaddr, info.size,
PROT_READ | PROT_WRITE, MAP_SHARED, shmid, 0);
if (info.addr == MAP_FAILED)
return info.addr;
if (shm_updinfo(i, &info) == -1)
{
errno = EACCES;
return (void *) -1;
}
return info.addr;
}
int
shmdt(const void *addr)
{
struct shm_info info;
if (shm_getinfobyaddr(addr, &info) == -1)
{
errno = EACCES;
return -1;
}
return munmap((void *) addr, info.size);
}
int
shmctl(int shmid, int cmd, struct shmid_ds * buf)
{
struct shm_info info;
char name[NAME_MAX + 1];
int result;
int fd;
struct stat statbuf;
switch (cmd)
{
case IPC_RMID:
if (shm_getinfo(shmid, &info) == -1)
{
errno = EACCES;
return -1;
}
close(info.shmid);
keytoname(info.key, name);
return shm_unlink(name);
case IPC_STAT:
/*
* we have to open it first. stat() does no prefix tracking -> the
* call would go to fsys instead of proc
*/
keytoname(shmid, name);
fd = shm_open(name, 0, MODE);
if (fd >= 0)
{
result = fstat(fd, &statbuf);
/*
* if the file exists, subtract 2 from linkcount : one for our
* own open and one for the dir entry
*/
if (!result)
buf->shm_nattch = statbuf.st_nlink - 2;
close(fd);
return result;
}
else
{
/*
* if there's no entry for this key it doesn't matter the next
* shmget() would get a different shm anyway
*/
buf->shm_nattch = 0;
return 0;
}
}
errno = EINVAL;
return -1;
}
int
shmget(key_t key, size_t size, int flags)
{
char name[NAME_MAX + 1];
int oflag = 0;
struct shm_info info;
if (flags & IPC_CREAT)
oflag |= O_CREAT;
if (flags & IPC_EXCL)
oflag |= O_EXCL;
if (flags & SHM_R)
{
if (flags & SHM_W)
oflag |= O_RDWR;
else
oflag |= O_RDONLY;
}
info.shmid = shm_open(keytoname(key, name), oflag, MODE);
/* store shared memory information */
if (info.shmid != -1)
{
info.key = key;
info.size = size;
info.addr = NULL;
if (shm_putinfo(&info) == -1)
{
close(info.shmid);
if ((oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
shm_unlink(name);
return -1;
}
}
/* The size may only be set once. Ignore errors. */
ltrunc(info.shmid, size, SEEK_SET);
return info.shmid;
}
/*-------------------------------------------------------------------------
*
* shm.h
* System V Shared Memory Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/shm.h,v 1.8 2003/11/29 19:51:54 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _SYS_SHM_H
#define _SYS_SHM_H
#include <sys/ipc.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define SHM_R 0400 /* read permission */
#define SHM_W 0200 /* write permission */
struct shmid_ds
{
int dummy;
int shm_nattch;
};
extern void *shmat(int shmid, const void *shmaddr, int shmflg);
extern int shmdt(const void *addr);
extern int shmctl(int shmid, int cmd, struct shmid_ds * buf);
extern int shmget(key_t key, size_t size, int flags);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SHM_H */
/*-------------------------------------------------------------------------
*
* tstsem.c
* Test of System V Semaphore Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/tstsem.c,v 1.10 2003/11/29 19:51:54 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <signal.h>
#include <unistd.h>
#include "storage/ipc.h"
#include <sys/mman.h>
#include <sys/sem.h>
#define SEMMAX 16
#define OPSMAX 1
int MaxBackends = SEMMAX;
static int semid;
static void
sig_handler(int sig_no)
{
union semun arg;
int i = semctl(semid, 0, GETNCNT, arg);
if (i == -1)
perror("semctl");
else
printf("semval = %d\n", i);
}
void on_proc_exit(void (*function) (), Datum arg)
{
atexit(function);
}
int
main(int argc, char **argv)
{
int c,
errflg = 0;
char s[80];
key_t key = IPC_PRIVATE;
int nsems = SEMMAX;
int semflg = 0;
int unlink = 0;
int i;
struct sembuf sops[OPSMAX];
u_short array[SEMMAX];
union semun arg;
optarg = NULL;
while (!errflg && (c = getopt(argc, argv, "k:n:cxu")) != -1)
{
switch (c)
{
case 'k':
key = atoi(optarg);
break;
case 'n':
nsems = atoi(optarg);
break;
case 'c':
semflg |= IPC_CREAT;
break;
case 'x':
semflg |= IPC_EXCL;
break;
case 'u':
unlink = 1;
break;
default:
errflg++;
}
}
if (errflg)
{
printf("usage: tstsem [-k key] [-n nsems] [-cxu]\n");
exit(1);
}
if (unlink)
{
i = shm_unlink("SysV_Sem_Info");
if (i == -1)
perror("shm_unlink");
exit(i);
}
semid = semget(key, nsems, semflg);
if (semid == -1)
{
perror("semget");
exit(semid);
}
/* test signal interrupts */
signal(SIGTERM, sig_handler);
do
{
printf("(-)sem_op, (+)sem_op, (G)ETVAL, (S)ETVAL, GET(P)ID, GET(A)LL, SETA(L)L, GET(N)CNT, GET(Z)CNT, e(x)it: ");
scanf("%s", s);
switch (s[0])
{
case '-':
case '+':
sops[0].sem_num = 0;
sops[0].sem_op = atoi(s);
if (sops[0].sem_op == 0)
sops[0].sem_op = s[0] == '+' ? +1 : -1;
sops[0].sem_flg = 0;
if (semop(semid, sops, 1) == -1)
perror("semop");
break;
case 'G':
case 'g':
i = semctl(semid, 0, GETVAL, arg);
if (i == -1)
perror("semctl");
else
printf("semval = %d\n", i);
break;
case 'S':
case 's':
printf("semval = ");
scanf("%d", &arg.val);
if (semctl(semid, 0, SETVAL, arg) == -1)
perror("semctl");
break;
case 'P':
case 'p':
i = semctl(semid, 0, GETPID, arg);
if (i == -1)
perror("semctl");
else
printf("PID = %d\n", i);
break;
case 'A':
case 'a':
arg.array = array;
i = semctl(semid, 0, GETALL, arg);
if (i == -1)
perror("semctl");
else
{
for (i = 0; i < nsems; i++)
printf("semval[%d] = %hu\n", i, arg.array[i]);
}
break;
case 'L':
case 'l':
arg.array = array;
for (i = 0; i < nsems; i++)
{
printf("semval[%d] = ", i);
scanf("%hu", &arg.array[i]);
}
if (semctl(semid, 0, SETALL, arg) == -1)
perror("semctl");
break;
case 'N':
case 'n':
i = semctl(semid, 0, GETNCNT, arg);
if (i == -1)
perror("semctl");
else
printf("semval = %d\n", i);
break;
case 'Z':
case 'z':
i = semctl(semid, 0, GETZCNT, arg);
if (i == -1)
perror("semctl");
else
printf("semval = %d\n", i);
break;
}
}
while (s[0] != 'x');
if (semctl(semid, 0, IPC_RMID, arg) == -1)
{
perror("semctl");
exit(-1);
}
exit(0);
}
/*-------------------------------------------------------------------------
*
* tstshm.c
* Test of System V Shared Memory Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/qnx4/tstshm.c,v 1.5 2003/11/29 19:51:54 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <unistd.h>
#include <sys/shm.h>
int
main(int argc, char **argv)
{
int c,
errflg = 0;
char s[80];
key_t key = 0x1000;
size_t size = 256;
int shmid = -1;
caddr_t addr = NULL;
optarg = NULL;
while (!errflg && (c = getopt(argc, argv, "k:s:")) != -1)
{
switch (c)
{
case 'k':
key = atoi(optarg);
break;
case 's':
size = atoi(optarg);
break;
default:
errflg++;
}
}
if (errflg)
{
printf("usage: tstshm [-k key] [-s size]\n");
exit(1);
}
do
{
printf("shm(g)et, shm(a)t, shm(d)t, shm(c)tl, (w)rite, (r)ead, e(x)it: ");
scanf("%s", s);
switch (s[0])
{
case 'g':
shmid = shmget(key, size, IPC_CREAT | SHM_R | SHM_W);
if (shmid == -1)
perror("shmget");
break;
case 'a':
addr = shmat(shmid, NULL, 0);
if (addr == (void *) -1)
perror("shmat");
break;
case 'd':
if (shmdt(addr) == -1)
perror("shmdt");
else
addr = NULL;
break;
case 'c':
if (shmctl(shmid, IPC_RMID, NULL) == -1)
perror("shmctl");
else
shmid = -1;
break;
case 'w':
printf("String to write: ");
scanf("%s", addr);
break;
case 'r':
puts(addr);
break;
}
}
while (s[0] != 'x');
return 0;
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* to contain some useful information. Mechanism differs wildly across * to contain some useful information. Mechanism differs wildly across
* platforms. * platforms.
* *
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.27 2005/11/22 18:17:26 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.28 2006/01/05 01:56:29 momjian Exp $
* *
* Copyright (c) 2000-2005, PostgreSQL Global Development Group * Copyright (c) 2000-2005, PostgreSQL Global Development Group
* various details abducted from various places * various details abducted from various places
...@@ -63,7 +63,7 @@ extern char **environ; ...@@ -63,7 +63,7 @@ extern char **environ;
#define PS_USE_PS_STRINGS #define PS_USE_PS_STRINGS
#elif (defined(BSD) || defined(__bsdi__) || defined(__hurd__)) && !defined(__darwin__) #elif (defined(BSD) || defined(__bsdi__) || defined(__hurd__)) && !defined(__darwin__)
#define PS_USE_CHANGE_ARGV #define PS_USE_CHANGE_ARGV
#elif defined(__linux__) || defined(_AIX) || defined(__sgi) || (defined(sun) && !defined(BSD)) || defined(ultrix) || defined(__ksr__) || defined(__osf__) || defined(__QNX__) || defined(__svr4__) || defined(__svr5__) || defined(__darwin__) #elif defined(__linux__) || defined(_AIX) || defined(__sgi) || (defined(sun) && !defined(BSD)) || defined(ultrix) || defined(__ksr__) || defined(__osf__) || defined(__svr4__) || defined(__svr5__) || defined(__darwin__)
#define PS_USE_CLOBBER_ARGV #define PS_USE_CLOBBER_ARGV
#elif defined (WIN32) #elif defined (WIN32)
#define PS_USE_WIN32 #define PS_USE_WIN32
...@@ -73,7 +73,7 @@ extern char **environ; ...@@ -73,7 +73,7 @@ extern char **environ;
/* Different systems want the buffer padded differently */ /* Different systems want the buffer padded differently */
#if defined(_AIX) || defined(__linux__) || defined(__QNX__) || defined(__svr4__) #if defined(_AIX) || defined(__linux__) || defined(__svr4__)
#define PS_PADDING '\0' #define PS_PADDING '\0'
#else #else
#define PS_PADDING ' ' #define PS_PADDING ' '
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.56 2005/11/22 18:17:27 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.57 2006/01/05 01:56:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2153,7 +2153,7 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b) ...@@ -2153,7 +2153,7 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
* Some rather brain-dead implementations of qsort will sometimes call the * Some rather brain-dead implementations of qsort will sometimes call the
* comparison routine to compare a value to itself. (At this writing only * comparison routine to compare a value to itself. (At this writing only
* QNX 4 is known to do such silly things.) Don't raise a bogus error in * QNX 4 is known to do such silly things.) Don't raise a bogus error in
* that case. * that case. Update: The QNX port is gone.
*/ */
if (state->enforceUnique && !equal_hasnull && tuple1 != tuple2) if (state->enforceUnique && !equal_hasnull && tuple1 != tuple2)
ereport(ERROR, ereport(ERROR,
......
#!/bin/sh #!/bin/sh
# #
# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.15 2003/11/29 19:52:04 pgsql Exp $ # $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.16 2006/01/05 01:56:29 momjian Exp $
# #
CMDNAME=`basename $0` CMDNAME=`basename $0`
...@@ -36,17 +36,6 @@ EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null` ...@@ -36,17 +36,6 @@ EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null`
# Feel free to add yours here. # Feel free to add yours here.
#----------------------------------- #-----------------------------------
# #
# This is QNX 4.25
#
if [ `uname` = 'QNX' ]; then
if ps -eA | grep -s '[p]ostmaster' >/dev/null 2>&1 ; then
echo "$CMDNAME: a postmaster is still running" 1>&2
exit 1
fi
rm -f /dev/shmem/PgS*
exit $?
fi
#
# This is based on RedHat 5.2. # This is based on RedHat 5.2.
# #
if [ `uname` = 'Linux' ]; then if [ `uname` = 'Linux' ]; then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* for developers. If you edit any of these, be sure to do a *full* * for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted). * rebuild (and an initdb if noted).
* *
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.18 2005/10/07 20:11:03 tgl Exp $ * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.19 2006/01/05 01:56:29 momjian Exp $
*------------------------------------------------------------------------ *------------------------------------------------------------------------
*/ */
...@@ -155,14 +155,14 @@ ...@@ -155,14 +155,14 @@
/* /*
* Disable UNIX sockets for those operating system. * Disable UNIX sockets for those operating system.
*/ */
#if defined(__QNX__) || defined(__BEOS__) || defined(WIN32) #if defined(__BEOS__) || defined(WIN32)
#undef HAVE_UNIX_SOCKETS #undef HAVE_UNIX_SOCKETS
#endif #endif
/* /*
* Define this if your operating system supports link() * Define this if your operating system supports link()
*/ */
#if !defined(__QNX__) && !defined(__BEOS__) && \ #if !defined(__BEOS__) && \
!defined(WIN32) && !defined(__CYGWIN__) !defined(WIN32) && !defined(__CYGWIN__)
#define HAVE_WORKING_LINK 1 #define HAVE_WORKING_LINK 1
#endif #endif
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.146 2005/12/30 21:43:41 momjian Exp $ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.147 2006/01/05 01:56:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -684,25 +684,6 @@ typedef unsigned int slock_t; ...@@ -684,25 +684,6 @@ typedef unsigned int slock_t;
#endif /* HPUX on IA64, non gcc */ #endif /* HPUX on IA64, non gcc */
#if defined(__QNX__) && defined(__WATCOMC__) /* QNX */
/*
* QNX 4 using WATCOM C
*/
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#define TAS(lock) wc_tas(lock)
extern slock_t wc_tas(volatile slock_t *lock);
#pragma aux wc_tas =\
" mov al,1 " \
" lock xchg al,[esi]" \
parm [esi] \
value [al];
#endif /* __QNX__ and __WATCOMC__*/
#if defined(__sgi) /* SGI compiler */ #if defined(__sgi) /* SGI compiler */
/* /*
* SGI IRIX 5 * SGI IRIX 5
......
MK_NO_LORDER= true
AR= ar
AROPT = cr
LD= $(AR)
LDREL= $(AROPT)
LDOUT=
LDFLAGS=
enable_shared = no
DLSUFFIX = .so
CFLAGS_SL =
%$(DLSUFFIX): %.o
@echo 'cannot make shared object $@ from $<'
sqlmansect = 7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for the plpgsql shared object # Makefile for the plpgsql shared object
# #
# $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.27 2005/12/09 21:19:36 petere Exp $ # $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.28 2006/01/05 01:56:30 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -21,14 +21,7 @@ rpath := ...@@ -21,14 +21,7 @@ rpath :=
OBJS = pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o OBJS = pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
ifneq ($(PORTNAME), qnx4)
all: all-lib all: all-lib
else
all:
@echo "*****"
@echo "* PL/pgSQL was not built due to library manager problems."
@echo "*****"
endif
# Shared library stuff # Shared library stuff
include $(top_srcdir)/src/Makefile.shlib include $(top_srcdir)/src/Makefile.shlib
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/isinf.c,v 1.7 2005/10/15 02:49:51 momjian Exp $ * $PostgreSQL: pgsql/src/port/isinf.c,v 1.8 2006/01/05 01:56:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -74,18 +74,3 @@ isinf(double x) ...@@ -74,18 +74,3 @@ isinf(double x)
} }
#endif #endif
#endif #endif
#ifdef __QNX__
#include <float.h>
int
isinf(double x)
{
if (x == HUGE_VAL)
return 1;
if (x == -HUGE_VAL)
return -1;
return 0;
}
#endif
This diff is collapsed.
#! /bin/sh #! /bin/sh
# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.62 2005/12/09 21:19:36 petere Exp $ # $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.63 2006/01/05 01:56:30 momjian Exp $
me=`basename $0` me=`basename $0`
: ${TMPDIR=/tmp} : ${TMPDIR=/tmp}
...@@ -216,7 +216,7 @@ esac ...@@ -216,7 +216,7 @@ esac
# On some platforms we can't use Unix sockets. # On some platforms we can't use Unix sockets.
# ---------- # ----------
case $host_platform in case $host_platform in
*-*-cygwin* | *-*-mingw32* | *-*-qnx* | *beos*) *-*-cygwin* | *-*-mingw32* | *beos*)
unix_sockets=no;; unix_sockets=no;;
*) *)
unix_sockets=yes;; unix_sockets=yes;;
...@@ -228,7 +228,7 @@ esac ...@@ -228,7 +228,7 @@ esac
# ---------- # ----------
case $host_platform in case $host_platform in
*-*-qnx* | *-*-sco3.2v5*) *-*-sco3.2v5*)
DIFFFLAGS=-b;; DIFFFLAGS=-b;;
*) *)
DIFFFLAGS=-w;; DIFFFLAGS=-w;;
......
float4/.*-qnx=float4-exp-three-digits
float4/i.86-pc-mingw32=float4-exp-three-digits float4/i.86-pc-mingw32=float4-exp-three-digits
float8/i.86-.*-freebsd[234]=float8-small-is-zero float8/i.86-.*-freebsd[234]=float8-small-is-zero
float8/i.86-.*-openbsd=float8-small-is-zero float8/i.86-.*-openbsd=float8-small-is-zero
float8/i.86-.*-netbsd=float8-small-is-zero float8/i.86-.*-netbsd=float8-small-is-zero
float8/m68k-.*-netbsd=float8-small-is-zero float8/m68k-.*-netbsd=float8-small-is-zero
float8/.*-qnx=float8-exp-three-digits
float8/i.86-pc-mingw32=float8-exp-three-digits-win32 float8/i.86-pc-mingw32=float8-exp-three-digits-win32
float8/i.86-pc-cygwin=float8-small-is-zero float8/i.86-pc-cygwin=float8-small-is-zero
int8/.*-qnx=int8-exp-three-digits
int8/i.86-pc-mingw32=int8-exp-three-digits int8/i.86-pc-mingw32=int8-exp-three-digits
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