Skip site navigation (1) Skip section navigation (2)

Support for QNX6, POSIX IPC and PTHREAD-style locking

From: "Igor Kovalenko" <Igor(dot)Kovalenko(at)motorola(dot)com>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: Support for QNX6, POSIX IPC and PTHREAD-style locking
Date: 2001-11-20 07:51:59
Message-ID: 0cb601c17198$3c32bb90$20e00518@c773082g (view raw or flat)
Thread:
Lists: pgsql-patches
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: pgsql.diff
Description: application/octet-stream (85.0 KB)

Responses

pgsql-patches by date

Next:From: Joe ConwayDate: 2001-11-20 09:13:53
Subject: bytea datatype documentation patch
Previous:From: Marc G. FournierDate: 2001-11-20 05:49:23
Subject: Re: Can anybody see my path two days before?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group