pgsql: Add kqueue(2) support to the WaitEventSet API.

Thomas Munro <tmunro@postgresql.org>

From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Date: 2020-02-05T04:59:10Z
Lists: pgsql-hackers
Add kqueue(2) support to the WaitEventSet API.

Use kevent(2) to wait for events on the BSD family of operating
systems and macOS.  This is similar to the epoll(2) support added
for Linux by commit 98a64d0bd.

Author: Thomas Munro
Reviewed-by: Andres Freund, Marko Tiikkaja, Tom Lane
Tested-by: Mateusz Guzik, Matteo Beccati, Keith Fiske, Heikki Linnakangas, Michael Paquier, Peter Eisentraut, Rui DeSousa, Tom Lane, Mark Wong
Discussion: https://postgr.es/m/CAEepm%3D37oF84-iXDTQ9MrGjENwVGds%2B5zTr38ca73kWR7ez_tA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/815c2f0972c8386aba7c606f1ee6690d13b04db2

Modified Files
--------------
configure                       |   4 +-
configure.in                    |   2 +
src/backend/storage/ipc/latch.c | 300 +++++++++++++++++++++++++++++++++++++++-
src/include/pg_config.h.in      |   6 +
src/tools/msvc/Solution.pm      |   2 +
5 files changed, 311 insertions(+), 3 deletions(-)

Commits

  1. Don't use EV_CLEAR for kqueue events.

  2. Fix kqueue support under debugger on macOS.

  3. Account explicitly for long-lived FDs that are allocated outside fd.c.

  4. Add kqueue(2) support to the WaitEventSet API.

  5. Introduce WaitEventSet API.