bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

providing memory objects to users


From: Marcus Brinkmann
Subject: providing memory objects to users
Date: Tue, 11 Jun 2002 22:23:36 -0400
User-agent: Mutt/1.3.25i

Hi,

I tried today to get the mmap()ed interface to the console clients
working, but with limited success only.

First I tried to use libpager.  This worked out ok, but what I did was
probably wrong.  I allocated anonymous pages in pager_read_page, and
filled those with the display information.  The information could then
be read by the client, allright.  But when I tried to write to the
anonymous pages, those changes weren't visible in the client.  I believe
I misunderstood that, and that the only way to do this would be to map
the memory object again and write to that instead of to the anonymous
pages directly.  Furthermore, I noticed that this version would deadlock
when there were no callers and the kernel tried to swap out the page and
return it to the console server.  I didn't try hard to find out what
went wrong, but I still have the debugging output if you want it.

This made me think of tmpfs, which doesn't use libpager, but the
default pager directly.  This looked appropriate to me.  After all, I
didn't want to have a redundant copy of the data in a backing store or
whatever.  I didn't need to do paging.  And as I don't use libdiskfs, I
don't need to link to libpager at all.  However, this version now
doesn't work at all.  I tried to map in the memory via vm_map, but when
I access it the server just hangs interruptible (it hangs in a similar
way my first version hanged when I didn't have the pager RPCs served).

So, the basic question is, am I on the right track?  Can I use the
default pager for this without worrying about libpager at all?
And how do I do that if it doesn't work as elementary as I show below?
And, btw, why is getting pages from the default server a privileged
operation?  This restricts tmpfs and the console server to the superuser
which is silly.  How can this be solved?

Here the meat of what I did:

  err = default_pager_object_create (default_pager, &display->memobj,
                                       display->allocsize);
  err = vm_map (mach_task_self (), (vm_address_t *) &user,
                display->allocsize,
                0, 1, display->memobj, 0, 0,
                VM_PROT_READ | VM_PROT_WRITE,
                VM_PROT_READ | VM_PROT_WRITE,
                VM_INHERIT_NONE);
                
Thanks,
Marcus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]