Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 4ece8fd17e8fbec5e9832f0326c244a25b666e0b
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-07-02T20:12:00Z
Releases: 8.2.5
Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().

This is a Linux kernel bug that apparently exists in every extant kernel
version: sometimes shmctl() will fail with EIDRM when EINVAL is correct.
We were assuming that EIDRM indicates a possible conflict with pre-existing
backends, and refusing to start the postmaster when this happens.  Fortunately,
there does not seem to be any case where Linux can legitimately return EIDRM
(it doesn't track shmem segments in a way that would allow that), so we can
get away with just assuming that EIDRM means EINVAL on this platform.

Per reports from Michael Fuhr and Jon Lapham --- it's a bit surprising
we have not seen more reports, actually.

Files

PathChange+/−
src/backend/port/sysv_shmem.c modified +13 −1
src/include/port/linux.h modified +14 −1