Thanks for your interest and questions.
At this point I have created a proof-of-concept QNX 6.5 port which appears to 
work on the surface (passes regression tests), but needs to be deemed 

To work around lack of SA_RESTART, I added QNX-specific retry macros to port.h
With these macros in place "make check" runs cleanly (fails in many place 
without them).

    +#if defined(__QNX__)
    +/* QNX does not support sigaction SA_RESTART. We must retry interrupted 
calls (EINTR) */
    +/* Helper macros, used to build our retry macros */
    +#define PG_RETRY_EINTR3(exp,val,type) ({ type _tmp_rc; do _tmp_rc = (exp); 
while (_tmp_rc == (val) && errno == EINTR); _tmp_rc; })
    +#define PG_RETRY_EINTR(exp) PG_RETRY_EINTR3(exp,-1L,long int)
    +/* override calls known to return EINTR when interrupted */
    +#define close(a) PG_RETRY_EINTR(close(a))
    +#define fclose(a) PG_RETRY_EINTR(fclose(a))
    +#define fdopen(a,b) PG_RETRY_EINTR_FILE(fdopen(a,b))
    +#define fopen(a,b) PG_RETRY_EINTR_FILE(fopen(a,b))
    +#define freopen(a,b,c) PG_RETRY_EINTR_FILE(freopen(a,b,c))
    +#define fseek(a,b,c) PG_RETRY_EINTR(fseek(a,b,c))
    +#define fseeko(a,b,c) PG_RETRY_EINTR(fseeko(a,b,c))
    +#define ftruncate(a,b) PG_RETRY_EINTR(ftruncate(a,b))
    +#define lseek(a,b,c) PG_RETRY_EINTR(lseek(a,b,c))
    +#define open(a,b,...) ({ int _tmp_rc; do _tmp_rc = 
open(a,b,##__VA_ARGS__); while (_tmp_rc == (-1) && errno == EINTR); _tmp_rc; })
    +#define shm_open(a,b,c) PG_RETRY_EINTR(shm_open(a,b,c))
    +#define stat(a,b) PG_RETRY_EINTR(stat(a,b))
    +#define unlink(a) PG_RETRY_EINTR(unlink(a))
    ... (Macros for read and write are similar but slightly longer, so I omit 
them here)...
    +#endif     /* __QNX__ */

Here is what I used for configure, I am open to suggestions:
    ./configure --without-readline --disable-thread-safety

I am targeting QNX 6.5 on x86, using gcc 4.4.2.

Also, I have an issue to work out for locale support, but expect I can solve 

Keith Baker

> -----Original Message-----
> From: Alvaro Herrera []
> Sent: Wednesday, August 20, 2014 4:16 PM
> To: Baker, Keith [OCDUS Non-J&J]
> Cc: Robert Haas; Tom Lane;
> Subject: Re: [HACKERS] Proposal to add a QNX 6.5 port to PostgreSQL
> Baker, Keith [OCDUS Non-J&J] wrote:
> > Please let me know if more discussion is required, or if it would be
> > reasonable for me (or someone else of your choosing) to work on the
> > coding effort (perhaps targeted for 9.5?) If on the other hand it has
> > been decided that a QNX port is not in the cards, I would like to know
> > (I hope that is not the case given the progress made, but no point in
> > wasting anyone's time).
> As I recall, other than the postmaster startup interlock, the other major
> missing item you mentioned is SA_RESTART.  That could well turn out to be a
> showstopper, so I suggest you study that in more depth.
> Are there other major items missing?  Did you have to use configure --
> disable-spinlocks for instance?
> What's your compiler, and what are the underlying hardware platforms you
> want to support?
> --
> Álvaro Herrera      
> PostgreSQL Development, 24x7 Support, Training & Services

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to