summaryrefslogtreecommitdiff
path: root/debian/patches/sysvshm.patch
blob: a64b1da6c97b3ae95f3daa2821e2e24c68565a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
2005-03-09  Marcus Brinkmann  <marcus@flubber>
	
	* pager.c: Include <sys/stat.h>.
	(pager_clear_user_data): Set the S_IMMAP0 flag in the node's stat
	mode.
	(diskfs_get_filemap): Clear the S_IMMAP0 flag in the node's stat
	mode after creating the pager.
	* inode.c (read_node): Set the S_IMMAP0 flag in the node's stat
	mode.

--- ext2fs/inode.c	2005-08-30 17:08:51.000000000 +0200
+++ ext2fs/inode.c.new	2005-08-30 17:09:16.000000000 +0200
@@ -309,7 +309,7 @@
   if (S_ISREG (st->st_mode) || S_ISDIR (st->st_mode)
       || (S_ISLNK (st->st_mode) && st->st_blocks))
     np->allocsize = round_block (np->dn_stat.st_size);
-  else
+  else {
     /* Allocsize should be zero for anything except directories, files, and
        long symlinks.  These are the only things allowed to have any blocks
        allocated as well, although st_size may be zero for any type (cases
@@ -317,6 +317,11 @@
        linux, some devices).  */
     np->allocsize = 0;
 
+#ifdef S_IMMAP0
+    /* We start out with no map users.  */
+    st->st_mode |= S_IMMAP0;
+#endif
+  }
   return 0;
 }
 
--- ext2fs/pager.c	2005-08-30 17:08:51.000000000 +0200
+++ ext2fs/pager.c.new	2005-08-30 17:09:17.000000000 +0200
@@ -21,6 +21,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+#include <sys/stat.h>
 #include <hurd/store.h>
 #include "ext2fs.h"
 
@@ -799,6 +800,9 @@
   if (upi->type == FILE_DATA)
     {
       struct pager *pager;
+#ifdef S_IMMAP0
+      struct node *np;
+#endif
 
       spin_lock (&node_to_page_lock);
       pager = upi->node->dn->pager;
@@ -806,6 +810,13 @@
 	upi->node->dn->pager = 0;
       spin_unlock (&node_to_page_lock);
 
+#ifdef S_IMMAP0
+      np = upi->node;
+      mutex_lock (&np->lock);
+      np->dn_stat.st_mode |= S_IMMAP0;
+      mutex_unlock (&np->lock);
+#endif
+
       diskfs_nrele_light (upi->node);
     }
 
@@ -1251,6 +1262,10 @@
 	      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);
 	}