Re: loading kext from a daemon program
Re: loading kext from a daemon program
- Subject: Re: loading kext from a daemon program
- From: "Justin C. Walker" <email@hidden>
- Date: Thu, 4 May 2006 13:05:31 -0700
On May 4, 2006, at 12:46 , Rob Crawford wrote:
I exe call that I made was:
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.
Yup; that is exactly what happens.
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.
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden