Index: ext2fs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/ChangeLog,v
retrieving revision 1.90
diff -u -p -r1.90 ChangeLog
--- ext2fs/ChangeLog	12 Jul 2005 15:29:22 -0000	1.90
+++ ext2fs/ChangeLog	13 Jul 2005 21:27:57 -0000
@@ -1,3 +1,13 @@
+2005-07-13  Marcus Brinkmann  <marcus@gnu.org>
+	
+	* pager.c: Include <sys/stat.h>.
+	(pager_clear_user_data) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+	(diskfs_get_filemap) [S_IMMAP0]: Clear the S_IMMAP0 flag in the
+	node's stat mode after creating the pager.
+	* inode.c (read_node) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+
 2005-07-12  Marcus Brinkmann  <marcus@gnu.org>
 
 	* pager.c (diskfs_get_filemap): Initialize upi->max_prot to PROT.
Index: ext2fs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/inode.c,v
retrieving revision 1.62
diff -u -p -r1.62 inode.c
--- ext2fs/inode.c	8 Oct 2002 23:10:09 -0000	1.62
+++ ext2fs/inode.c	13 Jul 2005 21:27:57 -0000
@@ -259,6 +259,11 @@ read_node (struct node *np)
       np->author_tracks_uid = 1;
     }
 
+#ifdef S_IMMAP0
+  /* We start out with no map users.  */
+  st->st_mode |= S_IMMAP0;
+#endif
+
   /* Setup the ext2fs auxiliary inode info.  */
   info->i_dtime = di->i_dtime;
   info->i_flags = di->i_flags;
Index: ext2fs/pager.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/pager.c,v
retrieving revision 1.74
diff -u -p -r1.74 pager.c
--- ext2fs/pager.c	12 Jul 2005 15:29:22 -0000	1.74
+++ ext2fs/pager.c	13 Jul 2005 21:28:03 -0000
@@ -20,6 +20,7 @@
 
 #include <string.h>
 #include <errno.h>
+#include <sys/stat.h>
 #include <hurd/store.h>
 #include "ext2fs.h"
 
@@ -751,6 +752,16 @@ pager_clear_user_data (struct user_pager
 	upi->node->dn->pager = 0;
       spin_unlock (&node_to_page_lock);
 
+#ifdef S_IMMAP0
+      {
+	struct node *np;
+	np = upi->node;
+	mutex_lock (&np->lock);
+	np->dn_stat.st_mode |= S_IMMAP0;
+	mutex_unlock (&np->lock);
+      }
+#endif
+
       diskfs_nrele_light (upi->node);
     }
 
@@ -823,6 +834,9 @@ diskfs_get_filemap (struct node *node, v
 	      spin_unlock (&node_to_page_lock);
 	      return MACH_PORT_NULL;
 	    }
+#ifdef S_IMMAP0
+	  node->dn_stat.st_mode &= ~S_IMMAP0;
+#endif
 
 	  right = pager_get_port (node->dn->pager);
 	  ports_port_deref (node->dn->pager);
Index: fatfs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/ChangeLog,v
retrieving revision 1.12
diff -u -p -r1.12 ChangeLog
--- fatfs/ChangeLog	12 Jul 2005 15:29:22 -0000	1.12
+++ fatfs/ChangeLog	13 Jul 2005 21:28:03 -0000
@@ -1,3 +1,13 @@
+2005-07-13  Marcus Brinkmann  <marcus@gnu.org>
+	
+	* pager.c: Include <sys/stat.h>.
+	(pager_clear_user_data) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+	(diskfs_get_filemap) [S_IMMAP0]: Clear the S_IMMAP0 flag in the
+	node's stat mode after creating the pager.
+	* inode.c (read_node) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+
 2005-07-12  Marcus Brinkmann  <marcus@gnu.org>
 
 	* pager.c (diskfs_get_filemap): Initialize upi->max_prot to PROT.
Index: fatfs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/inode.c,v
retrieving revision 1.5
diff -u -p -r1.5 inode.c
--- fatfs/inode.c	6 Aug 2003 21:47:57 -0000	1.5
+++ fatfs/inode.c	13 Jul 2005 21:28:08 -0000
@@ -379,6 +379,11 @@ read_node (struct node *np, vm_address_t
   if (dr->attribute & FAT_DIR_ATTR_RDONLY)
     st->st_mode &= ~0222;
 
+#ifdef S_IMMAP0
+  /* We start out with no map users.  */
+  st->st_mode |= S_IMMAP0;
+#endif
+
   {
     struct timespec ts;
     fat_to_epoch (dr->write_date, dr->write_time, &ts);
Index: fatfs/pager.c
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/pager.c,v
retrieving revision 1.4
diff -u -p -r1.4 pager.c
--- fatfs/pager.c	12 Jul 2005 15:29:22 -0000	1.4
+++ fatfs/pager.c	13 Jul 2005 21:28:11 -0000
@@ -20,6 +20,7 @@
 
 #include <string.h>
 #include <hurd/store.h>
+#include <sys/stat.h>
 #include "fatfs.h"
 
 /* A ports bucket to hold pager ports.  */
@@ -730,6 +731,16 @@ pager_clear_user_data (struct user_pager
 	upi->node->dn->pager = 0;
       spin_unlock (&node_to_page_lock);
       
+#ifdef S_IMMAP0
+      {
+	struct node *np;
+	np = upi->node;
+	mutex_lock (&np->lock);
+	np->dn_stat.st_mode |= S_IMMAP0;
+	mutex_unlock (&np->lock);
+      }
+#endif
+
       diskfs_nrele_light (upi->node);
     }
   
@@ -802,6 +813,9 @@ diskfs_get_filemap (struct node *node, v
               spin_unlock (&node_to_page_lock);
               return MACH_PORT_NULL;
             }
+#ifdef S_IMMAP0
+	  node->dn_stat.st_mode &= ~S_IMMAP0;
+#endif
 
           right = pager_get_port (node->dn->pager);
           ports_port_deref (node->dn->pager);
Index: isofs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/isofs/ChangeLog,v
retrieving revision 1.38
diff -u -p -r1.38 ChangeLog
--- isofs/ChangeLog	23 Feb 2005 00:00:34 -0000	1.38
+++ isofs/ChangeLog	13 Jul 2005 21:28:11 -0000
@@ -1,3 +1,13 @@
+2005-07-13  Marcus Brinkmann  <marcus@gnu.org>
+
+	* pager.c: Include <sys/stat.h>.
+	(pager_clear_user_data) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+	(diskfs_get_filemap) [S_IMMAP0]: Clear the S_IMMAP0 flag in the
+	node's stat mode after creating the pager.
+	* inode.c (read_disknode) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+
 2005-02-23  Alfred M. Szmidt  <ams@gnu.org>
 
 	* Makefile (iso9660fs.static): New target.
Index: isofs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/isofs/inode.c,v
retrieving revision 1.16
diff -u -p -r1.16 inode.c
--- isofs/inode.c	6 Aug 2002 12:33:17 -0000	1.16
+++ isofs/inode.c	13 Jul 2005 21:28:17 -0000
@@ -407,6 +407,11 @@ read_disknode (struct node *np, struct d
   if (rl->valid & VALID_MD)
     st->st_mode = rl->allmode;
 
+#ifdef S_IMMAP0
+  /* We start out with no map users.  */
+  st->st_mode |= S_IMMAP0;
+#endif
+
   if (rl->valid & VALID_AU)
     st->st_author = rl->author;
   else
Index: isofs/pager.c
===================================================================
RCS file: /cvsroot/hurd/hurd/isofs/pager.c,v
retrieving revision 1.6
diff -u -p -r1.6 pager.c
--- isofs/pager.c	7 Jan 2001 17:06:26 -0000	1.6
+++ isofs/pager.c	13 Jul 2005 21:28:17 -0000
@@ -20,6 +20,7 @@
 
 #include <error.h>
 #include <string.h>
+#include <sys/stat.h>
 #include "isofs.h"
 
 spin_lock_t node2pagelock = SPIN_LOCK_INITIALIZER;
@@ -115,6 +116,17 @@ pager_clear_user_data (struct user_pager
       if (upi->np->dn->fileinfo == upi)
 	upi->np->dn->fileinfo = 0;
       spin_unlock (&node2pagelock);
+
+#ifdef S_IMMAP0
+      {
+	struct node *np;
+	np = upi->np;
+	mutex_lock (&np->lock);
+	np->dn_stat.st_mode |= S_IMMAP0;
+	mutex_unlock (&np->lock);
+      }
+#endif
+
       diskfs_nrele_light (upi->np);
     }
   free (upi);
@@ -177,6 +189,10 @@ diskfs_get_filemap (struct node *np, vm_
 	    return MACH_PORT_NULL;
 	  }
 	np->dn->fileinfo = upi;
+#ifdef S_IMMAP0
+	np->dn_stat.st_mode &= ~S_IMMAP0;
+#endif
+
 	right = pager_get_port (np->dn->fileinfo->p);
 	ports_port_deref (np->dn->fileinfo->p);
       }
Index: tmpfs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/tmpfs/ChangeLog,v
retrieving revision 1.26
diff -u -p -r1.26 ChangeLog
--- tmpfs/ChangeLog	20 Mar 2005 02:21:31 -0000	1.26
+++ tmpfs/ChangeLog	13 Jul 2005 21:28:31 -0000
@@ -1,3 +1,10 @@
+2005-07-13  Marcus Brinkmann  <marcus@gnu.org>
+
+	* node.c (diskfs_cached_lookup) [S_IMMAP0]: Set the S_IMMAP0 flag
+	in the node's stat mode.
+	(diskfs_get_filemap) [S_IMMAP0]: Clear the S_IMMAP0 flag in the
+	node's stat mode after creating the pager.
+
 2005-03-20  Marcus Brinkmann  <marcus@gnu.org>
 
 	* tmpfs.c (parse_opt): Use the right argument for parsing the
Index: tmpfs/node.c
===================================================================
RCS file: /cvsroot/hurd/hurd/tmpfs/node.c,v
retrieving revision 1.12
diff -u -p -r1.12 node.c
--- tmpfs/node.c	11 Jun 2002 21:40:50 -0000	1.12
+++ tmpfs/node.c	13 Jul 2005 21:28:31 -0000
@@ -196,6 +196,10 @@ diskfs_cached_lookup (ino_t inum, struct
 
       st->st_size = dn->size;
       st->st_mode = dn->mode;
+#ifdef S_IMMAP0
+      /* We start out with no map users.  */
+      st->st_mode |= S_IMMAP0;
+#endif
       st->st_nlink = dn->nlink;
       st->st_uid = dn->uid;
       st->st_author = dn->author;
@@ -496,6 +500,13 @@ diskfs_get_filemap (struct node *np, vm_
 	  return MACH_PORT_NULL;
 	}
       assert (np->dn->u.reg.memobj != MACH_PORT_NULL);
+#ifdef S_IMMAP0
+      /* We clear the "no user has mapping" bit here.  Unfortunately,
+	 we can never reset it, as we don't get notified when the
+	 users go away (and neither will the default pager).  XXX  */
+      np->dn_stat.st_mode &= ~S_IMMAP0;
+#endif
+
       /* A new-fangled default pager lets us prevent user accesses
 	 past the specified size of the file.  */
       err = default_pager_object_set_size (np->dn->u.reg.memobj,
Index: ufs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/ChangeLog,v
retrieving revision 1.47
diff -u -p -r1.47 ChangeLog
--- ufs/ChangeLog	4 Oct 2002 20:55:55 -0000	1.47
+++ ufs/ChangeLog	13 Jul 2005 21:28:43 -0000
@@ -1,3 +1,13 @@
+2005-07-13  Marcus Brinkmann  <marcus@gnu.org>
+
+	* pager.c: Include <sys/stat.h>.
+	(pager_clear_user_data) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+	(diskfs_get_filemap) [S_IMMAP0]: Clear the S_IMMAP0 flag in the
+	node's stat mode after creating the pager.
+	* inode.c (read_disknode) [S_IMMAP0]: Set the S_IMMAP0 flag in the
+	node's stat mode.
+
 2002-10-03  Roland McGrath  <roland@frob.com>
 
 	* dir.h (MAXNAMLEN): #undef before defining.
Index: ufs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/inode.c,v
retrieving revision 1.59
diff -u -p -r1.59 inode.c
--- ufs/inode.c	11 Jun 2002 21:41:06 -0000	1.59
+++ ufs/inode.c	13 Jul 2005 21:28:43 -0000
@@ -229,6 +229,10 @@ read_disknode (struct node *np)
 		   | (read_disk_entry (di->di_modeh) << 16))
 		  & ~S_ITRANS)
 		 | (di->di_trans ? S_IPTRANS : 0));
+#ifdef S_IMMAP0
+  /* We start out with no map users.  */
+  st->st_mode |= S_IMMAP0;
+#endif
   st->st_nlink = read_disk_entry (di->di_nlink);
   st->st_size = read_disk_entry (di->di_size);
 #ifdef notyet
Index: ufs/pager.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/pager.c,v
retrieving revision 1.48
diff -u -p -r1.48 pager.c
--- ufs/pager.c	13 Sep 1999 06:35:07 -0000	1.48
+++ ufs/pager.c	13 Jul 2005 21:28:46 -0000
@@ -19,6 +19,7 @@
 #include <strings.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <sys/stat.h>
 #include <hurd/store.h>
 
 spin_lock_t node2pagelock = SPIN_LOCK_INITIALIZER;
@@ -456,6 +457,17 @@ pager_clear_user_data (struct user_pager
       if (upi->np->dn->fileinfo == upi)
 	upi->np->dn->fileinfo = 0;
       spin_unlock (&node2pagelock);
+
+#ifdef S_IMMAP0
+      {
+	struct node *np;
+	np = upi->np;
+	mutex_lock (&np->lock);
+	np->dn_stat.st_mode |= S_IMMAP0;
+	mutex_unlock (&np->lock);
+      }
+#endif
+
       diskfs_nrele_light (upi->np);
     }
   free (upi);
@@ -579,6 +591,10 @@ diskfs_get_filemap (struct node *np, vm_
 	    return MACH_PORT_NULL;
 	  }
 	np->dn->fileinfo = upi;
+#ifdef S_IMMAP0
+	np->dn_stat.st_mode &= ~S_IMMAP0;
+#endif
+
 	right = pager_get_port (np->dn->fileinfo->p);
 	ports_port_deref (np->dn->fileinfo->p);
       }
