kernel mode file operations

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

 



hi
a try write iptables module to match load average.
part related to iptables seems done. but... how can o take access to
avenrun kernel variable? if i use filp_open

f=filp_open("/proc/loadavg",O_RDONLY,0);
if(IS_ERR(f)){              
	printk(KERN_DEBUG "file open failed.");                                
        return 1;                                           
}                                   
 fs=get_fs();                                    
 set_fs(get_ds());           
if(f &&f->f_op && f->f_op->read) 
   f->f_op->read(f,buf,sizeof(buf)-1,&f->f_pos);           
else                                    
   printk(KERN_DEBUG "pointer is NULL");                                
set_fs(fs); 
filp_close(f,0);                            

and so on, but my module works for 3-5 second and theb my pc is hang
can you help me?

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