module

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

 



Hi,
I am writing a module to find out the number of running processes.And i am trying to access the run queue.But while compiling it is showing an error.I will give the code.

#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched.h>

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RUN QUEUES");

static int __init init_module3(void);
static void __exit exit_module3(void);

static int __init init_module3()
{
   printk("Hello Module3\n");
   struct runqueue *rq;
   rq = (struct runqueue *)this_rq();
printk("Number Of Runnable Processes In The RunQ : %li\n",rq->nr_running);
   return 0;
}

static void __exit exit_module3()
{
   printk("Cruel World3!Bye");
}
module_init(init_module3);
module_exit(exit_module3);

but when compiling it is showing as

make -C /lib/modules/2.6.9-1.667/build SUBDIRS=/home/raja/Backup-Progs/ModuleProg/Mod3 modules
make[1]: Entering directory `/lib/modules/2.6.9-1.667/build'
 CC [M]  /home/raja/Backup-Progs/ModuleProg/Mod3/mod3.o
/home/raja/Backup-Progs/ModuleProg/Mod3/mod3.c: In function `init_module3':
/home/raja/Backup-Progs/ModuleProg/Mod3/mod3.c:14: warning: ISO C90 forbids mixed declarations and code /home/raja/Backup-Progs/ModuleProg/Mod3/mod3.c:15: warning: implicit declaration of function `this_rq' /home/raja/Backup-Progs/ModuleProg/Mod3/mod3.c:16: error: dereferencing pointer to incomplete type
make[2]: *** [/home/raja/Backup-Progs/ModuleProg/Mod3/mod3.o] Error 1
make[1]: *** [_module_/home/raja/Backup-Progs/ModuleProg/Mod3] Error 2
make[1]: Leaving directory `/lib/modules/2.6.9-1.667/build'
make: *** [default] Error 2


Will you please help me how to get the runqueue of the current processor

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