Re: [PATCH,preliminary] cleanup shm handling

From: Christoph Rohland (cr@sap.com)
Date: Wed Dec 13 2000 - 08:52:23 EST


Hi David,

On Wed, 13 Dec 2000, David Howells wrote:
>>> I'm currently writing a Win32 emulation kernel module to help
>>> speed Wine up,
> ^^^^^^^^^^^^^
>> fd = shm_open ("xxx",...)
>> ptr = mmap (NULL, size, ..., fd, offset);
>
> I am doing this from within kernel space. I'd like to avoid doing
> the full open and mmap if possible. I was wondering if there're some
> shortcuts I could make use of.

There will be a

struct file *shmem_file_setup(char * name, loff_t size)

which gives you an open sruct file to an unlinked file of size
size. You can then do

down(&current->mm->mmap_sem);
user_addr = (void *) do_mmap (file, addr, size, prot, flags, 0);
up(&current->mm->mmap_sem);

with that struct file. You can look at shmget/shmat in ipc/shm.c. They
use the same procedure form kernel space.

All this will only work with my patch.

Greetings
                Christoph

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



This archive was generated by hypermail 2b29 : Fri Dec 15 2000 - 21:00:26 EST