Re: Why don't we make mmap MAP_SHARED with /dev/zero possible?

Christoph Rohland
1999-10-26T07:35:45Z

fxzhang <fxzhang@chpc.ict.ac.cn> writes:

> and find this:
> /usr/src/linux/drivers/char/mem.c static int mmap_zero(struct file *
> file, struct vm_area_struct * vma) {
> if (vma->vm_flags & VM_SHARED)
> return -EINVAL;
>
> I don't understand why people don't implement it.Yes,in the source,I
> find something like "the shared case is complex",Could someone tell me
> what's the difficulty?As it is a driver,I think it should not be too
> much to concern.At least I know in Solaris this works.
> I want to implement it but know I am not competent now,I am just
> beginning digging it:).

Yes I would like to see it also, but at least in 2.0 days it was
really difficult/impossible.

> Is there any good way to share memory between process at page
> granularity?That is,I can share individual pages between them? Threads
> maybe a subtitue,but there are many things that I don't want to share.

Using SYSV shm with key IPC_PRIVATE gives you the same behaviour.

Greetings
Christoph