[HACKERS] semaphore usage "port based"?

Craig Boston craig at feniz.gank.org
Tue Apr 4 16:08:15 UTC 2006


On Tue, Apr 04, 2006 at 10:17:18AM -0400, Vivek Khera wrote:
> Perhaps you can hack into the postgresql master a flag that alters  
> the "1000" parameter, or starts at a port * 1000 + N, then hard-code  
> that flag into your startup script per jail.

A quick and dirty hack to fudge with the requested semid (and shared
memroy identifier) is attached.  Replace XXX with an arbitrary number.

It would be better if this was configurable, but doing it that way works
well enough for what I need, and may at least give an idea where to
start on a better workaround.

Craig
-------------- next part --------------
--- src/backend/storage/ipc/ipci.c.orig	Tue Feb 28 10:09:23 2006
+++ src/backend/storage/ipc/ipci.c	Tue Feb 28 10:09:38 2006
@@ -102,14 +102,14 @@
 		/*
 		 * Create the shmem segment
 		 */
-		seghdr = PGSharedMemoryCreate(size, makePrivate, port);
+		seghdr = PGSharedMemoryCreate(size, makePrivate, port + XXX);
 
 		/*
 		 * Create semaphores
 		 */
 		numSemas = ProcGlobalSemas();
 		numSemas += SpinlockSemas();
-		PGReserveSemaphores(numSemas, port);
+		PGReserveSemaphores(numSemas, port + XXX);
 	}
 	else
 	{


More information about the freebsd-stable mailing list