Re: Proposal to add a QNX 6.5 port to PostgreSQL

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: "Baker, Keith [OCDUS Non-J&J]" <KBaker9(at)its(dot)jnj(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal to add a QNX 6.5 port to PostgreSQL
Date: 2014-08-20 23:24:58
Message-ID: 20140820232458.GA26254@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2014-08-20 21:21:41 +0000, Baker, Keith [OCDUS Non-J&J] wrote:
> 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)
> +#define PG_RETRY_EINTR_FILE(exp) PG_RETRY_EINTR3(exp,NULL,FILE *)
> +/* 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__ */

I think this is a horrible way to go and unlikely to succeed. You're
surely going to miss calls and it's going to need to be maintained
continuously. We'll miss adding things which will then only break under
load. Which most poeple won't be able to generate under qnx.

The only reasonably way to fake kernel SA_RESTART support is doing so is
in $platform's libc. In the syscall wrapper.

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

Why is the --disable-thread-safety needed?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Claudio Freire 2014-08-20 23:33:20 Re: [PATCH] Incremental backup: add backup profile to base backup
Previous Message Michael Paquier 2014-08-20 23:24:50 Re: Verbose output of pg_dump not show schema name