Re: How can I communicate between user/kernel programs?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-filter: OpenDKIM Filter v2.10.3 mail.lundman.net 0A1F611CFE7 Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=lundman.net; s=dkim; t=1492040933; bh=b2TNiodez76PlBGvYXXAvrl1dAVh004BocYGkIIGA7E=; h=Subject:To:References:From:Date:In-Reply-To; b=rHPzXvVnn8ZGV9NSoe+R+0y8RqAJeT2C2QtvpP3rW6ILxORUFSk7lAgEAF/KfSTm6 bPlpVZipKLJYRNG9ISwQ3zW1F2RQD4WcCrrCt9zhKRv66HbFTVDqfd9BBftLkLwsV2 Y4TPfFhpw66GEGLpaEFxdOSa4+IpMwwRcO7A7mTE= User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 In traditional Unix this was done with ioctl(), where you would make up your own ioctl number, and struct*/length to pass to kernel, and/or have kernel fill in the data. Kernel uses copyin()/copyout() to cross the userland/kernel memory access barrier. (Not on OsX, the XNU kernel does copyin/copyout for you, on the "main" pointer passed through). So if you meant the literal string "bus_speed" and getting back an integer, it is what it was designed for, and very portable. For short queries of small to moderate size. If you mean you want to do communication at "bus speeds", then what Quinn recommends is better, for high speed and large buffers. Lund Major Tom wrote:
Hi, everyone. I'm a newbie to mac kernel.
Recently I decided to develop a kext to support interprocess communication.
Let's say a user-space program sending operation string to kext. And kext received the message and reply corresponding result to user-space program.
Given a real life example is that, a user-space program sending "bus_speed" to kext. When kext received the message, it sending the bus speed result of current machine back to user-space program.
Which it's a full-round communication.
Can anyone here figure out what mechanism should I use to do this job? What communication mechanism should best suit in such case?
Thanks all you guys. :-D
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/lundman%40lundman.net
This email sent to lundman@lundman.net
-- Jorgen Lundman | <lundman@lundman.net> Unix Administrator | +81 (0)90-5578-8500 Shibuya-ku, Tokyo | Japan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jorgen Lundman