Re: /proc/$pid/pagemap troubles

2007-08-01 Thread Dave Hansen
On Tue, 2007-07-31 at 19:14 -0500, Matt Mackall wrote: > On Tue, Jul 31, 2007 at 03:43:10PM -0700, Dave Hansen wrote: > > + evpfn = min((src + count) / sizeof(unsigned long), > > + ((~0UL) >> PAGE_SHIFT) + 1); > > > > Should that hunk of code be any different for 32-bit

Re: /proc/$pid/pagemap troubles

2007-08-01 Thread Dave Hansen
On Tue, 2007-07-31 at 19:14 -0500, Matt Mackall wrote: On Tue, Jul 31, 2007 at 03:43:10PM -0700, Dave Hansen wrote: + evpfn = min((src + count) / sizeof(unsigned long), + ((~0UL) PAGE_SHIFT) + 1); Should that hunk of code be any different for 32-bit processes on

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Matt Mackall
On Tue, Jul 31, 2007 at 03:43:10PM -0700, Dave Hansen wrote: > On Tue, 2007-07-31 at 16:37 -0500, Matt Mackall wrote: > > > > > So, a couple of questions. Don't we need to support > > non-sizeof(unsigned > > > long)-aligned reads? > > > > Why? We should obviously never return more data than we

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
On Wed, 2007-08-01 at 00:58 +0200, Andreas Schwab wrote: > Matt Mackall <[EMAIL PROTECTED]> writes: > > > On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: > >> Since the pagemap code has a little header on it to help describe the > >> format, I wrote a little c program to parse its

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Andreas Schwab
Matt Mackall <[EMAIL PROTECTED]> writes: > On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: >> Since the pagemap code has a little header on it to help describe the >> format, I wrote a little c program to parse its output. I get some >> strange results. If I do this: >> >> fd

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
On Tue, 2007-07-31 at 16:37 -0500, Matt Mackall wrote: > > > So, a couple of questions. Don't we need to support > non-sizeof(unsigned > > long)-aligned reads? > > Why? We should obviously never return more data than we were asked for > (that's clearly a bug), but lots of things refuse to read

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Matt Mackall
On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: > Since the pagemap code has a little header on it to help describe the > format, I wrote a little c program to parse its output. I get some > strange results. If I do this: > > fd = open("/proc/1/pagemap", O_RDONLY); >

/proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
Since the pagemap code has a little header on it to help describe the format, I wrote a little c program to parse its output. I get some strange results. If I do this: fd = open("/proc/1/pagemap", O_RDONLY); count = read(fd, , 1); count will always be 4. hexdump gets

/proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
Since the pagemap code has a little header on it to help describe the format, I wrote a little c program to parse its output. I get some strange results. If I do this: fd = open(/proc/1/pagemap, O_RDONLY); count = read(fd, endianness, 1); count will always be 4. hexdump gets

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Matt Mackall
On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: Since the pagemap code has a little header on it to help describe the format, I wrote a little c program to parse its output. I get some strange results. If I do this: fd = open(/proc/1/pagemap, O_RDONLY); count =

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
On Tue, 2007-07-31 at 16:37 -0500, Matt Mackall wrote: So, a couple of questions. Don't we need to support non-sizeof(unsigned long)-aligned reads? Why? We should obviously never return more data than we were asked for (that's clearly a bug), but lots of things refuse to read or write

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Andreas Schwab
Matt Mackall [EMAIL PROTECTED] writes: On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: Since the pagemap code has a little header on it to help describe the format, I wrote a little c program to parse its output. I get some strange results. If I do this: fd =

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Dave Hansen
On Wed, 2007-08-01 at 00:58 +0200, Andreas Schwab wrote: Matt Mackall [EMAIL PROTECTED] writes: On Tue, Jul 31, 2007 at 01:36:14PM -0700, Dave Hansen wrote: Since the pagemap code has a little header on it to help describe the format, I wrote a little c program to parse its output. I get

Re: /proc/$pid/pagemap troubles

2007-07-31 Thread Matt Mackall
On Tue, Jul 31, 2007 at 03:43:10PM -0700, Dave Hansen wrote: On Tue, 2007-07-31 at 16:37 -0500, Matt Mackall wrote: So, a couple of questions. Don't we need to support non-sizeof(unsigned long)-aligned reads? Why? We should obviously never return more data than we were asked for