Re: kern_control questions
Re: kern_control questions
- Subject: Re: kern_control questions
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 18 Nov 2004 21:51:54 +0100
On Nov 18, 2004, at 20:02, Joshua Graessley wrote:
When you register the kernel control, are you specifying a unit number?
-josh
Yes, 0. I tried after finding a post from Vincent Lubet to set the unit
number again in the user code (it's already set via the bzero AFAIK)
after addr.sc_id= 'XXXX'. But the result was the same as it could be
guessed.
I must confess I'm making my test on a currently unknown cat specie.
On Nov 18, 2004, at 7:39 AM, Stephane Sudre wrote:
2 questions related to kern_control in OS X 10.3.0 or later:
* Can registered IDs used for PF_NKE be used for a kern_control too?
Or is a new registration required?
* I'm using the equivalent of the sample code in the NKE
documentation (without the CTL_FLAG_PRIVILEGED) and the following
code in UserLand:
bzero(&addr, sizeof(addr)); // sets the sc_unit field to 0
addr.sc_len = sizeof(addr);
addr.sc_family = AF_SYSTEM;
addr.ss_sysaddr = AF_SYS_CONTROL;
addr.sc_id = 'XXXX'; // should be unique - use a registered
Creator ID here
fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL);
if (fd)
{
result = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
if (result)
fprintf(stderr, "connect failed %d\n", errno);
}
else
fprintf(stderr, "failed to open socket\n");
if (!result)
{
/*result = setsockopt( fd, SYSPROTO_CONTROL, kEPCommand1, NULL, 0);
if (result)
fprintf(stderr, "setsockopt failed on kEPCommand1 call - result
was %d\n", result);
*/
}
I'm getting a errno 2 (No such file or directory) on the connect
call. Is there something to change in the code showed in the
documentation to make it work?
XXXX is the same value both in the Kernel Extension and UserLand.
The ctl_register call is saying everything is fine in the Kernel
Extenstion.
_______________________________________________
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