using sys_mknod in init_module

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

 



 Hi all,

    How to use sys_mknod function call in the driver init_module.
Currently my init_module function looks like as follows. I am trying
to create a device file in my init_module itself.

static int __init init_my_module(void)
{
       char device_name[15] = {'\0'};
       Major = register_chrdev(0, DEVICE_NAME, &fops);
       if(Major < 0)
       {
         printk(KERN_ALERT "Registering char device failed with %d\n", Major);
         return Major;
       }
       printk(KERN_INFO "I was assigned major number %d. To talk to
\n", Major);
       printk(KERN_INFO "the driver\n");
       printk(KERN_INFO "Try various minor numbers. Try to cat and
echo to\n");        printk(KERN_INFO "the device file.\n");
       printk(KERN_INFO "Remove the device file and module when done.\n");

       sys_mknod = sys_call_table[ __NR_mknod];
       sprintf(device_name, "/dev/%s", DEVICE_NAME);
       set_fs( get_ds() );
       sys_mknod(device_name, S_IFCHR|0666, MKDEV(Major,1));
       return SUCCESS;
}

  I am getting following warning....

   *** Warning: "sys_call_table"
[/home/NTEK-APPL/MODULE_PG/CHP4/chardev.ko] undefined!

    It looks like to me "sys_call_table" is not exported to kernel.
If it is true  then how to export it else how to solve this problem.

  Currently I am manually creating the device file using mknod in shell.

Thanks
Manjunath Naik

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