Well, without code examples, it would be difficult for me to diagnose your
problem exactly. However, I can say that your messages seems to be
implying a belief that with regd mbuffs, kernel addresses become user
addresses, which is not true. Let's say an mbuff at address 0x400000, when
accessed in user mode, will have a virtual address of something like say
0x80000 (these are just examples). There is no address correlation between
the mbuff as it appears in user mode and the mbuff as it appears in kernel
mode. However, the contents of the memory ARE shared and as such, the
problems you are experiencing can't be easily diagnosed. Can you show me
your code?
Generally the order of events in your code should be:
In Kernel:
1) Allocate memory using mbuff_alloc() and assign it to your
structure/array/variable pointer. Make sure to name the memory something
userland knows about.
2) Initialize the memory
In userLand:
1) mbuff_attach() to the required memory (by name). Assign resulting
pointer to your structure/array/variable pointer.
2) Use the memory.
As long as you are checking for error conditions in your code (NULL return
values, etc.) the above should work 100% of the time.
-Calin
On Mon, 10 Sep 2001, MIDATANA,RAVI-KUMAR (HP-India,ex2) wrote:
>
>
> Hi all,
> I am facing a problem using mbuff. I dont want to use this mbuff
> extensively but just a 5-6 bbytes of information to be passed from kernel
> space to user space. For all other data communication I am using rt-fifo (as
> my application needs are more suitable for using rt-fifos) and they are
> working fine. I just want to get a free rt-fifo and pass this number to user
> space so that user space module can start communicating with kernel module
> using that RTfifo. To send this fifo number to user space I thought of using
> shared memory. ( I can not just simply use some RTFIFO predefined hard coded
> in both the modules, since it might be used by some other processes/modules
> and I cannot destroy this and cause problems to other modules)
>
> Hence, I thought of using mbuff ( other than mbuff, I have other option
> like, assign some memory in /etc/lilo.conf and using that address I can
> access the shared memory from both the kernel and user side - but this is
> not advisable in my application as this requires a bit setup and calcuation
> is required before loading my module).
> I am assigning the memory using mbuff_alloc() on both sides with same amount
> of memory chunk requested. say 0x100000. I am writing into this space from
> kernel module and this will wait and I am starting the user application
> which uses the same call mbuff_alloc to allocate the memory with the same
> chunk (0x100000) requested.(I assume that both the pointers now are pointing
> to same memory location - Am I correct ? ) I am trying to read the data from
> the mbuff allocated pointer. But the data read is different than the data
> written in kernel module.
> Does anyone have idea about where I am going wrong. And, I would like to
> know how is /dev/mbuff device file related to this. My system is kernel
> 2.2.18 and rtl3.0
>
> Thanks in advance.
> Ravi Kumar
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>
>
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/