On Wednesday 10 August 2005 05:11 pm, Sergey Uvarov wrote: > John Baldwin wrote: > > On Wednesday 10 August 2005 04:29 pm, Sergey Uvarov wrote: > >>Hello hackers, > >> > >>I'm writing a kernel module for my own needs. AFAIK the following > >>methods could be used: > >> > >>1) allocate not used system call with help of SYSCALL_MODULE macro > >> > >>2) allocate proprieatry oid via SYSCTL_OID(OID_AUTO) and write an > >>appropriate sysctl handler(s) > >> > >>3) add a file in /dev and use ioctl(2) call > >> > >>What is a preferable way to control my module? > > > > It depends on what you want to do really. I've used sysctl's for simple > > debug modules where I write to the sysctl to have it perform a desired > > action. > > I need to pass some configuration parameters to my module and retrieve a > status back. Interface is quite similar to ptrace(2) syscall. I don't > need to pass large amount of data.
If it's a single integer or some such, I'd say use sysctl. If it's a structure, I'd go the ioctl(2) route. Creating /dev entries isn't all that hard. In your case you'd just need open/close/ioctl in a cdevsw, then use make_dev() during MOD_LOAD and destroy_dev() during MOD_UNLOAD. -- John Baldwin <[EMAIL PROTECTED]> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"