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

From: Nikita Danilov
Date: Wed Apr 04 2007 - 07:32:44 EST


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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/