Re: Proposal to add a QNX 6.5 port to PostgreSQL - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Proposal to add a QNX 6.5 port to PostgreSQL
Date
Msg-id 20140820232458.GA26254@alap3.anarazel.de
Whole thread Raw
In response to Re: Proposal to add a QNX 6.5 port to PostgreSQL  ("Baker, Keith [OCDUS Non-J&J]" <KBaker9@its.jnj.com>)
Responses Re: Proposal to add a QNX 6.5 port to PostgreSQL
List 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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Verbose output of pg_dump not show schema name
Next
From: Claudio Freire
Date:
Subject: Re: [PATCH] Incremental backup: add backup profile to base backup