Skip to contentSkip to conversation

NOMMU: Fix SYSV IPC SHM

PATCH New David Howells 1 participant 1 message Jul 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NOMMU: Fix SYSV IPC SHM

From: David Howells <[email protected]>

Fix the SYSV IPC SHM to work with the changes applied by the new fault handler patches when CONFIG_MMU=n.

---

 fs/ramfs/file-nommu.c |    7 ++++++-
 ipc/shm.c             |    2 ++
 2 files changed, 8 insertions(+), 1 deletions(-)
fs/ramfs/file-nommu.c +6 -1
index cad2b7a..237fe8b 100644
@@ -295,5 +295,10 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
  */
 int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS;
+	if (!(vma->vm_flags & VM_SHARED))
+		return -ENOSYS;
+
+	file_accessed(file);
+	vma->vm_ops = &generic_file_vm_ops;
+	return 0;
 }
ipc/shm.c +2 -0
index d0259e3..d88ac5a 100644
@@ -268,7 +268,9 @@ static int shm_mmap(struct file * file, struct vm_area_struct * vma)
 	if (ret != 0)
 		return ret;
 	sfd->vm_ops = vma->vm_ops;
+#ifdef CONFIG_MMU
 	BUG_ON(!sfd->vm_ops->fault);
+#endif
 	vma->vm_ops = &shm_vm_ops;
 	shm_open(vma);