Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem in sending data between User Space & Kernel Space



JanakiRam,

>I'm passing my custom defined structure from user space to kernel space. If i create the structure member on stack ( i.e char str[15] ="Hello World\0" & data = "" ) , then i'm unable to receive at kernel level.
>But if create memory using malloc then i'm able to access at kernel level.

This is how all nix systems and infact how all OS's will work....

If we forget the kernel space here, and try to run this across two process (process A & B) in user space, you might run into the same problem.....The reason for [might] is because if your call to the function in other process (process B) is synchronous, then the data could be copied over....

But what if they are asynchronous ???

Process A function might reach its completion even before process B gets a chance to receive it...and thus the data on the stack is lost.....
Now if you allocate the same data on the heap using malloc, the data will be available till process A dies....

Now when we jump to kernel space, we always deal asynchronously. Else the entire kernel will be blocked for our application to finish.

I hope you have got it....

Thanks,
Arvind



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Problem in sending data between User Space & Kernel Space (From: JanakiRam <email@hidden>)
 >Re: Problem in sending data between User Space & Kernel Space (From: JanakiRam <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.