summaryrefslogtreecommitdiff
path: root/src/backend/port/sysv_shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/port/sysv_shmem.c')
-rw-r--r--src/backend/port/sysv_shmem.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index b44f07c8ec5..5229ec9cf66 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.24.2.2 2004/11/09 20:35:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.24.2.3 2007/07/02 20:12:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -209,6 +209,17 @@ PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
if (errno == EACCES)
return false;
/*
+ * Some Linux kernel versions (in fact, all of them as of July 2007)
+ * sometimes return EIDRM when EINVAL is correct. The Linux kernel
+ * actually does not have any internal state that would justify
+ * returning EIDRM, so we can get away with assuming that EIDRM is
+ * equivalent to EINVAL on that platform.
+ */
+#ifdef HAVE_LINUX_EIDRM_BUG
+ if (errno == EIDRM)
+ return false;
+#endif
+ /*
* Otherwise, we had better assume that the segment is in use.
* The only likely case is EIDRM, which implies that the segment
* has been IPC_RMID'd but there are still processes attached to it.