regarding kernel version 2.6.9

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

 



hi kernel lovers,

my sysyem is red hat enterprise linux of linux version 2.6.9

i compiled the program given in oreilly device drivers 3rd edition .

    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/kernel.h>
    MODULE_LICENCE("Dual BSD/GPL");
    static int hello_init(void)
    {
        printk(KERN_ALERT "Hello, world\n");
        return 0;
    }

    static void hello_exit(void)
    {
        printk(KERN_ALERT "Goodbye, cruel world\n");
    }

    module_init(hello_init);
    module_exit(hello_exit);

but i got the below errors of

root@ihawk ddlinux]# gcc -c hello1.c
hello1.c:4: syntax error before string constant
hello1.c:4: warning: data definition has no type or storage class
hello1.c: In function `hello_init':
hello1.c:7: `KERN_ALERT' undeclared (first use in this function)
hello1.c:7: (Each undeclared identifier is reported only once
hello1.c:7: for each function it appears in.)
hello1.c:7: syntax error before string constant
hello1.c: In function `hello_exit':
hello1.c:13: `KERN_ALERT' undeclared (first use in this function)
hello1.c:13: syntax error before string constant

 so can anyone tell me exact commands for gcc, loadind and unloading modules. the commands given in book are giving some problems in my system
--
Thanks and Regards
Hari

[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