From 56f8f9624ba050c7c47dd97547b7fafb866f2bdd Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 20 Aug 2019 16:10:20 +0900 Subject: Fix compilation failure of vacuumdb and reindexdb with OpenBSD FD_SETSIZE is included in sys/select.h per POSIX, and this header inclusion has been moved to scripts_parallel.c as of 5f38403 without moving the variable, causing a compilation failure on recent versions of OpenBSD (6.6 was the version used in the report). In order to take care of the failure, move FD_SETSIZE directly to scripts_parallel.c with a wrapper controlling the maximum number of parallel slots supported, based on a suggestion by Andres Freund. While on it, reduce the maximum number to be less than FD_SETSIZE, leaving some room for stdin, stdout and such as they consume some file descriptors. The buildfarm did not complain about that, as it happens to only be an issue on recent versions of OpenBSD and there is no coverage in this area. 51c3e9f fixed a similar set of issues. Bug: #15964 Reported-by: Sean Farrell Discussion: https://postgr.es/m/15964-c1753bdfed722e04@postgresql.org --- src/bin/scripts/scripts_parallel.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bin/scripts/scripts_parallel.h') diff --git a/src/bin/scripts/scripts_parallel.h b/src/bin/scripts/scripts_parallel.h index ab82c5e6a96..8042345072a 100644 --- a/src/bin/scripts/scripts_parallel.h +++ b/src/bin/scripts/scripts_parallel.h @@ -21,6 +21,8 @@ typedef struct ParallelSlot bool isFree; /* Is it known to be idle? */ } ParallelSlot; +extern int ParallelSlotsMax(void); + extern ParallelSlot *ParallelSlotsGetIdle(ParallelSlot *slots, int numslots); extern ParallelSlot *ParallelSlotsSetup(const char *dbname, const char *host, -- cgit v1.2.3