lkml.org 
[lkml]   [1996]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mremap() proposal (was Re: malloc and joe)


On Sun, 24 Mar 1996, Snow Cat wrote:
>
> If the mapping grows, what is the content of new pages? Is it always
> MAP_ANON or new sections of the same file that was used for mapping?

Conceptually, mremap() really only extends/shrinks the memory mapping, so
the new pages will be an extension of whatever the old mmap was. In most
cases (at least for the malloc case) this will be a anonymous mapping,
but it's by no means an error to extend any mapping you have created.

Extending a file mapping could potentially be useful if you want to track
a file when it grows, for example. You'd just do something like

addr = mmap(... st.st_size ...)

for the initial mapping, and then when the process notices that the file
has grown (or shrunk), it does a

mremap(addr, old_size, st.st_size)

to be able to read the new pages. A very logical interface, in fact.

Linus


\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.035 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site