Re: create_proc_entry hangs the kernel

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

 



On Fri, Dec 10, 2010 at 1:49 PM, Giriprasad Deviprasad <g_pr21@xxxxxxxx> 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);
Move here the check for (pde).
>
>         pde->nlink = 1;
>         pde->read_proc = my_func;
>         if(pde)
>                 printk("proc_create sucessfull name = %s\n", pde->name);
>         else
>                 printk("proc_create not so sucessfull. Exiting........... \n");
>         return 0;

Let us know what happens after you make this changes.

thanks,
Daniel.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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