Re: kernel headers & userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Selon Jan Hudec <bulb@ucw.cz>:

> > > > struct bank_root_s;
> > > > enum elsa_opcode
> {BANK_INIT,BANK_ALLOC,BANK_FREE,BANK_ADD,BANK_REMOVE};
> > > > 
> > > > /* 
> > > >  * sys_elsa() interface. 
> > > >  *
> > > >  * int sys_elsa(int opcode, unsigned int arg0,
> > > >  *              unsigned int arg1, unsigned int arg2)
> > > >  */
> > > > 
> > > > #ifdef __KERNEL__
>
> I would probably not add a syscall (which must be linked in kernel), but
> use some generic interface on (device or proc) filehandles (ioctl, read,
> write). It is a little more work, but can be done in module and is
> generaly less invasive.

I agree that module is less invasive and easier to use than a patch where you
need to compile a new kernel. I thought about this solution but I can't use it
for the following reason: I want to make accounting with several process. It
means that when a process exit, kernel must write some values in a file and
thus, I need to modify the do_exit() and do_fork() functions in order to use my
structure. If I write a module, I must check if the module is loaded and if not,
do_exit() must do nothing. It's the same with do_fork(), if the module is loaded
I must add the child in corresponding bank, otherwise I do nothing. I don't know
if I can make such test and I think (maybe I'm wrong) that doing this test each
time a process end is not a good solution. Therefore I choose to do it with a
system call. 

I'm very intresting to hear your point of view about the implementation (as
module or as system call). Thank you for your help

Guillaume 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux