Sfoglia il codice sorgente

NOMMU: Fix SYSV IPC SHM

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

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
David Howells 18 anni fa
parent
commit
2e92a3baee
2 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 6 1
      fs/ramfs/file-nommu.c
  2. 2 0
      ipc/shm.c

+ 6 - 1
fs/ramfs/file-nommu.c

@@ -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)
 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;
 }
 }

+ 2 - 0
ipc/shm.c

@@ -268,7 +268,9 @@ static int shm_mmap(struct file * file, struct vm_area_struct * vma)
 	if (ret != 0)
 	if (ret != 0)
 		return ret;
 		return ret;
 	sfd->vm_ops = vma->vm_ops;
 	sfd->vm_ops = vma->vm_ops;
+#ifdef CONFIG_MMU
 	BUG_ON(!sfd->vm_ops->fault);
 	BUG_ON(!sfd->vm_ops->fault);
+#endif
 	vma->vm_ops = &shm_vm_ops;
 	vma->vm_ops = &shm_vm_ops;
 	shm_open(vma);
 	shm_open(vma);