diff -u -r -x CVS /pack/src/cygwin/HEAD.src/winsup/cygwin/cygserver_shm.cc ./cygserver_shm.cc
--- /pack/src/cygwin/HEAD.src/winsup/cygwin/cygserver_shm.cc	2002-06-11 00:30:53.000000000 +0100
+++ ./cygserver_shm.cc	2002-06-11 01:24:18.000000000 +0100
@@ -106,7 +106,7 @@
  * attach count and attachees list
  */
 
-  InterlockedIncrement (&shm->shm_nattch);
+  InterlockedIncrement (&shm->ds.shm_nattch);
   _shmattach *
     attachnode =
     new
@@ -297,7 +297,7 @@
 	{
 	  if (tempnode->shm_id == parameters.in.shm_id)
 	    {
-	      InterlockedIncrement (&tempnode->shmds->shm_nattch);
+	      InterlockedIncrement (&tempnode->shmds->ds.shm_nattch);
 	      header.error_code = 0;
 	      CloseHandle (token_handle);
 	      return;
@@ -317,7 +317,7 @@
 	{
 	  if (tempnode->shm_id == parameters.in.shm_id)
 	    {
-	      InterlockedDecrement (&tempnode->shmds->shm_nattch);
+	      InterlockedDecrement (&tempnode->shmds->ds.shm_nattch);
 	      header.error_code = 0;
 	      CloseHandle (token_handle);
 	      return;
@@ -345,7 +345,7 @@
 		deleted_head = temp2;
 
 		// FIXME: when/where do we delete the handles?
-		if (temp2->shmds->shm_nattch)
+		if (temp2->shmds->ds.shm_nattch)
 		  {
 		    // FIXME: add to a pending queue?
 		  }
@@ -417,7 +417,7 @@
 	    {
 	      // FIXME: free the mutex
 	      if (parameters.in.size
-		  && tempnode->shmds->shm_segsz < parameters.in.size)
+		  && tempnode->shmds->ds.shm_segsz < parameters.in.size)
 		{
 		  header.error_code = EINVAL;
 		  CloseHandle (token_handle);
@@ -573,7 +573,7 @@
 	  return;
 	}
 
-      shmid_ds *shmtemp = new shmid_ds;
+      cygshmid_ds *shmtemp = new cygshmid_ds;
       if (!shmtemp)
 	{
 	  system_printf ("failed to malloc shm node");
@@ -587,18 +587,13 @@
 	}
 
       /* fill out the node data */
-      shmtemp->shm_perm.cuid = getuid ();
-      shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid;
-      shmtemp->shm_perm.cgid = getgid ();
-      shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid;
-      shmtemp->shm_perm.mode = parameters.in.shmflg & 0x01ff;
-      shmtemp->shm_lpid = 0;
-      shmtemp->shm_nattch = 0;
-      shmtemp->shm_atime = 0;
-      shmtemp->shm_dtime = 0;
-      shmtemp->shm_ctime = time (NULL);
-      shmtemp->shm_segsz = parameters.in.size;
-      *(shmid_ds *) mapptr = *shmtemp;
+      memset(shmtemp, '\0', sizeof(*shmtemp));
+      shmtemp->ds.shm_perm.cuid = shmtemp->ds.shm_perm.uid = getuid ();
+      shmtemp->ds.shm_perm.cgid = shmtemp->ds.shm_perm.gid = getgid ();
+      shmtemp->ds.shm_perm.mode = parameters.in.shmflg & 0x01ff;
+      shmtemp->ds.shm_ctime = time (NULL);
+      shmtemp->ds.shm_segsz = parameters.in.size;
+      *(cygshmid_ds *) mapptr = *shmtemp;
       shmtemp->mapptr = mapptr;
 
       /* no need for InterlockedExchange here, we're serialised by the global mutex */
diff -u -r -x CVS /pack/src/cygwin/HEAD.src/winsup/cygwin/include/sys/ipc.h ./include/sys/ipc.h
--- /pack/src/cygwin/HEAD.src/winsup/cygwin/include/sys/ipc.h	2002-03-05 12:58:21.000000000 +0000
+++ ./include/sys/ipc.h	2002-06-11 00:58:54.000000000 +0100
@@ -9,16 +9,19 @@
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+
+#include <sys/types.h>
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-#ifndef _SYS_IPC_H
-#define _SYS_IPC_H
-
-/* sys/types must be included before sys/ipc.h. We aren't meant to automatically 
- * include it however 
+/*
+ * <sys/types> must be included before <sys/ipc.h>. We aren't meant to
+ * automatically include it however.
  */
 
 struct ipc_perm {
@@ -29,25 +32,27 @@
   mode_t mode;
 }; 
 
-/* the mode flags used with the _get functions use the low order 9 bits for a mode 
- * request
+/*
+ * The mode flags used with the _get functions use the low order 9
+ * bits for a mode request.
  */
 #define IPC_CREAT  0x0200
 #define IPC_EXCL   0x0400
 #define IPC_NOWAIT 0x0800
 
-/* this is a value that will _never_ be a valid key from ftok */
-#define IPC_PRIVATE -2
-
-/* ctl commands 1000-1fff is ipc reserved */
-#define IPC_RMID 0x1003
-#define IPC_SET  0x1002
-#define IPC_STAT 0x1001
+/* This is a value that will _never_ be a valid key from ftok(3). */
+#define IPC_PRIVATE ((key_t) -2)
 
-key_t ftok(const char *, int);
+/* xxxctl(2) commands 1000-1fff is ipc reserved */
+#define IPC_RMID 0x1000
+#define IPC_SET  0x1001
+#define IPC_STAT 0x1002
+#define IPC_INFO 0x1003		/* For ipcs(8). */
 
-#endif /* _SYS_IPC_H */
+key_t ftok(const char * path, int id);
 
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* _SYS_IPC_H */
diff -u -r -x CVS /pack/src/cygwin/HEAD.src/winsup/cygwin/include/sys/shm.h ./include/sys/shm.h
--- /pack/src/cygwin/HEAD.src/winsup/cygwin/include/sys/shm.h	2002-02-28 14:30:38.000000000 +0000
+++ ./include/sys/shm.h	2002-06-11 00:58:54.000000000 +0100
@@ -9,25 +9,67 @@
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#include <sys/ipc.h>
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
-
-#include <sys/ipc.h>
+/*
+ * 64 Kb was hardcoded for x86. MS states this may change, but we need
+ * it in the header file.
+ */
+#define SHMLBA 65536
 
-#define SHM_RDONLY 1
-/* 64 Kb was hardcoded for x86. MS states this may change, but we need it in the header
- * file.
+/*
+ * Values for the shmflg argument to shmat(2).
  */
-#define SHMLBA     65536
-#define SHM_RND	   1
+#define SHM_RDONLY 0x01		/* Attach read-only, not read/write. */
+#define SHM_RND    0x02		/* Round shmaddr down to multiple of SHMLBA. */
+
+/* xxxctl(2) commands 4000-4fff are reserved for shmctl(2). */
+#define SHM_STAT   0x4000	/* For ipcs(8) */
 
 typedef long int shmatt_t;
 
+struct shmid_ds {
+  struct ipc_perm shm_perm;
+  size_t          shm_segsz;
+  pid_t           shm_lpid;
+  pid_t           shm_cpid;
+  shmatt_t        shm_nattch;
+  time_t          shm_atime;
+  long            shm_spare1;
+  time_t          shm_dtime;
+  long            shm_spare2;
+  time_t          shm_ctime;
+  long            shm_spare3;
+  long            shm_spare4[2];
+};
+
+/* Buffer type for shmctl(IPC_INFO, ...); for ipcs(8). */
+struct shminfo {
+  unsigned long shmmax;
+  unsigned long shmmin;
+  unsigned long shmmni;
+  unsigned long shmseg;
+  unsigned long shmall;
+  unsigned long shm_spare[4];
+};
+
+void *shmat(int shmid, const void *shmaddr, int shmflg);
+int   shmctl(int shmid, int cmd, struct shmid_ds *buf);
+int   shmdt(const void *shmaddr);
+int   shmget(key_t key, size_t size, int shmflg);
+
+#ifdef __cplusplus
+}
+#endif
+
 #if defined(__INSIDE_CYGWIN__) && defined(__cplusplus)
 
 class _shmattach {
@@ -37,22 +79,15 @@
   class _shmattach *next;
 };
 
-class shmid_ds {
+class cygshmid_ds {
 public:
-  struct   ipc_perm shm_perm;
-  size_t   shm_segsz;
-  pid_t    shm_lpid;
-  pid_t    shm_cpid;
-  shmatt_t shm_nattch;
-  time_t   shm_atime;
-  time_t   shm_dtime;
-  time_t   shm_ctime;
+  struct shmid_ds ds;
   void *mapptr;
 };
 
 class shmnode {
 public:
-  class shmid_ds * shmds;
+  class cygshmid_ds * shmds;
   int shm_id;
   class shmnode *next;
   key_t key;
@@ -61,29 +96,6 @@
   class _shmattach *attachhead;
 };
 
-#else
-/* this is what we return when queried. It has no bitwise correspondence
- * the internal structures 
- */
-struct shmid_ds {
-  struct   ipc_perm shm_perm;
-  size_t   shm_segsz;
-  pid_t    shm_lpid;
-  pid_t    shm_cpid;
-  shmatt_t shm_nattch;
-  time_t   shm_atime;
-  time_t   shm_dtime;
-  time_t   shm_ctime;
-};
 #endif /* __INSIDE_CYGWIN__ */
 
-void *shmat(int, const void *, int);
-int   shmctl(int, int, struct shmid_ds *);
-int   shmdt(const void *);
-int   shmget(key_t, size_t, int);
-
 #endif /* _SYS_SHM_H */
-
-#ifdef __cplusplus
-}
-#endif
diff -u -r -x CVS /pack/src/cygwin/HEAD.src/winsup/cygwin/shm.cc ./shm.cc
--- /pack/src/cygwin/HEAD.src/winsup/cygwin/shm.cc	2002-06-06 21:35:34.000000000 +0100
+++ ./shm.cc	2002-06-11 00:49:33.000000000 +0100
@@ -98,7 +98,7 @@
 
   /* Now get the user data */
   HANDLE attachmap = hattachmap;
-  shmid_ds *shmtemp = new shmid_ds;
+  cygshmid_ds *shmtemp = new cygshmid_ds;
   if (!shmtemp)
     {
       system_printf ("failed to malloc shm node\n");
@@ -111,7 +111,7 @@
     }
 
   /* get the system node data */
-  *shmtemp = *(shmid_ds *) mapptr;
+  *shmtemp = *(cygshmid_ds *) mapptr;
 
   /* process local data */
   shmnode *tempnode = new shmnode;
@@ -176,7 +176,7 @@
 			 tempnode);
 	  return 1;
 	}
-      tempnode->shmds = (class shmid_ds *) newshmds;
+      tempnode->shmds = (class cygshmid_ds *) newshmds;
       tempnode->shmds->mapptr = newshmds;
       _shmattach *attachnode = tempnode->attachhead;
       while (attachnode)
@@ -256,7 +256,7 @@
 
     }
 
-  // class shmid_ds *shm = tempnode->shmds;
+  // class cygshmid_ds *shm = tempnode->shmds;
 
   if (shmaddr)
     {
@@ -384,21 +384,14 @@
   switch (cmd)
     {
     case IPC_STAT:
-      buf->shm_perm = tempnode->shmds->shm_perm;
-      buf->shm_segsz = tempnode->shmds->shm_segsz;
-      buf->shm_lpid = tempnode->shmds->shm_lpid;
-      buf->shm_cpid = tempnode->shmds->shm_cpid;
-      buf->shm_nattch = tempnode->shmds->shm_nattch;
-      buf->shm_atime = tempnode->shmds->shm_atime;
-      buf->shm_dtime = tempnode->shmds->shm_dtime;
-      buf->shm_ctime = tempnode->shmds->shm_ctime;
+      *buf = tempnode->shmds->ds;
       break;
     case IPC_RMID:
       {
 	/* TODO: check permissions. Or possibly, the daemon gets to be the only
 	 * one with write access to the memory area?
 	 */
-	if (tempnode->shmds->shm_nattch)
+	if (tempnode->shmds->ds.shm_nattch)
 	  system_printf
 	    ("call to shmctl with cmd= IPC_RMID when memory area still has"
 	     " attachees\n");
@@ -482,7 +475,7 @@
       if (tempnode->key == key && key != IPC_PRIVATE)
 	{
 	  // FIXME: free the mutex
-	  if (size && tempnode->shmds->shm_segsz < size)
+	  if (size && tempnode->shmds->ds.shm_segsz < size)
 	    {
 	      set_errno (EINVAL);
 	      return -1;
@@ -549,7 +542,7 @@
   shmtemp->shm_dtime = 0;
   shmtemp->shm_ctime = time (NULL);
   shmtemp->shm_segsz = size;
-  *(shmid_ds *) mapptr = *shmtemp;
+  *(cygshmid_ds *) mapptr = *shmtemp;
   shmtemp->filemap = filemap;
   shmtemp->attachmap = attachmap;
   shmtemp->mapptr = mapptr;
