diff -rwC3 -X /home/repas/expat postgresql-7.1/doc/FAQ_QNX4 postgresql-7.1.qnx4/doc/FAQ_QNX4 *** postgresql-7.1/doc/FAQ_QNX4 Tue Apr 4 15:49:29 2000 --- postgresql-7.1.qnx4/doc/FAQ_QNX4 Mon Apr 30 16:06:31 2001 *************** *** 7,16 **** 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. For ! the Watcom compiler spinlocks have been implemented using POSIX semaphores. ! It is recomended 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. It could be managed to build postgres using the Watcom compiler but it crashes --- 7,15 ---- 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 necessary 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. It could be managed to build postgres using the Watcom compiler but it crashes *************** *** 31,48 **** The following prerequisites have been used: ! QNX 4.25 ! Watcom C 10.6 ! GNU make flex-2.5.4a.tar.gz (flex) ! egcs111-qnx4-r20.tar[.gz] (GNU C) perl 5.004_04 tcl8.0.3.tar.Z (Tcl) flex can be built without any problems using the Watcom or GNU C compilers. GNU C can be installed by ! /etc/install -u egcs111-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 --- 30,63 ---- 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) + 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 *************** *** 84,95 **** See attached patch. If you use another ecpg version the include/g++ path in Makefile.qnx4 ! (CXXFLAGS) has to be adopted. If all prerequisites are available postgres can be built and installed by cd pgsql/src ! ./configure --with-tcl --with-perl --with-x ! gmake all > make.log 2>&1 gmake install > make.install.log 2>&1 su cd interfaces/perl5 --- 99,110 ---- See attached patch. If you use another ecpg version the include/g++ path in Makefile.qnx4 ! (CXXFLAGS) has to be adapted. 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 *************** *** 98,103 **** --- 113,124 ---- All other steps can be carried out as stated in the INSTALL file. + It is currently not possible to run 'make check' with 7.1 while a 7.0 is + running. The semaphore implementation uses a fixed name for the semaphore + shared memory. The layout of this memory has changed in an incompatible way, + so in order to run a 7.1 on a system previously using 7.0 you have to + remove /dev/shmem/SysV_Sem_Info. + Make problems: -------------- *************** *** 114,120 **** generate the gram.h, parse.h, preproc.h and preproc.c files on another platform and use them. This is only a problem when you use the current source tree since parse.h, gram.c, preproc.h and preporc.c are included in official ! distributions. Regression tests: ----------------- --- 135,142 ---- generate the gram.h, parse.h, preproc.h and preproc.c files on another platform and use them. This is only a problem when you use the current source tree since parse.h, gram.c, preproc.h and preporc.c are included in official ! distributions. In order to avoid this, install the bison binary mentioned ! above. Regression tests: ----------------- *************** *** 152,160 **** Have fun! Andreas Kardos - kardos@repas-aeg.de 2000-04-04 --------------------------------------------------------------------------- --- 174,184 ---- Have fun! Andreas Kardos 2000-04-04 + Bernd Tegge + tegge@repas-aeg.de + 2001-03-01 --------------------------------------------------------------------------- Only in postgresql-7.1.qnx4/src: GNUmakefile Only in postgresql-7.1.qnx4/src: Makefile.global Only in postgresql-7.1.qnx4/src: Makefile.port diff -rwC3 -X /home/repas/expat postgresql-7.1/src/backend/Makefile postgresql-7.1.qnx4/src/backend/Makefile *** postgresql-7.1/src/backend/Makefile Fri Apr 6 16:36:29 2001 --- postgresql-7.1.qnx4/src/backend/Makefile Mon Apr 30 15:56:49 2001 *************** *** 25,31 **** 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?) OBJS+= bootstrap/bootstrap.o endif --- 25,32 ---- 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 diff -rwC3 -X /home/repas/expat postgresql-7.1/src/backend/port/qnx4/sem.c postgresql-7.1.qnx4/src/backend/port/qnx4/sem.c *** postgresql-7.1/src/backend/port/qnx4/sem.c Fri Feb 23 19:12:09 2001 --- postgresql-7.1.qnx4/src/backend/port/qnx4/sem.c Thu Apr 5 22:54:29 2001 *************** *** 23,31 **** #include "storage/ipc.h" #include "storage/proc.h" #include ! #define SETMAX ((MAXBACKENDS + PROC_NSEMS_PER_SET - 1) / PROC_NSEMS_PER_SET) #define SEMMAX (PROC_NSEMS_PER_SET+1) #define OPMAX 8 --- 23,33 ---- #include "storage/ipc.h" #include "storage/proc.h" #include + #include + #include ! #define SETMAX ((MAXBACKENDS + PROC_NSEMS_PER_SET + 1) / PROC_NSEMS_PER_SET) #define SEMMAX (PROC_NSEMS_PER_SET+1) #define OPMAX 8 *************** *** 132,137 **** --- 134,140 ---- semid, semnum /* , semnum1 */ ; int exist = 0; + struct stat statbuf; if (nsems < 0 || nsems > SEMMAX) { *************** *** 153,158 **** --- 156,181 ---- return fd; /* The size may only be set once. Ignore errors. */ ltrunc(fd, sizeof(struct sem_info), 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 != + ((( sizeof(struct sem_info) /__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", statbuf.st_size, + sizeof(struct sem_info), SHM_INFO_NAME); + errno = EACCES; + return -1; + } SemInfo = mmap(NULL, sizeof(struct sem_info), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (SemInfo == MAP_FAILED) diff -rwC3 -X /home/repas/expat postgresql-7.1/src/backend/port/qnx4/shm.c postgresql-7.1.qnx4/src/backend/port/qnx4/shm.c *** postgresql-7.1/src/backend/port/qnx4/shm.c Sat Mar 24 01:54:44 2001 --- postgresql-7.1.qnx4/src/backend/port/qnx4/shm.c Thu Apr 5 22:21:38 2001 *************** *** 15,23 **** --- 15,25 ---- #include #include #include + #include #include #include #include + #include #define MODE 0777 *************** *** 172,196 **** { struct shm_info info; char name[NAME_MAX + 1]; ! if (cmd == IPC_RMID) { if (shm_getinfo(shmid, &info) == -1) { errno = EACCES; return -1; } ! return shm_unlink(itoa(info.key, name, 16)); } ! if (cmd == IPC_STAT) { - /* ! * Can we support IPC_STAT? We only need shm_nattch ... For now, ! * punt and assume the shm seg does not exist. */ ! errno = EINVAL; ! return -1; } errno = EINVAL; return -1; --- 174,224 ---- { 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 ); ! itoa(info.key, name, 16); ! 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 ! */ ! itoa(shmid, name, 16); ! 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; *************** *** 222,229 **** info.key = key; info.size = size; info.addr = NULL; ! if (shm_putinfo(&info) == -1) return -1; } /* The size may only be set once. Ignore errors. */ --- 250,262 ---- 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. */ diff -rwC3 -X /home/repas/expat postgresql-7.1/src/include/port/qnx4.h postgresql-7.1.qnx4/src/include/port/qnx4.h *** postgresql-7.1/src/include/port/qnx4.h Fri Feb 23 19:12:19 2001 --- postgresql-7.1.qnx4/src/include/port/qnx4.h Thu Apr 26 16:35:41 2001 *************** *** 4,15 **** #include /* for unix.h */ #include #include /* for select */ - #if !defined(__GNUC__) - #include /* for sem_t */ - #endif #define HAS_TEST_AND_SET - #define HAVE_STRING_H #undef HAVE_GETRUSAGE --- 4,11 ---- *************** *** 26,38 **** typedef u_short ushort; - #if defined(__GNUC__) typedef unsigned char slock_t; - - #else - typedef sem_t slock_t; - - #endif extern int isnan(double dsrc); --- 22,28 ---- diff -rwC3 -X /home/repas/expat postgresql-7.1/src/include/storage/s_lock.h postgresql-7.1.qnx4/src/include/storage/s_lock.h *** postgresql-7.1/src/include/storage/s_lock.h Sun Apr 1 21:17:32 2001 --- postgresql-7.1.qnx4/src/include/storage/s_lock.h Mon Apr 30 15:40:16 2001 *************** *** 9,15 **** * * * IDENTIFICATION ! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/include/storage/s_lock.h,v 1.91 2001/03/25 17:52:46 tgl Exp $ * *------------------------------------------------------------------------- */ --- 9,15 ---- * * * IDENTIFICATION ! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/include/storage/s_lock.h,v 1.90 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ *************** *** 84,89 **** --- 84,96 ---- #include "storage/ipc.h" + /* Platform-independent out-of-line support routines */ + extern void s_lock(volatile slock_t *lock, + const char *file, const int line); + extern void s_lock_sleep(unsigned spins, int timeout, int microsec, + volatile slock_t *lock, + const char *file, const int line); + #if defined(HAS_TEST_AND_SET) *************** *** 106,112 **** */ ! #if defined(__i386__) && !defined(__QNX__) #define TAS(lock) tas(lock) static __inline__ int --- 113,119 ---- */ ! #if defined(__i386__) #define TAS(lock) tas(lock) static __inline__ int *************** *** 396,413 **** #endif /* __hpux */ ! ! #if defined(__QNX__) /* ! * QNX 4 ! * ! * Note that slock_t under QNX is sem_t instead of char */ ! #define TAS(lock) (sem_trywait((lock)) < 0) ! #define S_UNLOCK(lock) sem_post((lock)) ! #define S_INIT_LOCK(lock) sem_init((lock), 1, 1) ! #define S_LOCK_FREE(lock) ((lock)->value) ! #endif /* __QNX__ */ #if defined(__sgi) --- 403,422 ---- #endif /* __hpux */ ! #if defined(__QNX__) && defined(__WATCOMC__) /* ! * QNX 4 using WATCOM C */ ! #define TAS(lock) tas(lock) ! static tas(volatile slock_t *lock) ! #pragma aux tas =\ ! " mov al,1 " \ ! " lock " \ ! " xchgb al,[esi]" \ ! parm [esi] \ ! value [al] ! ! #endif /* __QNX__ and __WATCOMC__*/ #if defined(__sgi) *************** *** 540,554 **** #define TAS(lock) tas(lock) #endif /* TAS */ - - /**************************************************************************** - * Platform-independent out-of-line support routines - */ - - extern void s_lock(volatile slock_t *lock, - const char *file, const int line); - extern void s_lock_sleep(unsigned spins, int timeout, int microsec, - volatile slock_t *lock, - const char *file, const int line); #endif /* S_LOCK_H */ --- 549,553 ---- diff -rwC3 -X /home/repas/expat postgresql-7.1/src/pl/plpgsql/Makefile postgresql-7.1.qnx4/src/pl/plpgsql/Makefile *** postgresql-7.1/src/pl/plpgsql/Makefile Thu Aug 31 18:12:15 2000 --- postgresql-7.1.qnx4/src/pl/plpgsql/Makefile Mon Apr 30 16:03:29 2001 *************** *** 12,19 **** --- 12,28 ---- top_builddir = ../../.. include $(top_builddir)/src/Makefile.global + ifneq ($(PORTNAME), qnx4) + all install installdirs uninstall distprep: $(MAKE) -C src $@ + + else #qnx4 + + all install installdirs uninstall distprep: + echo plpgsql not supported with QNX due to lack of shared library support + + endif # qnx4 clean distclean maintainer-clean: -$(MAKE) -C src $@ diff -rwC3 -X /home/repas/expat postgresql-7.1/src/test/regress/pg_regress.sh postgresql-7.1.qnx4/src/test/regress/pg_regress.sh *** postgresql-7.1/src/test/regress/pg_regress.sh Sun Apr 1 21:17:34 2001 --- postgresql-7.1.qnx4/src/test/regress/pg_regress.sh Fri Apr 27 17:06:51 2001 *************** *** 507,512 **** --- 507,519 ---- ) & done wait + # wait is broken in the QNX sh, hope that 30 secs are sufficient + case $host_platform in + *-*-qnx*) + sleep 30 + echo sleeping 30 seconds + ;; + esac echo fi