Re: loading kext from a daemon program
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On May 4, 2006, at 12:46 , Rob Crawford wrote: I exe call that I made was: Yup; that is exactly what happens. Regards, Justin -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds ----------- I'm beginning to like the cut of his jibberish. ----------- _______________________________________________ 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: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... int result = execlp("kextload", "kextload", "<path to my kext>" (char *)0); this does load the kext but exists my daemon program, I am guessing because of what the documentation says that it replaces the current process image with the new process image. What I need to do is: 1. is the kext loaded? 2. if it's not loaded load the kext and then wait for the result of the load then continue running the daemon. I assume you can handle (1); the trick for (2) is that you need to 'fork()' before calling 'exec()'. This will give you a parent and a child, and depending on exactly what your goals are, either can do the exec (and, as you noticed, exit when done). It may make sense to have the parent call exec(), and have the child continue to execute as the daemon. That way, your child will become a "background" task. As I said, it does depend on your current code and what your goals are. In addition, I will take a leap to the conclusion that programming of this sort is new to you. If so, you might find the book "Advanced Programming in the Unix Environment". by W. Richard Stevens, to be a good investment. It is a bit dated, but it does give you a very good reference for how to do things when programming for a Unix system. There are other books describing the higher-level frameworks and styles for Mac OS X, but if your interest is in the lower layers, Stevens wrote a number of very good books on the subject. This email sent to site_archiver@lists.apple.com
participants (1)
-
Justin C. Walker