Alright, here I am for discussion. I feel somewhat out of context
though. There's been good deal of discussion in PATCHES/PORTS already.
Should I introduce the patch again or someone who already looked into it
will explain where do we stand now? Note also, the patch was later split
into parts which deal with QNX6 support and POSIX IPC separately. I
submitted that, but don't know which version was archived.

- igor

-------- Original Message --------
Subject: Re: [PATCHES] Support for QNX6, POSIX IPC and PTHREAD-style
locking
Date: Mon, 25 Feb 2002 16:19:11 -0500 (EST)
From: Bruce Momjian<pgman@candle.pha.pa.us>
To: Igor Kovalenko<Igor.Kovalenko@motorola.com>


Actually, yes.  This is a pretty major patch and they want this
discussed on hackers.  Could you post to hackers and we can continue the
discussion?


---------------------------------------------------------------------------

Igor Kovalenko wrote:
> Thanks. Any problems yet?
> - igor
> 
> Bruce Momjian wrote:
> > 
> > Your patch has been added to the PostgreSQL unapplied patches list at:
> > 
> >         http://candle.pha.pa.us/cgi-bin/pgpatches
> > 
> > I will try to apply it within the next 48 hours.
> > 
> > ---------------------------------------------------------------------------
> > 
> > Igor Kovalenko wrote:
> > > Here is the patch which adds following things to 7.2:
> > >
> > > 1. Support for QNX6 (builds cleanly on stock installation and passes all
> > > regression tests).
> > >
> > > 2. HAVE_POSIX_IPC feature, which if enabled switches implementation of
> > > IpcSemaphoreXXX() (ipc.[ch]) to POSIX semaphores and mmap(). Enabled on QNX6
> > > but should be useful for lot of platforms. Since IpcSemaphoreCreate() really
> > > assumed SysV semaphores, I had to change its prototype *when* this feature
> > > is enabled. That function is called from proc.c and spin.c, which were
> > > patched accordingly for POSIX case (with #ifdef guards).
> > >
> > > 3. USE_PTHREAD_MUTEXES feature, which if enabled implements S_LOCK stuff
> > > with PTHREAD mutexes. It is useful (better than spinlocks) on non-SMP
> > > systems when overhead of kernel call is small compared to overhead of
> > > scheduling. Enabled on QNX6.
> > >
> > > 4. USE_PTHREAD_SPINLOCKS feature which if enabled implements S_LOCK stuff
> > > with PTHREAD spinlocks (may not be available on all platforms). It might be
> > > better on SMP systems when hardware does not support TAS (in which case SysV
> > > semaphores would be used as of now and it is hard to be worse than that).
> > > MIPS systems come to mind (and QNX6 runs on them, so it will be enabled on
> > > QNX6 in such cases).
> > >
> > > I haven't put checks for (2), (3) or (4) into configure to not break
> > > supported platforms in unexpected ways. Benefits of (3) and (4) are really
> > > OS and hardware dependent, so if you think they could be useful for your
> > > platform, they have to be enabled in appropriate OS-specific header.
> > >
> > > Same for HAVE_POSIX_IPC, but that one in fact can be useful on lot of
> > > platforms. I've seen benchmark suggesting POSIX semaphores are 4 times
> > > faster on Linux than SysV ones. It certainly applies to QNX4 as well and
> > > makes emulation of SysV stuff unnecessary. I believe it could be extended to
> > > support platforms like Darwin and BeOS which currently also rely on SysV
> > > emulation. If there's interest from involved people, we could come up with a
> > > better unified abstraction model and implementations for all supported
> > > platforms...
> > >
> > > I've been warned it might be considered too 'major' for 7.2, but please look
> > > at the patch before judging. I tried my best to not break existing stuff,
> > > all changes are only activated when explicitly enabled, QNX6-specific or
> > > obviously compatible (the only 'unguarded' changes are typecasts for things
> > > like SemId = -1, since its type is pointer in case of POSIX and fix for
> > > broken QNX qsort() which I believe is already commited into CVS). I've spent
> > > considerable time doing this and would really appreciate if it went into
> > > 7.2. Code builds and runs clean with or without any of above features
> > > enabled.
> > >
> > > The patch generated as recursive GNU-diff between original 7.2b2 and patched
> > > (+ make distclean) top level directories, like 'diff -crP pgsql-original
> > > pgsql-patched'.
> > > It is big mostly because it contains whole new files for QNX6 (-P treats
> > > missing files as empty).
> > >
> > > regards,
> > > - igor
> > >
> > 
> > [ Attachment, skipping... ]
> > 
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> > 
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
19026

Tue, 26 Feb 2002 16:30:21 -0600
Igor Kovalenko <Igor.Kovalenko@motorola.com>
[Fwd: Re: [PATCHES] Support for QNX6, POSIX IPC and PTHREAD-style
	locking]

Igor, we have split out the System V shared memory and IPC stuff into
separate files in the current CVS.  Would you be able to make POSIX
files that would work on QNX6?  It is on our TODO list to get QNX6
working for 7.3, and you are the most capable person to do this.

(FYI, I have heard reports that people applied your patches to 7.2 and
got PostgreSQL 7.2 working on QNX6.)

I know your work for 7.2 didn't get integrated because there was such
confusion during testing and we didn't have the infrastructure ready for
such a split, but now we do have things set up so your POSIX stuff
should go in very cleanly, and I am sure other platforms would benefit
from this as well.

We start beta September 1.  Because things are split out, you should be
able to work during beta independently on the POSIX stuff.

---------------------------------------------------------------------------

Igor Kovalenko wrote:
> Alright, here I am for discussion. I feel somewhat out of context
> though. There's been good deal of discussion in PATCHES/PORTS already.
> Should I introduce the patch again or someone who already looked into it
> will explain where do we stand now? Note also, the patch was later split
> into parts which deal with QNX6 support and POSIX IPC separately. I
> submitted that, but don't know which version was archived.
> 
> - igor
> 
> -------- Original Message --------
> Subject: Re: [PATCHES] Support for QNX6, POSIX IPC and PTHREAD-style
> locking
> Date: Mon, 25 Feb 2002 16:19:11 -0500 (EST)
> From: Bruce Momjian<pgman@candle.pha.pa.us>
> To: Igor Kovalenko<Igor.Kovalenko@motorola.com>
> 
> 
> Actually, yes.  This is a pretty major patch and they want this
> discussed on hackers.  Could you post to hackers and we can continue the
> discussion?
> 
> 
> ---------------------------------------------------------------------------
> 
> Igor Kovalenko wrote:
> > Thanks. Any problems yet?
> > - igor
> > 
> > Bruce Momjian wrote:
> > > 
> > > Your patch has been added to the PostgreSQL unapplied patches list at:
> > > 
> > >         http://candle.pha.pa.us/cgi-bin/pgpatches
> > > 
> > > I will try to apply it within the next 48 hours.
> > > 
> > > ---------------------------------------------------------------------------
> > > 
> > > Igor Kovalenko wrote:
> > > > Here is the patch which adds following things to 7.2:
> > > >
> > > > 1. Support for QNX6 (builds cleanly on stock installation and passes all
> > > > regression tests).
> > > >
> > > > 2. HAVE_POSIX_IPC feature, which if enabled switches implementation of
> > > > IpcSemaphoreXXX() (ipc.[ch]) to POSIX semaphores and mmap(). Enabled on QNX6
> > > > but should be useful for lot of platforms. Since IpcSemaphoreCreate() really
> > > > assumed SysV semaphores, I had to change its prototype *when* this feature
> > > > is enabled. That function is called from proc.c and spin.c, which were
> > > > patched accordingly for POSIX case (with #ifdef guards).
> > > >
> > > > 3. USE_PTHREAD_MUTEXES feature, which if enabled implements S_LOCK stuff
> > > > with PTHREAD mutexes. It is useful (better than spinlocks) on non-SMP
> > > > systems when overhead of kernel call is small compared to overhead of
> > > > scheduling. Enabled on QNX6.
> > > >
> > > > 4. USE_PTHREAD_SPINLOCKS feature which if enabled implements S_LOCK stuff
> > > > with PTHREAD spinlocks (may not be available on all platforms). It might be
> > > > better on SMP systems when hardware does not support TAS (in which case SysV
> > > > semaphores would be used as of now and it is hard to be worse than that).
> > > > MIPS systems come to mind (and QNX6 runs on them, so it will be enabled on
> > > > QNX6 in such cases).
> > > >
> > > > I haven't put checks for (2), (3) or (4) into configure to not break
> > > > supported platforms in unexpected ways. Benefits of (3) and (4) are really
> > > > OS and hardware dependent, so if you think they could be useful for your
> > > > platform, they have to be enabled in appropriate OS-specific header.
> > > >
> > > > Same for HAVE_POSIX_IPC, but that one in fact can be useful on lot of
> > > > platforms. I've seen benchmark suggesting POSIX semaphores are 4 times
> > > > faster on Linux than SysV ones. It certainly applies to QNX4 as well and
> > > > makes emulation of SysV stuff unnecessary. I believe it could be extended to
> > > > support platforms like Darwin and BeOS which currently also rely on SysV
> > > > emulation. If there's interest from involved people, we could come up with a
> > > > better unified abstraction model and implementations for all supported
> > > > platforms...
> > > >
> > > > I've been warned it might be considered too 'major' for 7.2, but please look
> > > > at the patch before judging. I tried my best to not break existing stuff,
> > > > all changes are only activated when explicitly enabled, QNX6-specific or
> > > > obviously compatible (the only 'unguarded' changes are typecasts for things
> > > > like SemId = -1, since its type is pointer in case of POSIX and fix for
> > > > broken QNX qsort() which I believe is already commited into CVS). I've spent
> > > > considerable time doing this and would really appreciate if it went into
> > > > 7.2. Code builds and runs clean with or without any of above features
> > > > enabled.
> > > >
> > > > The patch generated as recursive GNU-diff between original 7.2b2 and patched
> > > > (+ make distclean) top level directories, like 'diff -crP pgsql-original
> > > > pgsql-patched'.
> > > > It is big mostly because it contains whole new files for QNX6 (-P treats
> > > > missing files as empty).
> > > >
> > > > regards,
> > > > - igor
> > > >
> > > 
> > > [ Attachment, skipping... ]
> > > 
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> > > 
> > > --
> > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> > 
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Sun, 25 Aug 2002 16:26:21 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [Fwd: Re: [PATCHES] Support for QNX6, POSIX IPC and PTHREAD-style