Re: [PATCH 12/13] maps: Add /proc/pid/pagemap interface

Nikita Danilov
2007-04-04T11:32:30Z

Matt Mackall writes:
> Add /proc/pid/pagemap interface
>
> This interface provides a mapping for each page in an address space to
> its physical page frame number, allowing precise determination of what
> pages are mapped and what pages are shared between processes.

[...]

>
> +#ifdef CONFIG_PROC_PAGEMAP
> +struct pagemapread {
> + struct mm_struct *mm;
> + unsigned long next;
> + unsigned long *buf;
> + unsigned long pos;
> + size_t count;
> + int index;
> + char __user *out;
> +};
> +
> +static int flush_pagemap(struct pagemapread *pm)
> +{
> + int n = min(pm->count, pm->index * sizeof(unsigned long));
> + if (copy_to_user(pm->out, pm->buf, n))
> + return -EFAULT;

This pushes binary data to the user space. Wasn't /proc supposed to be
ascii-based to avoid compatibility problems (e.g., size of unsigned long
changing, endianness, etc.)?

Nikita.