From: Tom Lane Date: Sat, 14 Mar 2026 18:10:32 +0000 (-0400) Subject: Switch the semaphore API on Solaris to unnamed POSIX. X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0123ce131fca454009439dfa3b2266d1d40737d7;p=thirdparty%2Fpostgresql.git 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 Reviewed-by: Greg Burd Discussion: https://postgr.es/m/470305.1772417108@sss.pgh.pa.us --- diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index b1937cd13ab..422a3544f94 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1128,13 +1128,8 @@ projadd -c "PostgreSQL DB User" -K "project.max-shm-memory=(privileged,8GB,deny) - Other recommended kernel setting changes for database servers which will - have a large number of connections are: - -project.max-shm-ids=(priv,32768,deny) -project.max-sem-ids=(priv,4096,deny) -project.max-msg-ids=(priv,4096,deny) - + To run a very large server, or multiple servers concurrently, you + might also need to raise project.max-shm-ids. diff --git a/meson.build b/meson.build index 70dc64c349a..f7a87edcc94 100644 --- a/meson.build +++ b/meson.build @@ -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, ...). diff --git a/src/template/solaris b/src/template/solaris index a4d8d38a8f8..ea524fdb2bd 100644 --- a/src/template/solaris +++ b/src/template/solaris @@ -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"