Unix-domain socket support on Windows

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Unix-domain socket support on Windows
Date: 2019-08-07 13:56:03
Message-ID: 54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It works!

(apparently as of Windows 10 version 1803)

Here are some patches to get a discussion rolling.

Basically, it just works, but you need to define your own struct
sockaddr_un. (This is what configure currently uses as a proxy for
HAVE_UNIX_SOCKETS, so (a) that needs a bit of tweaking, and (b) that is
the reason why builds haven't blown up already.)

But we'll now need to make things work so that binaries with Unix-domain
socket support work on systems without run-time support. We already did
that exercise with IPv6 support, so some of the framework is already in
place.

Depending on your Windows environment, there might not be a suitable
/tmp directory, so you'll need to specify a directory explicitly using
postgres -k or similar. This leads to the question what the default for
DEFAULT_PGSOCKET_DIR should be on Windows. I think it's probably best,
at least for now, to set it so that by default, neither server nor libpq
use Unix sockets unless explicitly selected. This can be done easily on
the server side by defining DEFAULT_PGSOCKET_DIR as "". But in libpq, I
don't think the code would handle that correctly everywhere, so it would
need some more analysis and restructuring possibly.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Enable-Unix-domain-sockets-support-on-Windows.patch text/plain 4.4 KB
0002-Sort-out-getpeereid-and-struct-passwd-handling-on-Wi.patch text/plain 5.4 KB
0003-psql-Remove-one-use-of-HAVE_UNIX_SOCKETS.patch text/plain 1.2 KB
0004-libpq-Remove-unnecessary-uses-of-HAVE_UNIX_SOCKETS.patch text/plain 1.7 KB
0005-initdb-Detect-Unix-domain-socket-support-dynamically.patch text/plain 8.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-08-07 13:57:05 Re: stress test for parallel workers
Previous Message Dmitry Igrishin 2019-08-07 13:37:58 Re: Small patch to fix build on Windows