about sys_call and ioctl
about sys_call and ioctl
- Subject: about sys_call and ioctl
- From: yetty <email@hidden>
- Date: Mon, 19 Apr 2004 23:11:53 +0900
Dear sir,
I know that there are two ways to access kernel of Linux. One way is
to use funstions of open and ioctl. The following is part of the driver
for pcmcia
/*This part is in kernel space and register a driver named "pcmcia"*/
......
static struct file_operations ds_fops={
.owner=THIS_MODULE;
.open=ds_open,
.release=ds_release,
ioctl=ds_ioctl,
read=ds_read,
write=ds_write,
poll=ds_poll,
}
......
register_chrdev(0, "pcmcia", &ds_fops)
/*This part is in user space and access pcmcia*/
fd=open("/dev/pcmcia",...);/*open the device*/
ioctl(fd,...,...);/*control the device*/
question 1: Can I register my driver in the kernel and then access the
kernel in Mac OS X like that?
And another way is to use system call.
In linux ,I can write a kernel extension called my_kerneltest like this:
int my_kerneltest(const char *path)
{
return 0;
}
int init_module(void)
{
sys_call_table[SYS_kerneltest]=my_kerneltest;
return 0;
}
void cleanup_module(void)
{
......
}
And in user space ,I can use my kernel with function of my_kerneltest()
question2:Can I create my system call in the kernel and use it in user
space in Mac OS X like that?
Thank you!
Yours Sincerely
Ye Wenxi in Tokyo
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.