cygipc (and PostgreSQL) XP problem resolved!

Jason Tishler jason@tishler.net
Mon May 12 13:55:00 GMT 2003


Chuck,

On Thu, May 08, 2003 at 11:39:33PM -0400, Charles Wilson wrote:
> Jason Tishler wrote:
> >On Wed, May 07, 2003 at 08:31:07PM -0400, Charles Wilson wrote:
> >>I think this needs to be a runtime function, not a compiletime
> >>macro.
> >
> >Given Igor's validation, improvements, and corrections of/to my
> >patch, do you still want a runtime function approach?  Or, is the
> >(ugly and possibly performance affecting) macro approach OK?
> 
> Nope -- I'm an idiot.

Nope -- you are *not* an idiot.  IMO, macros are ugly and can be hard to
read.  Your initial interpretation is quite understandable.

> You and Igor are correct.

See attached for take 2 -- it fixes the issues raised by Igor:

    1. handle versions with a minor number of 0 (e.g., 6.0)
    2. check for NT explicitly (i.e, high-order bit)
    3. call GetVersion() only once
    4. remove trailing backspace

Same ChangeLog as before but please add Igor's name.  In this way, he
can feel some of the pain (i.e., private email) too. :,)

Note that issue 1 is accomplished by treating 2000 and up (instead of XP
and up) the same which is fine from both empirical evidence and the
MSDN:

    The "Local", "Global" and "Session" prefixes are reserved for system
    use and should not be used as names for kernel objects. These
    keywords are case sensitive. On Windows 2000 without Terminal
    Services, these keywords are ignored. On earlier versions of the
    system, the functions for creating or opening these objects fail if
    you specify a name containing the backslash character (\).

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
Only in cygipc-1.13-2: ftok.dep
Only in cygipc-1.13-2: ftok.o
diff -rup cygipc-1.13-2.orig/include/IpcNtLit.h cygipc-1.13-2/include/IpcNtLit.h
--- cygipc-1.13-2.orig/include/IpcNtLit.h	2002-11-12 14:14:07.000000000 -0500
+++ cygipc-1.13-2/include/IpcNtLit.h	2003-05-12 08:16:14.000000000 -0400
@@ -48,24 +48,34 @@
 /************************************************************************/
 #if defined OLDCYGIPC
 # define CYGWIN_IPCNT_PKGNAME		"cygipc_"
-# define CYGWIN_IPCNT_SEMCTL		"MultiSemCtl_"
-# define CYGWIN_IPCNT_SEMSEM		"MultiSemSem_"
-# define CYGWIN_IPCNT_SEMSHM		"MultiSemShm_"
-# define CYGWIN_IPCNT_SEMMSG		"MultiSemMsg_"
+# define CYGWIN_IPCNT_SEMCTL_BASE	"MultiSemCtl_"
+# define CYGWIN_IPCNT_SEMSEM_BASE	"MultiSemSem_"
+# define CYGWIN_IPCNT_SEMSHM_BASE	"MultiSemShm_"
+# define CYGWIN_IPCNT_SEMMSG_BASE	"MultiSemMsg_"
 # define CYGWIN_IPCNT_FILESEM		"/tmp/MultiFileSem"
 # define CYGWIN_IPCNT_FILESHM		"/tmp/MultiFileShm"
 # define CYGWIN_IPCNT_FILEMSG		"/tmp/MultiFileMsg"
 #else
 # define CYGWIN_IPCNT_PKGNAME		"cygipc2_"
-# define CYGWIN_IPCNT_SEMCTL		"MultiSemCtl2_"
-# define CYGWIN_IPCNT_SEMSEM		"MultiSemSem2_"
-# define CYGWIN_IPCNT_SEMSHM		"MultiSemShm2_"
-# define CYGWIN_IPCNT_SEMMSG		"MultiSemMsg2_"
+# define CYGWIN_IPCNT_SEMCTL_BASE	"MultiSemCtl2_"
+# define CYGWIN_IPCNT_SEMSEM_BASE	"MultiSemSem2_"
+# define CYGWIN_IPCNT_SEMSHM_BASE	"MultiSemShm2_"
+# define CYGWIN_IPCNT_SEMMSG_BASE	"MultiSemMsg2_"
 # define CYGWIN_IPCNT_FILESEM		"/tmp/MultiFileSem2"
 # define CYGWIN_IPCNT_FILESHM		"/tmp/MultiFileShm2"
 # define CYGWIN_IPCNT_FILEMSG		"/tmp/MultiFileMsg2"
 #endif
 
+#define NAMESPACE_PREFIX "Global\\"
+#define FULL_NAMESPACE_PATH(name) \
+	({DWORD ver = GetVersion(); \
+	(ver < 0x80000000 && LOBYTE(LOWORD(ver)) >= 5) ? \
+	NAMESPACE_PREFIX name : name;})
+
+#define CYGWIN_IPCNT_SEMCTL	FULL_NAMESPACE_PATH(CYGWIN_IPCNT_SEMCTL_BASE)
+#define CYGWIN_IPCNT_SEMSEM	FULL_NAMESPACE_PATH(CYGWIN_IPCNT_SEMSEM_BASE)
+#define CYGWIN_IPCNT_SEMSHM	FULL_NAMESPACE_PATH(CYGWIN_IPCNT_SEMSHM_BASE)
+#define CYGWIN_IPCNT_SEMMSG	FULL_NAMESPACE_PATH(CYGWIN_IPCNT_SEMMSG_BASE)
 /************************************************************************/
 /* SEMAPHORE								*/
 /************************************************************************/

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list