kern_control questions
kern_control questions
- Subject: kern_control questions
- From: Stephane Sudre <email@hidden>
- Date: Thu, 18 Nov 2004 16:39:28 +0100
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