Switch the semaphore API on Solaris to unnamed POSIX.

Solaris descendants (Illumos, OpenIndiana, OmniOS, etc.) hit System V
semaphore limits ("No space left on device" from semget) when running
many parallel test scripts under default system settings.  We could
tell people to raise those settings, but there's a better answer.
Unnamed POSIX semaphores have been available on Solaris for decades
and work well, so prefer them, as was recently done for AIX.

This patch also updates the documentation to remove now-unnecessary
advice about raising project.max-sem-ids and project.max-msg-ids.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/470305.1772417108@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2026-03-14 14:10:32 -04:00
parent 2eb87345e1
commit 0123ce131f
3 changed files with 8 additions and 7 deletions

View file

@ -1128,13 +1128,8 @@ projadd -c "PostgreSQL DB User" -K "project.max-shm-memory=(privileged,8GB,deny)
</para>
<para>
Other recommended kernel setting changes for database servers which will
have a large number of connections are:
<programlisting>
project.max-shm-ids=(priv,32768,deny)
project.max-sem-ids=(priv,4096,deny)
project.max-msg-ids=(priv,4096,deny)
</programlisting>
To run a very large server, or multiple servers concurrently, you
might also need to raise <literal>project.max-shm-ids</literal>.
</para>
<para>

View file

@ -324,6 +324,7 @@ elif host_system == 'openbsd'
elif host_system == 'sunos'
portname = 'solaris'
sema_kind = 'unnamed_posix'
export_fmt = '-Wl,-M@0@'
# We need these #defines to get POSIX-conforming versions
# of many interfaces (sigwait, getpwuid_r, shmdt, ...).

View file

@ -1,4 +1,9 @@
# src/template/solaris
# Prefer unnamed POSIX semaphores if available, unless user overrides choice
if test x"$PREFERRED_SEMAPHORES" = x"" ; then
PREFERRED_SEMAPHORES=UNNAMED_POSIX
fi
# Extra CFLAGS for code that will go into a shared library
CFLAGS_SL="-fPIC"