Re: preferable way to control kernel module

From: Sergey Uvarov (uvarovsl_at_mail.pnpi.spb.ru)
Date: 08/10/05

  • Next message: alexander: "Re: Using sysarch specific syscalls in assembly?"
    Date: Thu, 11 Aug 2005 01:50:44 +0400
    To: John Baldwin <jhb@freebsd.org>
    
    

    >>>>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.
    >

    Thank you for advise. But I wonder: what is wrong with syscall approach
    (via SYSCALL_MODULE macro)?

    Thanks again,
            Sergey.
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: alexander: "Re: Using sysarch specific syscalls in assembly?"

    Relevant Pages

    • Re: [take14 0/3] kevent: Generic event handling mechanism.
      ... so it is not that bad to multiplex them in one syscall. ... Think about size of the mapped buffer when there are several kevent ... feel, that all posix crap is better than epoll interface, then I can not ...
      (Linux-Kernel)
    • Re: [take24 0/6] kevent: Generic event handling mechanism.
      ... for the latest stable lighttpd version and test it with kevent. ... This is as far as the kernel is concerned. ... How should it know which syscall should be interrupted when special syscall ... keep the interface as small as possible. ...
      (Linux-Kernel)
    • Re: Extended error reporting to user space?
      ... while syscall is running, may be filled with printf-style routines, ... This will give driver writers a common interface for extended error ... Text lookups in userspace (easy to do with existing ... ability of some OS systems to report "It worked but ....." ...
      (Linux-Kernel)
    • Re: linux-next: add utrace tree
      ... have a common VFS interface because we want to show _one_ interface to ... Everybody agrees that ptrace() is horrible and a royal pain to use, ... I believe that "utrace" is the kernel side of that API. ... If utrace was a 'better ptrace' syscall, where the syscall itself is the goal ...
      (Linux-Kernel)
    • Re: sched_setaffinity usability
      ... Exporting variables is never a good idea. ... The interface is inflexible. ... In the vdso the kernel can decide at boot time which functions to ... Even if it is not possible to implement the entire syscall at userlevel, ...
      (Linux-Kernel)