On Fri, Dec 10, 2010 at 2:18 PM, Daniel Baluta <daniel.bal...@gmail.com> wrote:
> On Fri, Dec 10, 2010 at 1:49 PM, Giriprasad Deviprasad <g_p...@yahoo.in> 
> wrote:
>>
>> Hi,
>>
>>  The following program hangs the kernel, when the insmod on it, is run. Can 
>> any one provide ideas why :
>>
>> #include <linux/module.h>       // for init_module()
>> #include <linux/proc_fs.h>      // for create_proc_info_entry()
>> #include <asm/io.h>             // for inb(), outb()
>>
>> int my_func( char *buf, char **start, off_t off, int count, int *eof, void 
>> *data )
>> {
>>         return 0;
>> }
>>
>> char modname[] = "cmos";
>> static int __init my_init( void )
>> {
>>
>>         struct proc_dir_entry *pde, *tmp;
>>         tmp = kmalloc(sizeof(struct proc_dir_entry), GFP_KERNEL);
> Add here a check for tmp.
>>         pde= create_proc_entry(modname, S_IFDIR | S_IRUGO | S_IXUGO , tmp);

Check this out ([1]). It seems that you are one step away from doing it right.
Your tmp argument must point to a valid dir entry or NULL. I think you
can use NULL
for the moment.

thanks,
Daniel.

[1] buffer.antifork.org/linux/procfs-guide.pdf

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to