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: Bsd sockets in a kext



Hi --

The best (and easiest )way to do this is to use messageClients() in your kext and have your daemon register for notifications using functions such as IOServiceAddInterestNotification(). Make sure to call registerService() in your start routine so that you can find your object in the registry.

The daemon can wrap the IONotificationPort in a CFMachPort and add it to the runloop.

-- Chris

On Friday, March 8, 2002, at 10:22 AM, Shantonu Sen wrote:

I'm not sure this is the way to go for such a small amount of data. When this has been asked about before, it was suggested that the daemon connect to your kext via the IOUserClient mechanism and repeatedly wait for it to send back input. This is essentially a pull instead of push process.

If your kext only has to launch programs, can you use KUNCExecute?

Shantonu

On Friday, March 8, 2002, at 01:04 PM, Justin C. Walker wrote:

Hi, Stephane,

On Friday, March 8, 2002, at 03:51 AM, Stephane ODUL wrote:

I9m writing a driver to handle multimedia key for a usb keyboard.

My kext need to send message to a user process daemon.

I9ve tried to setup the communication using the bsd sockets. My daemon
compile fine but the when I build the kext I have an error saying functions
like socket() are not declared while <sys/socket.h> is included.

Maybe I9m not using the good solution. Help me I ve been stucked on this for
3 days now.

I'm not sure what the problem is. Are you using 'socket(2)' in the user-space daemon, or in the kext? You can't use user-space calls in the kernel, because the operating environments are completely different.

You will need to use kernel versions of the user-mode calls in your kext. There isn't any good documentation on this, but you can refer to the Wright/Stevens book (TCP/IP Illustrated, V2) for descriptions of the in-kernel code; and you can look at the 'xnu' source from Darwin for examples of this use, in NFS (xnu/bsd/nfs) and in the AURP code (xnu/bsd/netat/aurp*).

This has also been discussed on the Darwin lists, so you might get some good pointers from the archives.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | It's not whether you win or lose...
| It's whether *I* win or lose.
*--------------------------------------*-------------------------------*
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

------------------
6 Infinite Loop
M/S 306-2MS
Cupertino CA 95014
phone: (408) 974-4033
fax: (408) 862-7577
email: email@hidden
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Bsd sockets in a kext (From: Shantonu Sen <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.