From: Nikita Danilov <Nikita@Namesys.COM>

recent change that adds fixmaps to the /proc/<pid>/maps broke
compilation on the UML, because there FIXADDR_USER_{START,END} are not
constant.

This patch adds a function to initialize &gate_vmarea.

(ppc64 also needs this)


---

 25-akpm/fs/proc/task_mmu.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff -puN fs/proc/task_mmu.c~uml-build-fix fs/proc/task_mmu.c
--- 25/fs/proc/task_mmu.c~uml-build-fix	Thu Jan  8 12:13:44 2004
+++ 25-akpm/fs/proc/task_mmu.c	Thu Jan  8 12:13:44 2004
@@ -79,17 +79,27 @@ int task_statm(struct mm_struct *mm, int
 #ifdef AT_SYSINFO_EHDR
 
 static struct vm_area_struct gate_vmarea = {
-	/* Do _not_ mark this area as readable, cuz not the entire range may be readable
-	   (e.g., due to execute-only pages or holes) and the tools that read
-	   /proc/PID/maps should read the interesting bits from the gate-DSO file
-	   instead.  */
-	.vm_start = FIXADDR_USER_START,
-	.vm_end = FIXADDR_USER_END
+	/*
+	 * we cannot initialize fields right here, because on some
+	 * architectures (on UML to be precise), FIXADDR_USER_* are not
+	 * constant. See build_gate_map() below.
+	 */
 };
 
 # define gate_map()	&gate_vmarea
+static inline struct vm_area_struct *build_gate_map(void)
+{
+	/* Do _not_ mark this area as readable, cuz not the entire range may
+	   be readable (e.g., due to execute-only pages or holes) and the
+	   tools that read /proc/PID/maps should read the interesting bits
+	   from the gate-DSO file instead.  */
+	gate_vmarea.vm_start = FIXADDR_USER_START;
+	gate_vmarea.vm_end   = FIXADDR_USER_END;
+	return &gate_vmarea;
+}
 #else
 # define gate_map()	NULL
+# define build_gate_map()	NULL
 #endif
 
 static int show_map(struct seq_file *m, void *v)
@@ -146,7 +156,7 @@ static void *m_start(struct seq_file *m,
 		up_read(&mm->mmap_sem);
 		mmput(mm);
 		if (l == -1)
-			map = gate_map();
+			map = build_gate_map();
 	}
 	return map;
 }

_