How to write a loadable module to handle socket communication



I'm puzzled about how to time the thread's working in kernel
modules.I'm writing a module to improve the lvs(linux virtual serve)
about the load balacncing algorithm using udp socket to get real node's
load info .So I need to send the load info on time repeatly, e.g. once
per 5 secs.I use the schedule_timeout(time_interval) to make the
sending code work on time , yet it doesn't work as expected.Between
once invoking of schedule_timeout(time_interval) the load info is sent
for nearly 20 times.Anyone can give some advise about how to time the
function to work?Any advice is appreciated , thank U all in advance:)
My code is as blow
/* loop to send the load msg to the load-balancer */
while(1){
set_current_state(TASK_UNINTERRUPTIBLE) ;
// send_load() is the func to send load info
just for once, so call it repeatly in the while loop , this func is
called until the module is cleaned up when it runs to the init_module()
if( (ret = send_load(sock , (struct sockaddr*)&servaddr ,
addrlen)) < ERR_BASE)
break ; //function is interrupted , it happens when this module is
cleanup
// make sure it will wait until 5secs eclasps to 0
schedule_timeout(ret) ;
}

.



Relevant Pages

  • Programmatic use of load module
    ... programmaticaly load modules from RAM/ROM. ... named func is added to the system symbol table as part of a load. ... same name do not overwrite the fake symbols defined by module A. ...
    (comp.os.vxworks)
  • Re: Gridview Select Row Question
    ... In this case, the JavaScript function Func() ... Funcin the load after the async postback. ... Then hook an event handler to the async page load via ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Function alias
    ... One quick and dirty way: use eval, which of course comes with its own ... load of risks and issues. ...
    (comp.lang.perl.misc)
  • Macallan and SMDK2410 samsung bsp
    ... I am trying to use Samsung SMDK2410 BSP provided with 1371 build of ... I could build the same and when I try to load NK.bin using platform ...
    (microsoft.public.windowsce.platbuilder)