Re: Let's drop support for named POSIX semaphores

From: Greg Burd <greg(at)burd(dot)me>
To: pgsql-hackers(at)postgresql(dot)org
Cc: peter(at)eisentraut(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)lists(dot)postgresql(dot)org, thomas(dot)munro(at)gmail(dot)com
Subject: Re: Let's drop support for named POSIX semaphores
Date: 2026-10-26 15:57:23
Message-ID: at93oolYuFWmhoY1@floki
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

+1 on dropping it.

Peter, as to your concern that this adds another hard SysV dependency
and so cuts against the work to let PostgreSQL run without SysV IPC (for
macOS sandboxing): I don't think removing *named* POSIX semaphores costs
that effort anything, because named POSIX semaphores are not the thing
that effort would reach for.

The non-SysV semaphore path we'd actually want is the *unnamed* kind
(sem_init), which posix_sema.c already prefers and which backs the sem_t
structs out of shared memory. The named kind (sem_open) is only the
fallback, and the header comment there spells out why it's a dead end
for this:

With unnamed semaphores, the sem_t structs live in an array in shared
memory [...] Therefore, the named-semaphore code *does not cope with
EXEC_BACKEND*.

So a SysV-free future built on POSIX semaphores runs through the unnamed
path Tom is keeping, not the named path he's removing. Dropping named
POSIX semaphores narrows the matrix to "SysV or unnamed-POSIX".

(+1 as well to Shihao's two nits, the now-unused IPCProtection macro
and the stale runtime.sgml line about which platforms use which.)

best,

-greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-10-26 16:09:53 Re: Hash index inserts serialise on the metapage tuple counter
Previous Message shihao zhong 2026-10-26 15:52:07 Re: [PG19] A canceled notify read leaves the NOTIFY queue stuck