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 2:18 PM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
> 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);

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